diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index f13881149..a81457e23 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -1935,16 +1935,25 @@ class SensorField: public TransformedField { void afterImport() override { if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) { - sensor.id = _id; - sensor.subid = _subid; - if (model.moduleData[0].isPxx1Module() || model.moduleData[1].isPxx1Module()) - sensor.instance = (_instance & 0x1F) + (version <= 218 ? -1 : 0); // 5 bits instance - else - sensor.instance = _instance & 0x1F; - sensor.rxIdx = (_instance >> 5) & 0x03; // 2 bits Rx idx - sensor.moduleIdx = (_instance >> 7) & 0x1; // 1 bit module idx - sensor.ratio = _ratio; - sensor.offset = _offset; + if (strlen(sensor.label) == 0) { + sensor.clear(); + } + else { + sensor.id = _id; + sensor.subid = _subid; + if (model.moduleData[0].isPxx1Module() || model.moduleData[1].isPxx1Module()) { + sensor.instance = (_instance & 0x1F) + (version <= 218 ? -1 : 0); // 5 bits instance + sensor.rxIdx = 0x03; // 2 bits Rx idx + sensor.moduleIdx = 0x01; // 1 bit module idx + } + else { + sensor.instance = _instance & 0x1F; + sensor.rxIdx = (_instance >> 5) & 0x03; // 2 bits Rx idx + sensor.moduleIdx = (_instance >> 7) & 0x1; // 1 bit module idx + } + sensor.ratio = _ratio; + sensor.offset = _offset; + } } else { sensor.persistentValue = _id; diff --git a/companion/src/firmwares/sensordata.cpp b/companion/src/firmwares/sensordata.cpp index a88f3239a..8d677ed50 100644 --- a/companion/src/firmwares/sensordata.cpp +++ b/companion/src/firmwares/sensordata.cpp @@ -92,24 +92,16 @@ QString SensorData::nameToString(int index) const return RadioData::getElementName(tr("TELE"), index + 1, label); } -QString SensorData::getRxOrModName(const ModelData* model) const +QString SensorData::getOrigin(const ModelData * model) const { - if ((type != TELEM_TYPE_CUSTOM) || (!id && !instance)) + if (type != TELEM_TYPE_CUSTOM || !id) return QString(); - const ModuleData& module = model->moduleData[moduleIdx]; - - if (module.isPxx2Module()) { - if (module.access.receivers & (1 << rxIdx)) { - return QString(module.access.receiverName[rxIdx]); - } - - // receiver does not seem to be active + const ModuleData & module = model->moduleData[moduleIdx]; + if (module.isPxx2Module() && rxIdx <= 2 && module.access.receivers & (1 << rxIdx)) { + return QString(module.access.receiverName[rxIdx]); + } + else { return QString(); } - - if (moduleIdx) - return tr("Internal"); - - return tr("External"); } diff --git a/companion/src/firmwares/sensordata.h b/companion/src/firmwares/sensordata.h index 8e95aa7f6..a5cdb4957 100644 --- a/companion/src/firmwares/sensordata.h +++ b/companion/src/firmwares/sensordata.h @@ -148,7 +148,7 @@ class SensorData { void updateUnit(); QString unitString() const; QString nameToString(int index) const; - QString getRxOrModName(const ModelData* model) const; + QString getOrigin(const ModelData* model) const; void clear() { memset(this, 0, sizeof(SensorData)); } }; diff --git a/companion/src/modeledit/telemetry.cpp b/companion/src/modeledit/telemetry.cpp index 39a314fa7..68be10638 100644 --- a/companion/src/modeledit/telemetry.cpp +++ b/companion/src/modeledit/telemetry.cpp @@ -653,9 +653,8 @@ void TelemetrySensorPanel::update() ui->id->hide(); ui->instanceLabel->hide(); ui->instance->hide(); - ui->rxLabel->hide(); - ui->moduleLabel->hide(); - ui->rxOrMod->hide(); + ui->originLabel->hide(); + ui->origin->hide(); ui->formula->show(); ui->formula->setCurrentIndex(sensor.formula); isConfigurable = (sensor.formula < SensorData::TELEM_FORMULA_CELL); @@ -679,13 +678,10 @@ void TelemetrySensorPanel::update() ui->id->show(); ui->instanceLabel->show(); ui->instance->show(); - - bool is_pxx2 = model->moduleData[sensor.moduleIdx].isPxx2Module(); - ui->rxLabel->setVisible(is_pxx2); - ui->moduleLabel->setVisible(!is_pxx2); - - ui->rxOrMod->setText(sensor.getRxOrModName(model)); - ui->rxOrMod->show(); + QString origin = sensor.getOrigin(model); + ui->originLabel->setVisible(!origin.isEmpty()); + ui->origin->setVisible(!origin.isEmpty()); + ui->origin->setText(origin); ui->formula->hide(); isConfigurable = sensor.unit < SensorData::UNIT_FIRST_VIRTUAL; @@ -755,7 +751,7 @@ void populateTelemetrySourcesComboBox(AutoComboBox * cb, const ModelData * model const SensorData& sensor = model->sensorData[-i-1]; if (sensor.isAvailable()) { if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) - cb->addItem(QString("-%1 (%2)").arg(sensor.label, sensor.getRxOrModName(model)), i); + cb->addItem(QString("-%1 (%2)").arg(sensor.label, sensor.getOrigin(model)), i); else cb->addItem(QString("-%1").arg(sensor.label), i); } @@ -766,7 +762,7 @@ void populateTelemetrySourcesComboBox(AutoComboBox * cb, const ModelData * model const SensorData& sensor = model->sensorData[i-1]; if (sensor.isAvailable()) { if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) - cb->addItem(QString("%1 (%2)").arg(sensor.label, sensor.getRxOrModName(model)), i); + cb->addItem(QString("%1 (%2)").arg(sensor.label, sensor.getOrigin(model)), i); else cb->addItem(QString("%1").arg(sensor.label), i); } diff --git a/companion/src/modeledit/telemetry_sensor.ui b/companion/src/modeledit/telemetry_sensor.ui index f6007f6d6..7d08243e0 100644 --- a/companion/src/modeledit/telemetry_sensor.ui +++ b/companion/src/modeledit/telemetry_sensor.ui @@ -13,7 +13,7 @@ Form - + 0 @@ -121,21 +121,14 @@ - + Rx - - - Mod. - - - - - + 0 diff --git a/companion/src/modelslist.cpp b/companion/src/modelslist.cpp index b106a2896..50950872c 100644 --- a/companion/src/modelslist.cpp +++ b/companion/src/modelslist.cpp @@ -727,7 +727,7 @@ void TreeModel::refresh() protocol = moduleData.protocol; // These are the only RXs that allow nominating RX # but changing RX or copying models can leave residual configuration which can cause issues // if (protocol == PULSES_PXX_XJT_X16 || protocol == PULSES_PXX_XJT_LR12 || protocol == PULSES_PXX_R9M || protocol == PULSES_DSMX || protocol == PULSES_MULTIMODULE) { - if (protocol != PULSES_OFF && moduleData.modelId > 0) { + if ((protocol != PULSES_OFF && protocol != PULSES_PXX_XJT_D8 ) && moduleData.modelId > 0) { if (!rxs.isEmpty()) { rxs.append(", "); } @@ -751,6 +751,9 @@ void TreeModel::refresh() bool TreeModel::isModelIdUnique(unsigned modelIdx, unsigned module, unsigned protocol) { int cnt = 0; + if (protocol== PULSES_PXX_XJT_D8) + return true; + for (auto const& model: radioData->models) { if (!model.isEmpty()) { const ModuleData& moduleData = model.moduleData[module]; diff --git a/radio/src/gui/128x64/model_setup.cpp b/radio/src/gui/128x64/model_setup.cpp index b59ab5baf..b89afc152 100644 --- a/radio/src/gui/128x64/model_setup.cpp +++ b/radio/src/gui/128x64/model_setup.cpp @@ -1427,6 +1427,9 @@ void menuModelSetup(event_t event) } else { CHECK_INCDEC_MODELVAR(event, g_model.moduleData[moduleIdx].multi.optionValue, -128, 127); + lcdDrawText(MODEL_SETUP_2ND_COLUMN+23, y, "RSSI(", LEFT); + lcdDrawNumber(lcdLastRightPos, y, TELEMETRY_RSSI(), LEFT); + lcdDrawText(lcdLastRightPos, y, ")", LEFT); } } } diff --git a/radio/src/gui/212x64/model_setup.cpp b/radio/src/gui/212x64/model_setup.cpp index 979a27401..4637d8634 100644 --- a/radio/src/gui/212x64/model_setup.cpp +++ b/radio/src/gui/212x64/model_setup.cpp @@ -1253,6 +1253,9 @@ void menuModelSetup(event_t event) } else { CHECK_INCDEC_MODELVAR(event, g_model.moduleData[moduleIdx].multi.optionValue, -128, 127); + lcdDrawText(MODEL_SETUP_3RD_COLUMN+22, y, "RSSI(", LEFT); + lcdDrawNumber(lcdLastRightPos, y, TELEMETRY_RSSI(), LEFT); + lcdDrawText(lcdLastRightPos, y, ")", LEFT); } } } diff --git a/radio/src/gui/480x272/model_setup.cpp b/radio/src/gui/480x272/model_setup.cpp index 288d2178e..c759bfb77 100644 --- a/radio/src/gui/480x272/model_setup.cpp +++ b/radio/src/gui/480x272/model_setup.cpp @@ -1562,6 +1562,7 @@ bool menuModelSetup(event_t event) } else { CHECK_INCDEC_MODELVAR(event, g_model.moduleData[moduleIdx].multi.optionValue, -128, 127); + lcdDrawNumber(LCD_W-10, y, TELEMETRY_RSSI(), RIGHT, 0, "RSSI(", ")"); } } } diff --git a/radio/src/gui/480x272/radio_tools.cpp b/radio/src/gui/480x272/radio_tools.cpp index 283799234..cf560fd71 100644 --- a/radio/src/gui/480x272/radio_tools.cpp +++ b/radio/src/gui/480x272/radio_tools.cpp @@ -49,7 +49,7 @@ void addRadioModuleTool(uint8_t index, const char * label, bool (* tool)(event_t #if defined(LUA) void addRadioScriptTool(uint8_t index, const char * path) { - char toolName[TOOL_NAME_MAXLEN + 1]; + char toolName[RADIO_TOOL_NAME_MAXLEN + 1]; const char * label; char * ext = (char *)getFileExtension(path); if (readToolName(toolName, path)) { diff --git a/radio/src/gui/common/stdlcd/radio_tools.cpp b/radio/src/gui/common/stdlcd/radio_tools.cpp index 9eb478507..1ac177c21 100644 --- a/radio/src/gui/common/stdlcd/radio_tools.cpp +++ b/radio/src/gui/common/stdlcd/radio_tools.cpp @@ -46,15 +46,13 @@ void addRadioModuleTool(uint8_t index, const char * label, void (* tool)(event_t } } -#define TOOL_NAME_MAXLEN 16 - #if defined(LUA) void addRadioScriptTool(uint8_t index, const char * path) { - char toolName[TOOL_NAME_MAXLEN + 1]; + char toolName[RADIO_TOOL_NAME_MAXLEN + 1]; if (!readToolName(toolName, path)) { - strAppendFilename(toolName, getBasename(path), TOOL_NAME_MAXLEN); + strAppendFilename(toolName, getBasename(path), RADIO_TOOL_NAME_MAXLEN); } if (addRadioTool(index, toolName)) { diff --git a/radio/src/lua/interface.cpp b/radio/src/lua/interface.cpp index f1bdbe0f6..73b71da62 100644 --- a/radio/src/lua/interface.cpp +++ b/radio/src/lua/interface.cpp @@ -1150,11 +1150,11 @@ bool readToolName(char * toolName, const char * filename) return false; uint8_t len = end - start; - if (len > TOOL_NAME_MAXLEN) + if (len > RADIO_TOOL_NAME_MAXLEN) return false; strncpy(toolName, start, len); - memclear(toolName + len, TOOL_NAME_MAXLEN + 1 - len); + memclear(toolName + len, RADIO_TOOL_NAME_MAXLEN + 1 - len); return true; } diff --git a/radio/src/lua/lua_api.h b/radio/src/lua/lua_api.h index 007e7b8f1..71a1cef01 100644 --- a/radio/src/lua/lua_api.h +++ b/radio/src/lua/lua_api.h @@ -171,7 +171,12 @@ void registerBitmapClass(lua_State * L); void luaSetInstructionsLimit(lua_State* L, int count); int luaLoadScriptFileToState(lua_State * L, const char * filename, const char * mode); -#define TOOL_NAME_MAXLEN 16 +#if LCD_W > 350 + #define RADIO_TOOL_NAME_MAXLEN 40 +#else + #define RADIO_TOOL_NAME_MAXLEN 16 +#endif + bool readToolName(char * toolName, const char * filename); bool isRadioScriptTool(const char * filename); diff --git a/radio/src/mixer.cpp b/radio/src/mixer.cpp index 72f8f85e1..aaa22ecb1 100644 --- a/radio/src/mixer.cpp +++ b/radio/src/mixer.cpp @@ -341,8 +341,8 @@ getvalue_t getValue(mixsrc_t i) } #if defined(PCBTARANIS) || defined(PCBHORUS) - else if ((i >= MIXSRC_FIRST_SWITCH) && (i <= MIXSRC_LAST_SWITCH)) { - mixsrc_t sw = i-MIXSRC_FIRST_SWITCH; + else if (i >= MIXSRC_FIRST_SWITCH && i <= MIXSRC_LAST_SWITCH) { + mixsrc_t sw = i - MIXSRC_FIRST_SWITCH; if (SWITCH_EXISTS(sw)) { return (switchState(3*sw) ? -1024 : (IS_CONFIG_3POS(sw) && switchState(3*sw+1) ? 0 : 1024)); } diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 392b2e140..16419655d 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -838,6 +838,21 @@ void checkSDVersion() } #endif +#if defined(MULTIMODULE) +void checkMultiLowPower() +{ + if (isModuleMultimodule(EXTERNAL_MODULE) && g_model.moduleData[EXTERNAL_MODULE].multi.lowPowerMode) { + ALERT("MULTI", STR_WARN_MULTI_LOWPOWER, AU_ERROR); + return; + } +#if defined(INTERNAL_MODULE_MULTI) + if (isModuleMultimodule(INTERNAL_MODULE) && g_model.moduleData[INTERNAL_MODULE].multi.lowPowerMode) { + ALERT("MULTI", STR_WARN_MULTI_LOWPOWER, AU_ERROR); + } +#endif +} +#endif + #if defined(STM32) static void checkRTCBattery() { @@ -901,6 +916,10 @@ void checkAll() readModelNotes(); } +#if defined(MULTIMODULE) + checkMultiLowPower(); +#endif + if (!waitKeysReleased()) { showMessageBox(STR_KEYSTUCK); tmr10ms_t tgtime = get_tmr10ms() + 500; diff --git a/radio/src/pulses/multi.cpp b/radio/src/pulses/multi.cpp index babfc4bb1..a84bb04a1 100644 --- a/radio/src/pulses/multi.cpp +++ b/radio/src/pulses/multi.cpp @@ -59,18 +59,13 @@ static void sendFailsafeChannels(uint8_t port) for (int i = 0; i < MULTI_CHANS; i++) { int16_t failsafeValue = g_model.failsafeChannels[i]; int pulseValue; - if (g_model.moduleData[port].failsafeMode == FAILSAFE_HOLD) - failsafeValue = FAILSAFE_CHANNEL_HOLD; - if (g_model.moduleData[port].failsafeMode == FAILSAFE_NOPULSES) - failsafeValue = FAILSAFE_CHANNEL_NOPULSE; - - if (failsafeValue == FAILSAFE_CHANNEL_HOLD) { - pulseValue = 0; - } - else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE) { + if (g_model.moduleData[port].failsafeMode == FAILSAFE_HOLD) { pulseValue = 2047; } + else if (g_model.moduleData[port].failsafeMode == FAILSAFE_NOPULSES) { + pulseValue = 0; + } else { failsafeValue += 2 * PPM_CH_CENTER(g_model.moduleData[port].channelsStart + i) - 2 * PPM_CENTER; pulseValue = limit(1, (failsafeValue * 800 / 1000) + 1024, 2047); diff --git a/radio/src/storage/conversions/conversions_218_219.cpp b/radio/src/storage/conversions/conversions_218_219.cpp index 0f2c6de9c..f6076917d 100644 --- a/radio/src/storage/conversions/conversions_218_219.cpp +++ b/radio/src/storage/conversions/conversions_218_219.cpp @@ -290,7 +290,7 @@ void convertModelData_218_to_219(ModelData &model) for (uint8_t i=0; i 0 && (isModuleTypePXX1(oldModel.moduleData[0].type) || isModuleTypePXX1(oldModel.moduleData[1].type))) newModel.telemetrySensors[i].instance = 0xE0 + (oldModel.telemetrySensors[i].instance & 0x1F) - 1; else newModel.telemetrySensors[i].instance = oldModel.telemetrySensors[i].instance; diff --git a/radio/src/switches.cpp b/radio/src/switches.cpp index f10bc9497..1a405fb05 100644 --- a/radio/src/switches.cpp +++ b/radio/src/switches.cpp @@ -154,6 +154,15 @@ void getSwitchesPosition(bool startup) CHECK_2POS(SW_SH); #endif +#if defined(PCBX9DP) && PCBREV >= 2019 + CHECK_2POS(SW_SI); +#endif + +#if defined(PCBHORUS) || defined(PCBX7) + CHECK_2POS(SW_SI); + CHECK_2POS(SW_SJ); +#endif + #if defined(PCBX9E) CHECK_3POS(6, SW_SI); CHECK_3POS(7, SW_SJ); diff --git a/radio/src/targets/horus/hal.h b/radio/src/targets/horus/hal.h index 10e169665..5c07cb7b5 100644 --- a/radio/src/targets/horus/hal.h +++ b/radio/src/targets/horus/hal.h @@ -195,23 +195,22 @@ // Index of all keys #if defined(PCBX12S) - #define KEYS_GPIOB_PINS (SWITCHES_GPIO_PIN_B_L | SWITCHES_GPIO_PIN_C_L | TRIMS_GPIO_PIN_LSD | TRIMS_GPIO_PIN_LSU) - #define KEYS_GPIOC_PINS (KEYS_GPIO_PIN_PGUP | KEYS_GPIO_PIN_ENTER | KEYS_GPIO_PIN_RIGHT | TRIMS_GPIO_PIN_RHL) - #define KEYS_GPIOD_PINS (SWITCHES_GPIO_PIN_C_H | TRIMS_GPIO_PIN_LHL | TRIMS_GPIO_PIN_LHR | TRIMS_GPIO_PIN_RSU) - #define KEYS_GPIOE_PINS (SWITCHES_GPIO_PIN_E_L) + #define KEYS_GPIOB_PINS (GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15) + #define KEYS_GPIOC_PINS (GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_13) + #define KEYS_GPIOD_PINS (GPIO_Pin_3 | GPIO_Pin_7 | GPIO_Pin_11 | GPIO_Pin_13) + #define KEYS_GPIOE_PINS (GPIO_Pin_3) #define KEYS_GPIOG_PINS (KEYS_GPIO_PIN_UP | SWITCHES_GPIO_PIN_D_L | SWITCHES_GPIO_PIN_G_H | SWITCHES_GPIO_PIN_G_L | SWITCHES_GPIO_PIN_H | TRIMS_GPIO_PIN_RVD) - #define KEYS_GPIOH_PINS (SWITCHES_GPIO_PIN_A_H | SWITCHES_GPIO_PIN_B_H | SWITCHES_GPIO_PIN_E_H | SWITCHES_GPIO_PIN_F | ROTARY_ENCODER_GPIO_PIN_A | ROTARY_ENCODER_GPIO_PIN_B) - #define KEYS_GPIOI_PINS (KEYS_GPIO_PIN_PGDN | KEYS_GPIO_PIN_LEFT | KEYS_GPIO_PIN_DOWN | SWITCHES_GPIO_PIN_A_L | TRIMS_GPIO_PIN_RHR) + #define KEYS_GPIOH_PINS (GPIO_Pin_9 | GPIO_Pin_12 | SWITCHES_GPIO_PIN_E_H | SWITCHES_GPIO_PIN_F | ROTARY_ENCODER_GPIO_PIN_A | ROTARY_ENCODER_GPIO_PIN_B) + #define KEYS_GPIOI_PINS (KEYS_GPIO_PIN_PGDN | KEYS_GPIO_PIN_LEFT | KEYS_GPIO_PIN_DOWN | SWITCHES_GPIO_PIN_A_L | GPIO_Pin_4) #define KEYS_GPIOJ_PINS (SWITCHES_GPIO_PIN_D_H | TRIMS_GPIO_PIN_RVU | TRIMS_GPIO_PIN_LVD | TRIMS_GPIO_PIN_LVU | TRIMS_GPIO_PIN_RSD) #elif defined(PCBX10) - #define KEYS_GPIOB_PINS (SWITCHES_GPIO_PIN_B_L | SWITCHES_GPIO_PIN_C_L | TRIMS_GPIO_PIN_RSU | TRIMS_GPIO_PIN_RSD | TRIMS_GPIO_PIN_LHL | TRIMS_GPIO_PIN_LHR) - #define KEYS_GPIOC_PINS (TRIMS_GPIO_PIN_LHL) - #define KEYS_GPIOD_PINS (SWITCHES_GPIO_PIN_C_H | TRIMS_GPIO_PIN_RHL | TRIMS_GPIO_PIN_RHR | TRIMS_GPIO_PIN_LSD) - #define KEYS_GPIOE_PINS (SWITCHES_GPIO_PIN_E_L) + #define KEYS_GPIOB_PINS (GPIO_Pin_12 | GPIO_Pin_15 | GPIO_Pin_14 | GPIO_Pin_13 | GPIO_Pin_8 | GPIO_Pin_9) + #define KEYS_GPIOD_PINS (GPIO_Pin_11 | GPIO_Pin_3 | GPIO_Pin_7 | GPIO_Pin_13) + #define KEYS_GPIOE_PINS (GPIO_Pin_3) #define KEYS_GPIOG_PINS (SWITCHES_GPIO_PIN_D_L | SWITCHES_GPIO_PIN_G_H | SWITCHES_GPIO_PIN_G_L | SWITCHES_GPIO_PIN_H | TRIMS_GPIO_PIN_LVD) #define KEYS_GPIOH_PINS (GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_14 | GPIO_Pin_15) #define KEYS_GPIOI_PINS (GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_11 | GPIO_Pin_15) - #define KEYS_GPIOJ_PINS (SWITCHES_GPIO_PIN_D_H | TRIMS_GPIO_PIN_LVU | TRIMS_GPIO_PIN_RVD | TRIMS_GPIO_PIN_RVU | TRIMS_GPIO_PIN_LSU) + #define KEYS_GPIOJ_PINS (SWITCHES_GPIO_PIN_D_H | TRIMS_GPIO_PIN_LVU | TRIMS_GPIO_PIN_RVD | TRIMS_GPIO_PIN_RVU | GPIO_Pin_8) #endif // ADC diff --git a/radio/src/targets/horus/keys_driver.cpp b/radio/src/targets/horus/keys_driver.cpp index 1a04427a4..52d862ad1 100644 --- a/radio/src/targets/horus/keys_driver.cpp +++ b/radio/src/targets/horus/keys_driver.cpp @@ -207,8 +207,10 @@ void keysInit() GPIO_InitStructure.GPIO_Pin = KEYS_GPIOB_PINS; GPIO_Init(GPIOB, &GPIO_InitStructure); +#if defined(KEYS_GPIOC_PINS) GPIO_InitStructure.GPIO_Pin = KEYS_GPIOC_PINS; GPIO_Init(GPIOC, &GPIO_InitStructure); +#endif GPIO_InitStructure.GPIO_Pin = KEYS_GPIOD_PINS; GPIO_Init(GPIOD, &GPIO_InitStructure); diff --git a/radio/src/telemetry/flysky_ibus.cpp b/radio/src/telemetry/flysky_ibus.cpp index d4b00c995..cebb60e78 100644 --- a/radio/src/telemetry/flysky_ibus.cpp +++ b/radio/src/telemetry/flysky_ibus.cpp @@ -45,9 +45,10 @@ struct FlySkySensor { #define TX_RSSI_ID 300 // Pseudo id outside 1 byte range of FlySky sensors #define FS_ID_TEMP 0x01 -#define FS_ID_SNR 0xfa -#define FS_ID_NOISE 0xfb -#define FS_ID_RSSI 0xfc +#define FS_ID_SNR 0xFA +#define FS_ID_NOISE 0xFB +#define FS_ID_RSSI 0xFC +#define FS_ID_ERR 0xFE const FlySkySensor flySkySensors[] = { @@ -66,7 +67,7 @@ const FlySkySensor flySkySensors[] = { // RX RSSI (0xfc) {FS_ID_RSSI, ZSTR_RSSI, UNIT_DB, 0}, // RX error rate - {0xfe, ZSTR_RX_QUALITY, UNIT_RAW, 0}, + {FS_ID_ERR, ZSTR_RX_QUALITY, UNIT_RAW, 0}, // 0xff is an unused sensor slot // Pseudo sensor for TRSSI {TX_RSSI_ID, ZSTR_TX_RSSI, UNIT_RAW, 0}, @@ -90,8 +91,11 @@ static void processFlySkySensor(const uint8_t *packet) id = 0x100; } - if (id == FS_ID_SNR) { + if (id == FS_ID_ERR) { // ERR RATE, displayed RQLy and used as RSSI + value = 100 - value; telemetryData.rssi.set(value); + if (value > 0) + telemetryStreaming = TELEMETRY_TIMEOUT10ms; } for (const FlySkySensor * sensor = flySkySensors; sensor->id; sensor++) { @@ -99,7 +103,12 @@ static void processFlySkySensor(const uint8_t *packet) if (sensor->id == id) { // The Noise and Signal sensors that are specified in dB send the absolute value if (id == FS_ID_NOISE || id == FS_ID_RSSI) - value = -value; + value = 135 - value; + else if (id == FS_ID_SNR) { + if (value > 0) { + value += 20; + } + } else if (id == FS_ID_TEMP) // Temperature sensors have 40 degree offset value -= 400; @@ -122,7 +131,6 @@ void processFlySkyPacket(const uint8_t *packet) int index = 1 + (4 * sensor); processFlySkySensor(packet+index); } - telemetryStreaming = TELEMETRY_TIMEOUT10ms; } void processFlySkyTelemetryData(uint8_t data) diff --git a/radio/src/translations.cpp b/radio/src/translations.cpp index 755842b55..953330f4b 100644 --- a/radio/src/translations.cpp +++ b/radio/src/translations.cpp @@ -354,6 +354,7 @@ const char STR_SWITCHWARN[] = TR_SWITCHWARN; const char STR_FAILSAFEWARN[] = TR_FAILSAFEWARN; const char STR_WRONG_SDCARDVERSION[] = TR_WRONG_SDCARDVERSION; const char STR_WARN_RTC_BATTERY_LOW[] = TR_WARN_RTC_BATTERY_LOW; +const char STR_WARN_MULTI_LOWPOWER[] = TR_WARN_MULTI_LOWPOWER; const char STR_BATTERY[] = TR_BATTERY; const char STR_WRONG_PCBREV[] = TR_WRONG_PCBREV; const char STR_EMERGENCY_MODE[] = TR_EMERGENCY_MODE; diff --git a/radio/src/translations.h b/radio/src/translations.h index f4ad4b962..070c11e66 100644 --- a/radio/src/translations.h +++ b/radio/src/translations.h @@ -549,6 +549,7 @@ extern const char STR_NIGHTLY_WARNING[]; extern const char STR_NIGHTLY_NOTSAFE[]; extern const char STR_WRONG_SDCARDVERSION[]; extern const char STR_WARN_RTC_BATTERY_LOW[]; +extern const char STR_WARN_MULTI_LOWPOWER[]; extern const char STR_BATTERY[]; extern const char STR_WRONG_PCBREV[]; extern const char STR_EMERGENCY_MODE[]; diff --git a/radio/src/translations/cz.h.txt b/radio/src/translations/cz.h.txt index 1484da893..4c04844cb 100644 --- a/radio/src/translations/cz.h.txt +++ b/radio/src/translations/cz.h.txt @@ -734,6 +734,7 @@ #define TR_NIGHTLY_NOTSAFE "Verze není bezpečná k létání" #define TR_WRONG_SDCARDVERSION "Očekávaná ver.: " #define TR_WARN_RTC_BATTERY_LOW "Slabá RTC baterie" +#define TR_WARN_MULTI_LOWPOWER "Low power mode" #define TR_BATTERY "BATERIE" #define TR_WRONG_PCBREV "Jiná verze PCB/firmware" #define TR_EMERGENCY_MODE "NOUZOVÝ REŽIM" diff --git a/radio/src/translations/de.h.txt b/radio/src/translations/de.h.txt index 760f965ab..ffa5d7a91 100644 --- a/radio/src/translations/de.h.txt +++ b/radio/src/translations/de.h.txt @@ -736,6 +736,7 @@ #define TR_NIGHTLY_NOTSAFE "Nicht für Flug geeignet" #define TR_WRONG_SDCARDVERSION TR("Erw. Version: ","Erwartete Version: ") #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" +#define TR_WARN_MULTI_LOWPOWER "Low power mode" #define TR_BATTERY "BATTERY" #define TR_WRONG_PCBREV "Falsche PCB erkannt" #define TR_EMERGENCY_MODE "NOTFALL MODUS" diff --git a/radio/src/translations/en.h.txt b/radio/src/translations/en.h.txt index cfc4b98c1..784ce1b4c 100644 --- a/radio/src/translations/en.h.txt +++ b/radio/src/translations/en.h.txt @@ -736,6 +736,7 @@ #define TR_NIGHTLY_NOTSAFE "Version not safe to fly" #define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ") #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" +#define TR_WARN_MULTI_LOWPOWER "Low power mode" #define TR_BATTERY "BATTERY" #define TR_WRONG_PCBREV "Wrong PCB detected" #define TR_EMERGENCY_MODE "EMERGENCY MODE" diff --git a/radio/src/translations/es.h.txt b/radio/src/translations/es.h.txt index b566aaba5..74e8b6d16 100644 --- a/radio/src/translations/es.h.txt +++ b/radio/src/translations/es.h.txt @@ -759,6 +759,7 @@ #define TR_NIGHTLY_NOTSAFE "Version not safe to fly" #define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ") #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" +#define TR_WARN_MULTI_LOWPOWER "Low power mode" #define TR_BATTERY "BATTERY" #define TR_WRONG_PCBREV "Wrong PCB detected" #define TR_EMERGENCY_MODE "EMERGENCY MODE" diff --git a/radio/src/translations/fi.h.txt b/radio/src/translations/fi.h.txt index 1fbea278b..4f2e48f8e 100644 --- a/radio/src/translations/fi.h.txt +++ b/radio/src/translations/fi.h.txt @@ -753,6 +753,7 @@ #define TR_NIGHTLY_NOTSAFE "Version not safe to fly" #define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ") #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" +#define TR_WARN_MULTI_LOWPOWER "Low power mode" #define TR_BATTERY "BATTERY" #define TR_WRONG_PCBREV "Wrong PCB detected" #define TR_EMERGENCY_MODE "EMERGENCY MODE" diff --git a/radio/src/translations/fr.h.txt b/radio/src/translations/fr.h.txt index 76d0e796b..3b65b16d2 100644 --- a/radio/src/translations/fr.h.txt +++ b/radio/src/translations/fr.h.txt @@ -756,6 +756,7 @@ #define TR_NIGHTLY_NOTSAFE "Version de test uniq." #define TR_WRONG_SDCARDVERSION "Version requise: " #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" +#define TR_WARN_MULTI_LOWPOWER "Low power mode" #define TR_BATTERY "BATTERY" #define TR_WRONG_PCBREV "PCB incorrect détecté" #define TR_EMERGENCY_MODE "MODE SECOURS" diff --git a/radio/src/translations/it.h.txt b/radio/src/translations/it.h.txt index 12b11d4bd..89cf9aaa9 100644 --- a/radio/src/translations/it.h.txt +++ b/radio/src/translations/it.h.txt @@ -754,6 +754,7 @@ #define TR_NIGHTLY_NOTSAFE "Version not safe to fly" #define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ") #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" +#define TR_WARN_MULTI_LOWPOWER "Low power mode" #define TR_BATTERY "BATTERY" #define TR_WRONG_PCBREV "Wrong PCB detected" #define TR_EMERGENCY_MODE "EMERGENCY MODE" diff --git a/radio/src/translations/nl.h.txt b/radio/src/translations/nl.h.txt index fa6923557..553740a1f 100644 --- a/radio/src/translations/nl.h.txt +++ b/radio/src/translations/nl.h.txt @@ -742,6 +742,7 @@ TR_GYR_VSRCRAW #define TR_NIGHTLY_NOTSAFE "Version not safe to fly" #define TR_WRONG_SDCARDVERSION TR("Verwachte ver: ","Verwachte versie: ") #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" +#define TR_WARN_MULTI_LOWPOWER "Low power mode" #define TR_BATTERY "BATTERY" #define TR_WRONG_PCBREV "Verkeerde PCB gedetecteerd" #define TR_EMERGENCY_MODE "EMERGENCY MODE" diff --git a/radio/src/translations/pl.h.txt b/radio/src/translations/pl.h.txt index c7972c62c..02990fab7 100644 --- a/radio/src/translations/pl.h.txt +++ b/radio/src/translations/pl.h.txt @@ -754,6 +754,7 @@ #define TR_NIGHTLY_NOTSAFE "Version not safe to fly" #define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ") #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" +#define TR_WARN_MULTI_LOWPOWER "Low power mode" #define TR_BATTERY "BATTERY" #define TR_WRONG_PCBREV "Wrong PCB detected" #define TR_EMERGENCY_MODE "EMERGENCY MODE" diff --git a/radio/src/translations/pt.h.txt b/radio/src/translations/pt.h.txt index f45e2fb86..898b1b530 100644 --- a/radio/src/translations/pt.h.txt +++ b/radio/src/translations/pt.h.txt @@ -744,6 +744,7 @@ #define TR_NIGHTLY_NOTSAFE "Version not safe to fly" #define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ") #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" +#define TR_WARN_MULTI_LOWPOWER "Low power mode" #define TR_BATTERY "BATTERY" #define TR_WRONG_PCBREV "Wrong PCB detected" #define TR_EMERGENCY_MODE "EMERGENCY MODE" diff --git a/radio/src/translations/se.h.txt b/radio/src/translations/se.h.txt index 6d9358d20..d9d9deb81 100644 --- a/radio/src/translations/se.h.txt +++ b/radio/src/translations/se.h.txt @@ -754,6 +754,7 @@ #define TR_SDCARDVERSIONWARN "SD Card Check" #define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ") #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" +#define TR_WARN_MULTI_LOWPOWER "Low power mode" #define TR_BATTERY "BATTERY" #define TR_WRONG_PCBREV "Wrong PCB detected" #define TR_EMERGENCY_MODE "EMERGENCY MODE"