From 9a4be580c2466649a24d9f76baa2adfd32583b0b Mon Sep 17 00:00:00 2001 From: 3djc Date: Thu, 8 Oct 2020 12:01:21 +0200 Subject: [PATCH] Add SBUS module parameters --- radio/src/gui/colorlcd/model_setup.cpp | 16 ++++++++++++++++ radio/src/translations.cpp | 1 + radio/src/translations.h | 1 + radio/src/translations/untranslated.h | 3 +++ 4 files changed, 21 insertions(+) diff --git a/radio/src/gui/colorlcd/model_setup.cpp b/radio/src/gui/colorlcd/model_setup.cpp index 6be3b5ab5..75ddea6f6 100644 --- a/radio/src/gui/colorlcd/model_setup.cpp +++ b/radio/src/gui/colorlcd/model_setup.cpp @@ -893,6 +893,22 @@ class ModuleWindow : public FormGroup { } } + // SBUS refresh rate + if (isModuleSBUS(moduleIdx)) { + new StaticText(this, grid.getLabelSlot(true), STR_REFRESHRATE); + auto edit = new NumberEdit(this, grid.getFieldSlot(2, 0), 60, 400, + GET_DEFAULT((int16_t)g_model.moduleData[moduleIdx].ppm.frameLength*5 + 225), + SET_VALUE(g_model.moduleData[moduleIdx].ppm.frameLength, (newValue - 225)/5), + 0, PREC1); + edit->setSuffix(STR_MS); + new Choice(this, grid.getFieldSlot(2, 1), STR_SBUS_INVERSION_VALUES, 0, 1, GET_SET_DEFAULT(g_model.moduleData[moduleIdx].sbus.noninverted)); +#if defined(RADIO_TX16S) + grid.nextLine(); + new StaticText(this, grid.getFieldSlot(1, 0), STR_WARN_5VOLTS); +#endif + grid.nextLine(); + } + getParent()->moveWindowsTop(top() + 1, adjustHeight()); } }; diff --git a/radio/src/translations.cpp b/radio/src/translations.cpp index e4b996f35..d8a6cc934 100644 --- a/radio/src/translations.cpp +++ b/radio/src/translations.cpp @@ -85,6 +85,7 @@ ISTR(ANTENNA_MODES); ISTR(SPORT_UPDATE_POWER_MODES); ISTR(CRSF_BAUDRATE); ISTR(PPM_POL); +ISTR(SBUS_INVERSION_VALUES); #if defined(PCBSKY9X) && defined(REVX) ISTR(VOUTPUT_TYPE); diff --git a/radio/src/translations.h b/radio/src/translations.h index 933b8cf5b..139d6a33c 100644 --- a/radio/src/translations.h +++ b/radio/src/translations.h @@ -165,6 +165,7 @@ extern const char STR_R9M_PXX2_RF_PROTOCOLS[]; extern const char STR_DSM_PROTOCOLS[]; extern const char STR_CRSF_BAUDRATE[]; extern const char STR_PPM_POL[]; +extern const char STR_SBUS_INVERSION_VALUES[]; extern const char STR_MULTI_PROTOCOLS[]; extern const char STR_MULTI_POWER[]; diff --git a/radio/src/translations/untranslated.h b/radio/src/translations/untranslated.h index c026e6a8d..62fd69af3 100644 --- a/radio/src/translations/untranslated.h +++ b/radio/src/translations/untranslated.h @@ -150,6 +150,9 @@ #define LEN_PPM_POL "\001" #define TR_PPM_POL "+""-" +#define LEN_SBUS_INVERSION_VALUES "\014" +#define TR_SBUS_INVERSION_VALUES "normal\0 ""not inverted" + #define TR_SENSOR_RSSI "RSSI" #define TR_SENSOR_R9PW "R9PW" #define TR_SENSOR_RAS "SWR"