diff --git a/flight/libraries/sanitycheck.c b/flight/libraries/sanitycheck.c index 61950cbd9..b84b4f7a0 100644 --- a/flight/libraries/sanitycheck.c +++ b/flight/libraries/sanitycheck.c @@ -178,26 +178,26 @@ int32_t configuration_check() } } - uint8_t checks_disabled; - FlightModeSettingsDisableSanityChecksGet(&checks_disabled); - if (checks_disabled == FLIGHTMODESETTINGS_DISABLESANITYCHECKS_TRUE) { - severity = SYSTEMALARMS_ALARM_WARNING; - } - // query sanity check hooks - if (severity == SYSTEMALARMS_ALARM_OK) { + if (severity < SYSTEMALARMS_ALARM_CRITICAL) { SANITYCHECK_CustomHookInstance *instance = NULL; LL_FOREACH(hooks, instance) { if (instance->enabled) { alarmstatus = instance->hook(); if (alarmstatus != SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE) { - severity = SYSTEMALARMS_ALARM_WARNING; + severity = SYSTEMALARMS_ALARM_CRITICAL; break; } } } } + uint8_t checks_disabled; + FlightModeSettingsDisableSanityChecksGet(&checks_disabled); + if (checks_disabled == FLIGHTMODESETTINGS_DISABLESANITYCHECKS_TRUE) { + severity = SYSTEMALARMS_ALARM_WARNING; + } + if (severity != SYSTEMALARMS_ALARM_OK) { ExtendedAlarmsSet(SYSTEMALARMS_ALARM_SYSTEMCONFIGURATION, severity, alarmstatus, alarmsubstatus); } else { diff --git a/flight/modules/Actuator/actuator.c b/flight/modules/Actuator/actuator.c index 891537bd6..e8b75b645 100644 --- a/flight/modules/Actuator/actuator.c +++ b/flight/modules/Actuator/actuator.c @@ -806,7 +806,7 @@ static void actuator_update_rate_if_changed(const ActuatorSettingsData *actuator freq[i] = 100; // Value must be small enough so CCr isn't update until the PIOS_Servo_Update is triggered clock[i] = ACTUATOR_ONESHOT125_CLOCK; // Setup an 8MHz timer clock break; - case ACTUATORSETTINGS_BANKMODE_ONESHOT: + case ACTUATORSETTINGS_BANKMODE_PWMSYNC: freq[i] = 100; clock[i] = ACTUATOR_PWM_CLOCK; break; diff --git a/flight/pios/stm32f10x/pios_servo.c b/flight/pios/stm32f10x/pios_servo.c index f0a11d8e2..76da3d33a 100644 --- a/flight/pios/stm32f10x/pios_servo.c +++ b/flight/pios/stm32f10x/pios_servo.c @@ -40,8 +40,10 @@ static const struct pios_servo_cfg *servo_cfg; // determine if the related timer will work in synchronous (or OneShot/OneShot125) One Pulse mode. -// static uint8_t pios_servo_bank_mode[PIOS_SERVO_BANKS] = { 0 }; - +static uint8_t pios_servo_bank_mode[PIOS_SERVO_BANKS] = { 0 }; +// used to skip updates when pulse length is higher than update cycle +static uint16_t pios_servo_bank_next_update[PIOS_SERVO_BANKS] = { 0 }; +static uint16_t pios_servo_bank_max_pulse[PIOS_SERVO_BANKS] = { 0 }; // timer associated to each bank static TIM_TypeDef *pios_servo_bank_timer[PIOS_SERVO_BANKS] = { 0 }; @@ -49,7 +51,7 @@ static TIM_TypeDef *pios_servo_bank_timer[PIOS_SERVO_BANKS] = { 0 }; static uint8_t *pios_servo_pin_bank; #define PIOS_SERVO_TIMER_CLOCK 1000000 - +#define PIOS_SERVO_SAFE_MARGIN 50 /** * Initialise Servos */ @@ -91,6 +93,12 @@ int32_t PIOS_Servo_Init(const struct pios_servo_cfg *cfg) pios_servo_pin_bank[j] = bank; } } + pios_servo_bank_timer[bank] = chan->timer; + + TIM_ARRPreloadConfig(chan->timer, ENABLE); + TIM_CtrlPWMOutputs(chan->timer, ENABLE); + TIM_Cmd(chan->timer, ENABLE); + bank++; } @@ -113,10 +121,6 @@ int32_t PIOS_Servo_Init(const struct pios_servo_cfg *cfg) TIM_OC4PreloadConfig(chan->timer, TIM_OCPreload_Enable); break; } - - TIM_ARRPreloadConfig(chan->timer, ENABLE); - TIM_CtrlPWMOutputs(chan->timer, ENABLE); - TIM_Cmd(chan->timer, ENABLE); } return 0; @@ -166,37 +170,106 @@ void PIOS_Servo_Set(uint8_t servo, uint16_t position) return; } + /* Update the position */ const struct pios_tim_channel *chan = &servo_cfg->channels[servo]; + uint16_t val = position; + uint16_t margin = chan->timer->ARR / 50; // Leave 2% of period as margin to prevent overlaps + if (val > (chan->timer->ARR - margin)) { + val = chan->timer->ARR - margin; + } + + uint8_t bank = pios_servo_pin_bank[servo]; + if (pios_servo_bank_max_pulse[bank] < val) { + pios_servo_bank_max_pulse[bank] = val; + } switch (chan->timer_chan) { case TIM_Channel_1: - TIM_SetCompare1(chan->timer, position); + TIM_SetCompare1(chan->timer, val); break; case TIM_Channel_2: - TIM_SetCompare2(chan->timer, position); + TIM_SetCompare2(chan->timer, val); break; case TIM_Channel_3: - TIM_SetCompare3(chan->timer, position); + TIM_SetCompare3(chan->timer, val); break; case TIM_Channel_4: - TIM_SetCompare4(chan->timer, position); + TIM_SetCompare4(chan->timer, val); break; } } void PIOS_Servo_Update() { - /* - for (uint8_t i = 0; (i < PIOS_SERVO_BANKS); i++) { + for (uint8_t i = 0; (i < PIOS_SERVO_BANKS); i++) { const TIM_TypeDef *timer = pios_servo_bank_timer[i]; - if (timer) { - TIM_Cmd((TIM_TypeDef *)timer, ENABLE); + if (timer && pios_servo_bank_mode[i] == PIOS_SERVO_BANK_MODE_SINGLE_PULSE) { + // a pulse to be generated is longer than cycle period. skip this update. + if (TIM_GetCounter((TIM_TypeDef *)timer) > (uint32_t)(pios_servo_bank_next_update[i] + PIOS_SERVO_SAFE_MARGIN)) { + TIM_GenerateEvent((TIM_TypeDef *)timer, TIM_EventSource_Update); + pios_servo_bank_next_update[i] = pios_servo_bank_max_pulse[i]; + } } - } - */ + pios_servo_bank_max_pulse[i] = 0; + } + for (uint8_t i = 0; (i < servo_cfg->num_channels); i++) { + uint8_t bank = pios_servo_pin_bank[i]; + uint8_t mode = pios_servo_bank_mode[bank]; + if (mode == PIOS_SERVO_BANK_MODE_SINGLE_PULSE) { + /* Update the position */ + const struct pios_tim_channel *chan = &servo_cfg->channels[i]; + + switch (chan->timer_chan) { + case TIM_Channel_1: + TIM_SetCompare1(chan->timer, 0); + break; + case TIM_Channel_2: + TIM_SetCompare2(chan->timer, 0); + break; + case TIM_Channel_3: + TIM_SetCompare3(chan->timer, 0); + break; + case TIM_Channel_4: + TIM_SetCompare4(chan->timer, 0); + break; + } + } + } +} + +void PIOS_Servo_SetBankMode(uint8_t bank, uint8_t mode) +{ + PIOS_Assert(bank < PIOS_SERVO_BANKS); + pios_servo_bank_mode[bank] = mode; + + if (pios_servo_bank_timer[bank]) { + for (uint8_t i = 0; (i < servo_cfg->num_channels); i++) { + if (pios_servo_pin_bank[i] == bank) { + const struct pios_tim_channel *chan = &servo_cfg->channels[i]; + /* Set up for output compare function */ + switch (chan->timer_chan) { + case TIM_Channel_1: + TIM_OC1PolarityConfig(chan->timer, TIM_OCPolarity_High); + break; + case TIM_Channel_2: + TIM_OC2PolarityConfig(chan->timer, TIM_OCPolarity_High); + break; + case TIM_Channel_3: + TIM_OC3PolarityConfig(chan->timer, TIM_OCPolarity_High); + break; + case TIM_Channel_4: + TIM_OC4PolarityConfig(chan->timer, TIM_OCPolarity_High); + break; + } + } + } + + // Setup the timer accordingly + TIM_SelectOnePulseMode(pios_servo_bank_timer[bank], TIM_OPMode_Repetitive); + TIM_Cmd(pios_servo_bank_timer[bank], ENABLE); + } } -void PIOS_Servo_SetBankMode(__attribute__((unused)) uint8_t bank, __attribute__((unused)) uint8_t mode) {} uint8_t PIOS_Servo_GetPinBank(uint8_t pin) { diff --git a/flight/pios/stm32f4xx/pios_servo.c b/flight/pios/stm32f4xx/pios_servo.c index 7e66c09e2..84a450b7f 100644 --- a/flight/pios/stm32f4xx/pios_servo.c +++ b/flight/pios/stm32f4xx/pios_servo.c @@ -142,11 +142,7 @@ void PIOS_Servo_SetBankMode(uint8_t bank, uint8_t mode) } } } - if (mode != PIOS_SERVO_BANK_MODE_PWM) { - // TIM_UpdateDisableConfig(pios_servo_bank_timer[bank], ENABLE); - } else { - // TIM_UpdateDisableConfig(pios_servo_bank_timer[bank], DISABLE); - } + // Setup the timer accordingly TIM_SelectOnePulseMode(pios_servo_bank_timer[bank], TIM_OPMode_Repetitive); TIM_Cmd(pios_servo_bank_timer[bank], ENABLE); diff --git a/flight/targets/boards/coptercontrol/board_hw_defs.c b/flight/targets/boards/coptercontrol/board_hw_defs.c index 6463451b3..2a22cf78a 100644 --- a/flight/targets/boards/coptercontrol/board_hw_defs.c +++ b/flight/targets/boards/coptercontrol/board_hw_defs.c @@ -1247,6 +1247,18 @@ const struct pios_ppm_cfg pios_ppm_cfg = { .num_channels = 1, }; +const struct pios_ppm_cfg pios_ppm_pin6_cfg = { + .tim_ic_init = { + .TIM_ICPolarity = TIM_ICPolarity_Rising, + .TIM_ICSelection = TIM_ICSelection_DirectTI, + .TIM_ICPrescaler = TIM_ICPSC_DIV1, + .TIM_ICFilter = 0x0, + }, + /* Use only the first channel for ppm */ + .channels = &pios_tim_rcvrport_all_channels[5], + .num_channels = 1, +}; + #endif /* PIOS_INCLUDE_PPM */ #if defined(PIOS_INCLUDE_PPM_FLEXI) diff --git a/flight/targets/boards/coptercontrol/firmware/pios_board.c b/flight/targets/boards/coptercontrol/firmware/pios_board.c index 62232d832..444c9f772 100644 --- a/flight/targets/boards/coptercontrol/firmware/pios_board.c +++ b/flight/targets/boards/coptercontrol/firmware/pios_board.c @@ -32,6 +32,8 @@ #include #include #include +#include +#include #ifdef PIOS_INCLUDE_INSTRUMENTATION #include @@ -52,6 +54,9 @@ */ uint32_t pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_NONE]; +static SystemAlarmsExtendedAlarmStatusOptions CopterControlConfigHook(); +static void ActuatorSettingsUpdatedCb(UAVObjEvent *ev); + #define PIOS_COM_TELEM_RF_RX_BUF_LEN 32 #define PIOS_COM_TELEM_RF_TX_BUF_LEN 12 @@ -712,8 +717,8 @@ void PIOS_Board_Init(void) uint8_t hwsettings_rcvrport; HwSettingsCC_RcvrPortGet(&hwsettings_rcvrport); - switch (hwsettings_rcvrport) { - case HWSETTINGS_CC_RCVRPORT_DISABLED: + switch ((HwSettingsCC_RcvrPortOptions)hwsettings_rcvrport) { + case HWSETTINGS_CC_RCVRPORT_DISABLEDONESHOT: #if defined(PIOS_INCLUDE_HCSR04) { uint32_t pios_hcsr04_id; @@ -721,7 +726,7 @@ void PIOS_Board_Init(void) } #endif break; - case HWSETTINGS_CC_RCVRPORT_PWM: + case HWSETTINGS_CC_RCVRPORT_PWMNOONESHOT: #if defined(PIOS_INCLUDE_PWM) { uint32_t pios_pwm_id; @@ -735,12 +740,17 @@ void PIOS_Board_Init(void) } #endif /* PIOS_INCLUDE_PWM */ break; - case HWSETTINGS_CC_RCVRPORT_PPM: - case HWSETTINGS_CC_RCVRPORT_PPMOUTPUTS: + case HWSETTINGS_CC_RCVRPORT_PPMNOONESHOT: + case HWSETTINGS_CC_RCVRPORT_PPMOUTPUTSNOONESHOT: + case HWSETTINGS_CC_RCVRPORT_PPM_PIN6ONESHOT: #if defined(PIOS_INCLUDE_PPM) { uint32_t pios_ppm_id; - PIOS_PPM_Init(&pios_ppm_id, &pios_ppm_cfg); + if (hwsettings_rcvrport == HWSETTINGS_CC_RCVRPORT_PPM_PIN6ONESHOT) { + PIOS_PPM_Init(&pios_ppm_id, &pios_ppm_pin6_cfg); + } else { + PIOS_PPM_Init(&pios_ppm_id, &pios_ppm_cfg); + } uint32_t pios_ppm_rcvr_id; if (PIOS_RCVR_Init(&pios_ppm_rcvr_id, &pios_ppm_rcvr_driver, pios_ppm_id)) { @@ -750,7 +760,7 @@ void PIOS_Board_Init(void) } #endif /* PIOS_INCLUDE_PPM */ break; - case HWSETTINGS_CC_RCVRPORT_PPMPWM: + case HWSETTINGS_CC_RCVRPORT_PPMPWMNOONESHOT: /* This is a combination of PPM and PWM inputs */ #if defined(PIOS_INCLUDE_PPM) { @@ -777,6 +787,8 @@ void PIOS_Board_Init(void) } #endif /* PIOS_INCLUDE_PWM */ break; + case HWSETTINGS_CC_RCVRPORT_OUTPUTSONESHOT: + break; } #if defined(PIOS_INCLUDE_GCSRCVR) @@ -794,15 +806,16 @@ void PIOS_Board_Init(void) GPIO_PinRemapConfig(GPIO_Remap_SWJ_NoJTRST, ENABLE); #ifndef PIOS_ENABLE_DEBUG_PINS - switch (hwsettings_rcvrport) { - case HWSETTINGS_CC_RCVRPORT_DISABLED: - case HWSETTINGS_CC_RCVRPORT_PWM: - case HWSETTINGS_CC_RCVRPORT_PPM: - case HWSETTINGS_CC_RCVRPORT_PPMPWM: + switch ((HwSettingsCC_RcvrPortOptions)hwsettings_rcvrport) { + case HWSETTINGS_CC_RCVRPORT_DISABLEDONESHOT: + case HWSETTINGS_CC_RCVRPORT_PWMNOONESHOT: + case HWSETTINGS_CC_RCVRPORT_PPMNOONESHOT: + case HWSETTINGS_CC_RCVRPORT_PPMPWMNOONESHOT: + case HWSETTINGS_CC_RCVRPORT_PPM_PIN6ONESHOT: PIOS_Servo_Init(&pios_servo_cfg); break; - case HWSETTINGS_CC_RCVRPORT_PPMOUTPUTS: - case HWSETTINGS_CC_RCVRPORT_OUTPUTS: + case HWSETTINGS_CC_RCVRPORT_PPMOUTPUTSNOONESHOT: + case HWSETTINGS_CC_RCVRPORT_OUTPUTSONESHOT: PIOS_Servo_Init(&pios_servo_rcvr_cfg); break; } @@ -841,6 +854,59 @@ void PIOS_Board_Init(void) /* Make sure we have at least one telemetry link configured or else fail initialization */ PIOS_Assert(pios_com_telem_rf_id || pios_com_telem_usb_id); + + // Attach the board config check hook + SANITYCHECK_AttachHook(&CopterControlConfigHook); + // trigger a config check if actuatorsettings are updated + ActuatorSettingsInitialize(); + ActuatorSettingsConnectCallback(ActuatorSettingsUpdatedCb); +} + +SystemAlarmsExtendedAlarmStatusOptions CopterControlConfigHook() +{ + // inhibit usage of oneshot for non supported RECEIVER port modes + uint8_t recmode; + + HwSettingsCC_RcvrPortGet(&recmode); + uint8_t flexiMode; + uint8_t modes[ACTUATORSETTINGS_BANKMODE_NUMELEM]; + ActuatorSettingsBankModeGet(modes); + HwSettingsCC_FlexiPortGet(&flexiMode); + + switch ((HwSettingsCC_RcvrPortOptions)recmode) { + // Those modes allows oneshot usage + case HWSETTINGS_CC_RCVRPORT_DISABLEDONESHOT: + case HWSETTINGS_CC_RCVRPORT_OUTPUTSONESHOT: + case HWSETTINGS_CC_RCVRPORT_PPM_PIN6ONESHOT: + if ((recmode == HWSETTINGS_CC_RCVRPORT_PPM_PIN6ONESHOT || + flexiMode == HWSETTINGS_CC_FLEXIPORT_PPM) && + (modes[3] == ACTUATORSETTINGS_BANKMODE_PWMSYNC || + modes[3] == ACTUATORSETTINGS_BANKMODE_ONESHOT125)) { + return SYSTEMALARMS_EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT; + } else { + return SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE; + } + + // inhibit oneshot for the following modes + case HWSETTINGS_CC_RCVRPORT_PPMNOONESHOT: + case HWSETTINGS_CC_RCVRPORT_PPMOUTPUTSNOONESHOT: + case HWSETTINGS_CC_RCVRPORT_PPMPWMNOONESHOT: + case HWSETTINGS_CC_RCVRPORT_PWMNOONESHOT: + for (uint8_t i = 0; i < ACTUATORSETTINGS_BANKMODE_NUMELEM; i++) { + if (modes[i] == ACTUATORSETTINGS_BANKMODE_PWMSYNC || + modes[i] == ACTUATORSETTINGS_BANKMODE_ONESHOT125) { + return SYSTEMALARMS_EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT;; + } + + return SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE; + } + } + return SYSTEMALARMS_EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT;; +} +// trigger a configuration check if ActuatorSettings are changed. +void ActuatorSettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) +{ + configuration_check(); } /** diff --git a/flight/targets/boards/revoproto/firmware/inc/pios_config.h b/flight/targets/boards/revoproto/firmware/inc/pios_config.h index b7aed8375..5897732ad 100644 --- a/flight/targets/boards/revoproto/firmware/inc/pios_config.h +++ b/flight/targets/boards/revoproto/firmware/inc/pios_config.h @@ -108,8 +108,6 @@ #define PIOS_INCLUDE_IAP #define PIOS_INCLUDE_SERVO /* #define PIOS_INCLUDE_I2C_ESC */ -#define PIOS_INCLUDE_OVERO -#define PIOS_OVERO_SPI /* #define PIOS_INCLUDE_SDCARD */ /* #define LOG_FILENAME "startup.log" */ #define PIOS_INCLUDE_FLASH diff --git a/ground/openpilotgcs/src/plugins/config/configgadget.qrc b/ground/openpilotgcs/src/plugins/config/configgadget.qrc index 01984a553..d89ac5bca 100644 --- a/ground/openpilotgcs/src/plugins/config/configgadget.qrc +++ b/ground/openpilotgcs/src/plugins/config/configgadget.qrc @@ -54,5 +54,6 @@ images/calibration/plane-swd.png images/calibration/board-swd.png images/gear.png + images/error.svg diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp index 330911bf4..36cdcd951 100644 --- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp @@ -32,7 +32,6 @@ #include "mixersettings.h" #include "actuatorcommand.h" #include "actuatorsettings.h" -#include "systemalarms.h" #include "systemsettings.h" #include "uavsettingsimportexport/uavsettingsimportexportfactory.h" #include @@ -53,6 +52,8 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren ui = new Ui_OutputWidget(); ui->setupUi(this); + ui->gvWarning->setScene(new QGraphicsScene(this)); + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); Core::Internal::GeneralSettings *settings = pm->getObject(); if (!settings->useExpertMode()) { @@ -105,6 +106,9 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren addWidgetBinding("ActuatorSettings", "BankMode", ui->cb_outputMode5, 4, 0, true); addWidgetBinding("ActuatorSettings", "BankMode", ui->cb_outputMode6, 5, 0, true); + SystemAlarms *systemAlarmsObj = SystemAlarms::GetInstance(getObjectManager()); + connect(systemAlarmsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateWarnings(UAVObject *))); + disconnect(this, SLOT(refreshWidgetsValues(UAVObject *))); populateWidgets(); @@ -115,6 +119,9 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren ConfigOutputWidget::~ConfigOutputWidget() { + SystemAlarms *systemAlarmsObj = SystemAlarms::GetInstance(getObjectManager()); + + disconnect(systemAlarmsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateWarnings(UAVObject *))); // Do nothing } @@ -436,3 +443,34 @@ void ConfigOutputWidget::stopTests() { ui->channelOutTest->setChecked(false); } + +void ConfigOutputWidget::updateWarnings(UAVObject *) +{ + SystemAlarms *systemAlarmsObj = SystemAlarms::GetInstance(getObjectManager()); + SystemAlarms::DataFields systemAlarms = systemAlarmsObj->getData(); + + if (systemAlarms.Alarm[SystemAlarms::ALARM_SYSTEMCONFIGURATION] > SystemAlarms::ALARM_WARNING) { + switch (systemAlarms.ExtendedAlarmStatus[SystemAlarms::EXTENDEDALARMSTATUS_SYSTEMCONFIGURATION]) { + case SystemAlarms::EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT: + setWarning(tr("OneShot only works with MainPort settings marked with \"+OneShot\"\nUsing \"PPM_PIN6+OneShot\" bank 4 (output 6) must be set to PWM")); + return; + } + } + setWarning(NULL); +} + +void ConfigOutputWidget::setWarning(QString message) +{ + QPixmap warningPic; + + ui->gvWarning->scene()->clear(); + if (!message.isNull()) { + warningPic.load(":/configgadget/images/error.svg"); + } else { + warningPic.load(""); + } + ui->gvWarning->scene()->addPixmap(warningPic); + ui->gvWarning->setSceneRect(warningPic.rect()); + ui->gvWarning->fitInView(warningPic.rect(), Qt::KeepAspectRatio); + ui->txtWarning->setText(message); +} diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.h b/ground/openpilotgcs/src/plugins/config/configoutputwidget.h index 3b25fed69..2478ca902 100644 --- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.h @@ -37,6 +37,8 @@ #include #include +#include "systemalarms.h" + class Ui_OutputWidget; class OutputChannelForm; @@ -50,11 +52,11 @@ public: protected: void enableControls(bool enable); + void setWarning(QString message); private: Ui_OutputWidget *ui; QList sliders; - void updateChannelInSlider(QSlider *slider, QLabel *min, QLabel *max, QCheckBox *rev, int value); void assignOutputChannel(UAVDataObject *obj, QString &str); @@ -70,6 +72,7 @@ private: UAVObject::Metadata accInitialData; private slots: + void updateWarnings(UAVObject *); void stopTests(); virtual void refreshWidgetsValues(UAVObject *obj = NULL); void updateObjectsFromWidgets(); diff --git a/ground/openpilotgcs/src/plugins/config/images/error.svg b/ground/openpilotgcs/src/plugins/config/images/error.svg new file mode 100644 index 000000000..8de454769 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/config/images/error.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ground/openpilotgcs/src/plugins/config/output.ui b/ground/openpilotgcs/src/plugins/config/output.ui index f804aab1d..a3389de63 100644 --- a/ground/openpilotgcs/src/plugins/config/output.ui +++ b/ground/openpilotgcs/src/plugins/config/output.ui @@ -6,7 +6,7 @@ 0 0 - 698 + 1096 754 @@ -122,7 +122,7 @@ 0 0 - 680 + 1078 672 @@ -160,13 +160,13 @@ Output configuration - - + + - - + Bank(Channels): - Qt::AlignCenter + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -180,70 +180,396 @@ - - + + - Bank(Channels): + - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Qt::AlignCenter - - - - Qt::Horizontal + + + + false - - QSizePolicy::Minimum - - - - 5 - 20 - - - - - - - + 0 0 - 0 + 100 20 - - Qt::Horizontal - - - QSizePolicy::Minimum - - + - 5 - 20 + 120 + 16777215 - + + + 10 + + + + Setup PWM rate here: usual value is 490 Hz for multirotor airframes. OneShot and OneShot125 does not use this value + + + + + + + 50 + + + + + 60 + + + + + 125 + + + + + 165 + + + + + 270 + + + + + 330 + + + + + 400 + + + + + 490 + + + - - + Qt::AlignCenter + + + + false + + + + 0 + 0 + + + + + 100 + 20 + + + + + 120 + 16777215 + + + + + 10 + + + + Setup PWM rate here: usual value is 490 Hz for multirotor airframes. OneShot and OneShot125 does not use this value + + + + + + + 50 + + + + + 60 + + + + + 125 + + + + + 165 + + + + + 270 + + + + + 330 + + + + + 400 + + + + + 490 + + + + + + + + false + + + + 0 + 0 + + + + + 100 + 20 + + + + + 120 + 16777215 + + + + + 10 + + + + Setup PWM rate here: usual value is 490 Hz for multirotor airframes. OneShot and OneShot125 does not use this value + + + + + + + 50 + + + + + 60 + + + + + 125 + + + + + 165 + + + + + 270 + + + + + 330 + + + + + 400 + + + + + 490 + + + + + + + + false + + + + 0 + 0 + + + + + 100 + 20 + + + + + 120 + 16777215 + + + + + 10 + + + + Setup PWM rate here: usual value is 490 Hz for multirotor airframes. OneShot and OneShot125 does not use this value + + + + + + + 50 + + + + + 60 + + + + + 125 + + + + + 165 + + + + + 270 + + + + + 330 + + + + + 400 + + + + + 490 + + + + + + + + false + + + + 0 + 0 + + + + + 100 + 20 + + + + + 120 + 16777215 + + + + + 10 + + + + Setup output mode. Use PWM or OneShot with Standard ESCs.\nSeveral other ESCs like BLHeli 13+ can use the more advanced OneShot125.\nWhen using OneShot125 all values set in min/max and idle are divided by eight before being sent to esc (i.e. 1000 = 125, 2000 = 250). + + + + + + + false + + + + 0 + 0 + + + + + 100 + 20 + + + + + 120 + 16777215 + + + + + 10 + + + + Setup output mode. Use PWM or OneShot with Standard ESCs.\nSeveral other ESCs like BLHeli 13+ can use the more advanced OneShot125.\nWhen using OneShot125 all values set in min/max and idle are divided by eight before being sent to esc (i.e. 1000 = 125, 2000 = 250). + + + @@ -277,10 +603,21 @@ - 0 + 100 20 + + + 120 + 16777215 + + + + + 10 + + Setup PWM rate here: usual value is 490 Hz for multirotor airframes. OneShot and OneShot125 does not use this value @@ -333,8 +670,8 @@ - - + + false @@ -344,58 +681,116 @@ 0 + + + 100 + 20 + + + + + 120 + 16777215 + + + + + 10 + + + + Setup output mode. Use PWM or OneShot with Standard ESCs.\nSeveral other ESCs like BLHeli 13+ can use the more advanced OneShot125.\nWhen using OneShot125 all values set in min/max and idle are divided by eight before being sent to esc (i.e. 1000 = 125, 2000 = 250). + + + + + + + + 0 + 0 + + 0 20 + + Mode: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + false + + + + 0 + 0 + + + + + 100 + 20 + + + + + 120 + 16777215 + + + + + 10 + + - Setup PWM rate here: usual value is 490 Hz for multirotor airframes. OneShot and OneShot125 does not use this value + Setup output mode. Use PWM or OneShot with Standard ESCs. +Several other ESCs like BLHeli 13+ can use the more advanced OneShot125. +When using OneShot125 all values set in min/max and idle are divided by eight before being sent to esc (i.e. 1000 = 125, 2000 = 250). - - + + + + + + false + + + + 0 + 0 + + + + + 100 + 20 + + + + + 120 + 16777215 + + + + + 10 + + + + Setup output mode. Use PWM or OneShot with Standard ESCs.\nSeveral other ESCs like BLHeli 13+ can use the more advanced OneShot125.\nWhen using OneShot125 all values set in min/max and idle are divided by eight before being sent to esc (i.e. 1000 = 125, 2000 = 250). - - - 50 - - - - - 60 - - - - - 125 - - - - - 165 - - - - - 270 - - - - - 330 - - - - - 400 - - - - - 490 - - @@ -420,8 +815,8 @@ - - + + false @@ -433,75 +828,21 @@ - 0 + 100 20 - - Setup PWM rate here: usual value is 490 Hz for multirotor airframes. OneShot and OneShot125 does not use this value - - - - - - - 50 - - - - - 60 - - - - - 125 - - - - - 165 - - - - - 270 - - - - - 330 - - - - - 400 - - - - - 490 - - - - - - - - false - - - - 0 - 0 - - - + - 0 - 20 + 70 + 16777215 + + + 10 + + Setup PWM rate here: usual value is 490 Hz for multirotor airframes. OneShot and OneShot125 does not use this value @@ -560,298 +901,6 @@ - - - - false - - - - 0 - 0 - - - - - 0 - 20 - - - - Setup PWM rate here: usual value is 490 Hz for multirotor airframes. OneShot and OneShot125 does not use this value - - - - - - - 50 - - - - - 60 - - - - - 125 - - - - - 165 - - - - - 270 - - - - - 330 - - - - - 400 - - - - - 490 - - - - - - - - false - - - - 0 - 0 - - - - - 0 - 20 - - - - Setup PWM rate here: usual value is 490 Hz for multirotor airframes. OneShot and OneShot125 does not use this value - - - - - - - 50 - - - - - 60 - - - - - 125 - - - - - 165 - - - - - 270 - - - - - 330 - - - - - 400 - - - - - 490 - - - - - - - - - 0 - 0 - - - - - 0 - 20 - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 5 - 20 - - - - - - - - - 0 - 0 - - - - - 0 - 20 - - - - Mode: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - false - - - - 0 - 0 - - - - - 0 - 20 - - - - Setup output mode. Use PWM or OneShot with Standard ESCs. -Several other ESCs like BLHeli 13+ can use the more advanced OneShot125. -When using OneShot125 all values set in min/max and idle are divided by eight before being sent to esc (i.e. 1000 = 125, 2000 = 250). - - - - - - - false - - - - 0 - 0 - - - - - 0 - 20 - - - - Setup output mode. Use PWM or OneShot with Standard ESCs.\nSeveral other ESCs like BLHeli 13+ can use the more advanced OneShot125.\nWhen using OneShot125 all values set in min/max and idle are divided by eight before being sent to esc (i.e. 1000 = 125, 2000 = 250). - - - - - - - false - - - - 0 - 0 - - - - - 0 - 20 - - - - Setup output mode. Use PWM or OneShot with Standard ESCs.\nSeveral other ESCs like BLHeli 13+ can use the more advanced OneShot125.\nWhen using OneShot125 all values set in min/max and idle are divided by eight before being sent to esc (i.e. 1000 = 125, 2000 = 250). - - - - - - - false - - - - 0 - 0 - - - - - 0 - 20 - - - - Setup output mode. Use PWM or OneShot with Standard ESCs.\nSeveral other ESCs like BLHeli 13+ can use the more advanced OneShot125.\nWhen using OneShot125 all values set in min/max and idle are divided by eight before being sent to esc (i.e. 1000 = 125, 2000 = 250). - - - - - - - false - - - - 0 - 0 - - - - - 0 - 20 - - - - Setup output mode. Use PWM or OneShot with Standard ESCs.\nSeveral other ESCs like BLHeli 13+ can use the more advanced OneShot125.\nWhen using OneShot125 all values set in min/max and idle are divided by eight before being sent to esc (i.e. 1000 = 125, 2000 = 250). - - - @@ -865,15 +914,108 @@ When using OneShot125 all values set in min/max and idle are divided by eight be - 0 + 100 20 + + + 70 + 16777215 + + + + + 10 + + Setup output mode. Use PWM or OneShot with Standard ESCs.\nSeveral other ESCs like BLHeli 13+ can use the more advanced OneShot125.\nWhen using OneShot125 all values set in min/max and idle are divided by eight before being sent to esc (i.e. 1000 = 125, 2000 = 250). + + + + 0 + + + + + + 32 + 32 + + + + + 32 + 32 + + + + background: transparent + + + QFrame::NoFrame + + + Qt::AlignCenter + + + QPainter::HighQualityAntialiasing + + + + + + + + 0 + 0 + + + + + 200 + 50 + + + + + 16777215 + 90 + + + + + 10 + 50 + false + + + + Calibration status + + + background-color: transparent; + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustIgnored + + + Qt::NoTextInteraction + + + + + @@ -927,6 +1069,17 @@ When using OneShot125 all values set in min/max and idle are divided by eight be + + + 100 + 0 + + + + + 10 + + Qt::Vertical diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/inputpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/inputpage.cpp index c74931300..849284e68 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/inputpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/inputpage.cpp @@ -77,10 +77,10 @@ bool InputPage::restartNeeded(VehicleConfigurationSource::INPUT_TYPE selectedTyp { switch (selectedType) { case VehicleConfigurationSource::INPUT_PWM: - return data.CC_RcvrPort != HwSettings::CC_RCVRPORT_PWM; + return data.CC_RcvrPort != HwSettings::CC_RCVRPORT_PWMNOONESHOT; case VehicleConfigurationSource::INPUT_PPM: - return data.CC_RcvrPort != HwSettings::CC_RCVRPORT_PPM; + return data.CC_RcvrPort != HwSettings::CC_RCVRPORT_PPMNOONESHOT; case VehicleConfigurationSource::INPUT_SBUS: return data.CC_MainPort != HwSettings::CC_MAINPORT_SBUS; diff --git a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp index 81bf4fd40..3fc3ea1fc 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp @@ -139,7 +139,7 @@ void VehicleConfigurationHelper::applyHardwareConfiguration() case VehicleConfigurationSource::CONTROLLER_CC: case VehicleConfigurationSource::CONTROLLER_CC3D: // Reset all ports - data.CC_RcvrPort = HwSettings::CC_RCVRPORT_DISABLED; + data.CC_RcvrPort = HwSettings::CC_RCVRPORT_DISABLEDONESHOT; // Default mainport to be active telemetry link data.CC_MainPort = HwSettings::CC_MAINPORT_TELEMETRY; @@ -147,10 +147,10 @@ void VehicleConfigurationHelper::applyHardwareConfiguration() data.CC_FlexiPort = HwSettings::CC_FLEXIPORT_DISABLED; switch (m_configSource->getInputType()) { case VehicleConfigurationSource::INPUT_PWM: - data.CC_RcvrPort = HwSettings::CC_RCVRPORT_PWM; + data.CC_RcvrPort = HwSettings::CC_RCVRPORT_PWMNOONESHOT; break; case VehicleConfigurationSource::INPUT_PPM: - data.CC_RcvrPort = HwSettings::CC_RCVRPORT_PPM; + data.CC_RcvrPort = HwSettings::CC_RCVRPORT_PPMNOONESHOT; break; case VehicleConfigurationSource::INPUT_SBUS: // We have to set teletry on flexport since s.bus needs the mainport. diff --git a/shared/uavobjectdefinition/actuatorsettings.xml b/shared/uavobjectdefinition/actuatorsettings.xml index 303770f4d..24c1decb0 100644 --- a/shared/uavobjectdefinition/actuatorsettings.xml +++ b/shared/uavobjectdefinition/actuatorsettings.xml @@ -2,14 +2,7 @@ Settings for the @ref ActuatorModule that controls the channel assignments for the mixer based on AircraftType - + diff --git a/shared/uavobjectdefinition/hwsettings.xml b/shared/uavobjectdefinition/hwsettings.xml index 2fb566340..3daac0180 100644 --- a/shared/uavobjectdefinition/hwsettings.xml +++ b/shared/uavobjectdefinition/hwsettings.xml @@ -1,7 +1,7 @@ Selection of optional hardware configurations. - + diff --git a/shared/uavobjectdefinition/systemalarms.xml b/shared/uavobjectdefinition/systemalarms.xml index 351b1edda..c242e133c 100644 --- a/shared/uavobjectdefinition/systemalarms.xml +++ b/shared/uavobjectdefinition/systemalarms.xml @@ -35,6 +35,7 @@ +