diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 1281f386e37..3c0474a9d7a 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -71,6 +71,7 @@ jobs: - xlites - mt12 - gx12 + - nb4p container: image: ghcr.io/edgetx/edgetx-dev:latest volumes: @@ -116,6 +117,7 @@ jobs: - x9lite;x9lites - xlite;xlites - mt12;gx12 + - nb4p container: image: ghcr.io/edgetx/edgetx-dev:latest volumes: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 2ed72398e7e..9e6f193cfbe 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -35,7 +35,7 @@ jobs: - x9lite;x9lites - xlite;xlites - mt12 - - gx12 + - nb4p container: image: ghcr.io/edgetx/edgetx-dev:latest volumes: diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 0ae0ced3786..1952a1128d8 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -352,7 +352,7 @@ elseif(PCB STREQUAL X10 AND PCBREV STREQUAL T16) set(FLAVOUR t16) elseif(PCB STREQUAL X10 AND PCBREV STREQUAL T18) set(FLAVOUR t18) -elseif(PCB STREQUAL NV14 AND PCBREV STREQUAL EL18) +elseif(PCB STREQUAL PL18 AND PCBREV STREQUAL EL18) set(FLAVOUR el18) elseif(PCB STREQUAL PL18) set(FLAVOUR pl18) diff --git a/fw.json b/fw.json index 8300dc7cf79..9eac988f363 100644 --- a/fw.json +++ b/fw.json @@ -6,6 +6,7 @@ ["Flysky NV14", "nv14-"], ["Flysky PL18", "pl18-"], ["Flysky PL18EV", "pl18ev-"], + ["Flysky NB4+", "nb4p-"], ["FrSky Horus X10", "x10-"], ["FrSky Horus X10 Express", "x10express-"], ["FrSky Horus X12s", "x12s-"], diff --git a/radio/src/audio.h b/radio/src/audio.h index b9b6fd75156..0720557fb81 100644 --- a/radio/src/audio.h +++ b/radio/src/audio.h @@ -109,7 +109,7 @@ enum AudioBufferState #define AUDIO_DATA_MIN 0 #define AUDIO_DATA_MAX 0xffff #define AUDIO_BITS_PER_SAMPLE 16 -#elif defined(PCBX12S) || defined(PCBNV14) +#elif defined(AUDIO_SPI) typedef int16_t audio_data_t; #define AUDIO_DATA_SILENCE 0 #define AUDIO_DATA_MIN INT16_MIN diff --git a/radio/src/boards/generic_stm32/switches.cpp b/radio/src/boards/generic_stm32/switches.cpp index 77468d0c927..b85ae1c03a0 100644 --- a/radio/src/boards/generic_stm32/switches.cpp +++ b/radio/src/boards/generic_stm32/switches.cpp @@ -41,7 +41,7 @@ __weak SwitchHwPos boardSwitchGetPosition(uint8_t cat, uint8_t idx) return stm32_switch_get_position(&_switch_offsets[cat][idx]); } -const char* boardSwitchGetName(uint8_t cat, uint8_t idx) +__weak const char* boardSwitchGetName(uint8_t cat, uint8_t idx) { return _switch_offsets[cat][idx].name; } diff --git a/radio/src/datastructs.h b/radio/src/datastructs.h index ef8fa03ea42..c428359e6f3 100644 --- a/radio/src/datastructs.h +++ b/radio/src/datastructs.h @@ -73,7 +73,7 @@ static inline void check_struct() CHKSIZE(TimerData, 17); CHKSIZE(ModelHeader, 131); CHKSIZE(CustomScreenData, 1892); - #if defined(PCBNV14) + #if defined(PCBNV14) || defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) CHKTYPE(TopBarPersistentData, 704); #else CHKTYPE(TopBarPersistentData, 1048); @@ -104,10 +104,14 @@ static inline void check_struct() CHKSIZE(ModelData, 6770); #elif defined(PCBX7) || defined(PCBXLITE) || defined(PCBX9LITE) CHKSIZE(ModelData, 6329); -#elif defined(PCBNV14) - CHKSIZE(ModelData, 26463); #elif defined(PCBPL18) - CHKSIZE(ModelData, 26845); + #if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) + CHKSIZE(ModelData, 26499); + #else + CHKSIZE(ModelData, 26845); + #endif +#elif defined(PCBNV14) + CHKSIZE(ModelData, 21899); #elif defined(RADIO_T15) CHKSIZE(ModelData, 26834); #elif defined(PCBHORUS) diff --git a/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp b/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp index 641808edf9e..343ea4602af 100644 --- a/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp +++ b/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp @@ -25,7 +25,10 @@ #include "libopenui.h" #include "edgetx.h" -#if defined(PCBPL18) +#if defined(RADIO_NB4P) +static const uint8_t _trimMap[MAX_TRIMS * 2] = {0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15}; +#elif defined(PCBPL18) static const uint8_t _trimMap[MAX_TRIMS * 2] = {8, 9, 10, 11, 12, 13, 14, 15, 2, 3, 4, 5, 0, 1, 6, 7}; #else diff --git a/radio/src/gui/colorlcd/radio/radio_version.cpp b/radio/src/gui/colorlcd/radio/radio_version.cpp index 826ae4d4f5a..23e176d1a3e 100644 --- a/radio/src/gui/colorlcd/radio/radio_version.cpp +++ b/radio/src/gui/colorlcd/radio/radio_version.cpp @@ -340,6 +340,7 @@ RadioVersionPage::RadioVersionPage() : #if defined(PCBNV14) || defined(PCBPL18) extern const char* boardLcdType; +extern const char* boardTouchType; #endif void RadioVersionPage::build(Window* window) @@ -370,6 +371,9 @@ void RadioVersionPage::build(Window* window) version += nl; version += "LCD: "; version += boardLcdType; + version += nl; + version += "Touch: "; + version += boardTouchType; #endif auto txt = new StaticText(window, rect_t{}, version); diff --git a/radio/src/storage/yaml/CMakeLists.txt b/radio/src/storage/yaml/CMakeLists.txt index 07e8f4a6a22..7e1bee46bf2 100644 --- a/radio/src/storage/yaml/CMakeLists.txt +++ b/radio/src/storage/yaml/CMakeLists.txt @@ -25,7 +25,13 @@ if((PCB STREQUAL X10) OR (PCB STREQUAL X12S)) elseif(PCB STREQUAL NV14) set(YAML_GEN_OUTPUT storage/yaml/yaml_datastructs_nv14.cpp) elseif(PCB STREQUAL PL18) - set(YAML_GEN_OUTPUT storage/yaml/yaml_datastructs_pl18.cpp) + if(PCBREV STREQUAL NB4P) + set(YAML_GEN_OUTPUT storage/yaml/yaml_datastructs_nb4p.cpp) + elseif(PCBREV STREQUAL NV14) + set(YAML_GEN_OUTPUT storage/yaml/yaml_datastructs_nv14_family.cpp) + else() + set(YAML_GEN_OUTPUT storage/yaml/yaml_datastructs_pl18.cpp) + endif() elseif(PCB STREQUAL X7) if(PCBREV STREQUAL TPRO) set(YAML_GEN_OUTPUT storage/yaml/yaml_datastructs_tpro.cpp) diff --git a/radio/src/storage/yaml/yaml_datastructs.cpp b/radio/src/storage/yaml/yaml_datastructs.cpp index 52f3b6163a9..4263f50e9c1 100644 --- a/radio/src/storage/yaml/yaml_datastructs.cpp +++ b/radio/src/storage/yaml/yaml_datastructs.cpp @@ -36,10 +36,16 @@ #else #include "yaml_datastructs_x10.cpp" #endif +#elif defined(PCBPL18) + #if defined(RADIO_NB4P) + #include "yaml_datastructs_nb4p.cpp" + #elif defined(RADIO_NV14_FAMILY) + #include "yaml_datastructs_nv14_family.cpp" + #else + #include "yaml_datastructs_pl18.cpp" + #endif #elif defined(PCBNV14) #include "yaml_datastructs_nv14.cpp" -#elif defined(PCBPL18) - #include "yaml_datastructs_pl18.cpp" #elif defined(PCBX7) #if defined(RADIO_TPRO) || defined(RADIO_TPROV2) || defined(RADIO_BUMBLEBEE) #include "yaml_datastructs_tpro.cpp" diff --git a/radio/src/storage/yaml/yaml_datastructs_nb4p.cpp b/radio/src/storage/yaml/yaml_datastructs_nb4p.cpp new file mode 100644 index 00000000000..15197e9d44f --- /dev/null +++ b/radio/src/storage/yaml/yaml_datastructs_nb4p.cpp @@ -0,0 +1,911 @@ +// generated by generate_yaml.py + +// +// Enums first +// + +const struct YamlIdStr enum_BacklightMode[] = { + { e_backlight_mode_off, "backlight_mode_off" }, + { e_backlight_mode_keys, "backlight_mode_keys" }, + { e_backlight_mode_sticks, "backlight_mode_sticks" }, + { e_backlight_mode_all, "backlight_mode_all" }, + { e_backlight_mode_on, "backlight_mode_on" }, + { 0, NULL } +}; +const struct YamlIdStr enum_AntennaModes[] = { + { ANTENNA_MODE_INTERNAL, "MODE_INTERNAL" }, + { ANTENNA_MODE_ASK, "MODE_ASK" }, + { ANTENNA_MODE_PER_MODEL, "MODE_PER_MODEL" }, + { ANTENNA_MODE_EXTERNAL, "MODE_EXTERNAL" }, + { 0, NULL } +}; +const struct YamlIdStr enum_ModuleType[] = { + { MODULE_TYPE_NONE, "TYPE_NONE" }, + { MODULE_TYPE_PPM, "TYPE_PPM" }, + { MODULE_TYPE_XJT_PXX1, "TYPE_XJT_PXX1" }, + { MODULE_TYPE_ISRM_PXX2, "TYPE_ISRM_PXX2" }, + { MODULE_TYPE_DSM2, "TYPE_DSM2" }, + { MODULE_TYPE_CROSSFIRE, "TYPE_CROSSFIRE" }, + { MODULE_TYPE_MULTIMODULE, "TYPE_MULTIMODULE" }, + { MODULE_TYPE_R9M_PXX1, "TYPE_R9M_PXX1" }, + { MODULE_TYPE_R9M_PXX2, "TYPE_R9M_PXX2" }, + { MODULE_TYPE_R9M_LITE_PXX1, "TYPE_R9M_LITE_PXX1" }, + { MODULE_TYPE_R9M_LITE_PXX2, "TYPE_R9M_LITE_PXX2" }, + { MODULE_TYPE_GHOST, "TYPE_GHOST" }, + { MODULE_TYPE_R9M_LITE_PRO_PXX2, "TYPE_R9M_LITE_PRO_PXX2" }, + { MODULE_TYPE_SBUS, "TYPE_SBUS" }, + { MODULE_TYPE_XJT_LITE_PXX2, "TYPE_XJT_LITE_PXX2" }, + { MODULE_TYPE_FLYSKY_AFHDS2A, "TYPE_FLYSKY_AFHDS2A" }, + { MODULE_TYPE_FLYSKY_AFHDS3, "TYPE_FLYSKY_AFHDS3" }, + { MODULE_TYPE_LEMON_DSMP, "TYPE_LEMON_DSMP" }, + { 0, NULL } +}; +const struct YamlIdStr enum_TrainerMultiplex[] = { + { TRAINER_OFF, "OFF" }, + { TRAINER_ADD, "ADD" }, + { TRAINER_REPL, "REPL" }, + { 0, NULL } +}; +const struct YamlIdStr enum_BeeperMode[] = { + { e_mode_quiet, "mode_quiet" }, + { e_mode_alarms, "mode_alarms" }, + { e_mode_nokeys, "mode_nokeys" }, + { e_mode_all, "mode_all" }, + { 0, NULL } +}; +const struct YamlIdStr enum_BluetoothModes[] = { + { BLUETOOTH_OFF, "OFF" }, + { BLUETOOTH_TELEMETRY, "TELEMETRY" }, + { BLUETOOTH_TRAINER, "TRAINER" }, + { 0, NULL } +}; +const struct YamlIdStr enum_Functions[] = { + { FUNC_OVERRIDE_CHANNEL, "OVERRIDE_CHANNEL" }, + { FUNC_TRAINER, "TRAINER" }, + { FUNC_INSTANT_TRIM, "INSTANT_TRIM" }, + { FUNC_RESET, "RESET" }, + { FUNC_SET_TIMER, "SET_TIMER" }, + { FUNC_ADJUST_GVAR, "ADJUST_GVAR" }, + { FUNC_VOLUME, "VOLUME" }, + { FUNC_SET_FAILSAFE, "SET_FAILSAFE" }, + { FUNC_RANGECHECK, "RANGECHECK" }, + { FUNC_BIND, "BIND" }, + { FUNC_PLAY_SOUND, "PLAY_SOUND" }, + { FUNC_PLAY_TRACK, "PLAY_TRACK" }, + { FUNC_PLAY_VALUE, "PLAY_VALUE" }, + { FUNC_PLAY_SCRIPT, "PLAY_SCRIPT" }, + { FUNC_BACKGND_MUSIC, "BACKGND_MUSIC" }, + { FUNC_BACKGND_MUSIC_PAUSE, "BACKGND_MUSIC_PAUSE" }, + { FUNC_VARIO, "VARIO" }, + { FUNC_HAPTIC, "HAPTIC" }, + { FUNC_LOGS, "LOGS" }, + { FUNC_BACKLIGHT, "BACKLIGHT" }, + { FUNC_SCREENSHOT, "SCREENSHOT" }, + { FUNC_RACING_MODE, "RACING_MODE" }, + { FUNC_DISABLE_TOUCH, "DISABLE_TOUCH" }, + { FUNC_SET_SCREEN, "SET_SCREEN" }, + { FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" }, + { FUNC_RGB_LED, "RGB_LED" }, + { FUNC_TEST, "TEST" }, + { 0, NULL } +}; +const struct YamlIdStr enum_TimerModes[] = { + { TMRMODE_OFF, "OFF" }, + { TMRMODE_ON, "ON" }, + { TMRMODE_START, "START" }, + { TMRMODE_THR, "THR" }, + { TMRMODE_THR_REL, "THR_REL" }, + { TMRMODE_THR_START, "THR_START" }, + { 0, NULL } +}; +const struct YamlIdStr enum_MixerMultiplex[] = { + { MLTPX_ADD, "ADD" }, + { MLTPX_MUL, "MUL" }, + { MLTPX_REPL, "REPL" }, + { 0, NULL } +}; +const struct YamlIdStr enum_MixSources[] = { + { MIXSRC_NONE, "NONE" }, + { MIXSRC_MIN, "MIN" }, + { MIXSRC_MAX, "MAX" }, + { MIXSRC_TX_VOLTAGE, "TX_VOLTAGE" }, + { MIXSRC_TX_TIME, "TX_TIME" }, + { MIXSRC_TX_GPS, "TX_GPS" }, + { 0, NULL } +}; +const struct YamlIdStr enum_LogicalSwitchesFunctions[] = { + { LS_FUNC_NONE, "FUNC_NONE" }, + { LS_FUNC_VEQUAL, "FUNC_VEQUAL" }, + { LS_FUNC_VALMOSTEQUAL, "FUNC_VALMOSTEQUAL" }, + { LS_FUNC_VPOS, "FUNC_VPOS" }, + { LS_FUNC_VNEG, "FUNC_VNEG" }, + { LS_FUNC_APOS, "FUNC_APOS" }, + { LS_FUNC_ANEG, "FUNC_ANEG" }, + { LS_FUNC_AND, "FUNC_AND" }, + { LS_FUNC_OR, "FUNC_OR" }, + { LS_FUNC_XOR, "FUNC_XOR" }, + { LS_FUNC_EDGE, "FUNC_EDGE" }, + { LS_FUNC_EQUAL, "FUNC_EQUAL" }, + { LS_FUNC_GREATER, "FUNC_GREATER" }, + { LS_FUNC_LESS, "FUNC_LESS" }, + { LS_FUNC_DIFFEGREATER, "FUNC_DIFFEGREATER" }, + { LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" }, + { LS_FUNC_TIMER, "FUNC_TIMER" }, + { LS_FUNC_STICKY, "FUNC_STICKY" }, + { 0, NULL } +}; +const struct YamlIdStr enum_SwashType[] = { + { SWASH_TYPE_NONE, "TYPE_NONE" }, + { SWASH_TYPE_120, "TYPE_120" }, + { SWASH_TYPE_120X, "TYPE_120X" }, + { SWASH_TYPE_140, "TYPE_140" }, + { SWASH_TYPE_90, "TYPE_90" }, + { 0, NULL } +}; +const struct YamlIdStr enum_SwitchSources[] = { + { SWSRC_NONE, "NONE" }, + { SWSRC_ON, "ON" }, + { SWSRC_ONE, "ONE" }, + { SWSRC_TELEMETRY_STREAMING, "TELEMETRY_STREAMING" }, + { SWSRC_RADIO_ACTIVITY, "RADIO_ACTIVITY" }, + { SWSRC_TRAINER_CONNECTED, "TRAINER_CONNECTED" }, + { SWSRC_OFF, "OFF" }, + { 0, NULL } +}; +const struct YamlIdStr enum_PotsWarnMode[] = { + { POTS_WARN_OFF, "WARN_OFF" }, + { POTS_WARN_MANUAL, "WARN_MANUAL" }, + { POTS_WARN_AUTO, "WARN_AUTO" }, + { 0, NULL } +}; +const struct YamlIdStr enum_ModelOverridableEnable[] = { + { OVERRIDE_GLOBAL, "GLOBAL" }, + { OVERRIDE_OFF, "OFF" }, + { OVERRIDE_ON, "ON" }, + { 0, NULL } +}; +const struct YamlIdStr enum_FailsafeModes[] = { + { FAILSAFE_NOT_SET, "NOT_SET" }, + { FAILSAFE_HOLD, "HOLD" }, + { FAILSAFE_CUSTOM, "CUSTOM" }, + { FAILSAFE_NOPULSES, "NOPULSES" }, + { FAILSAFE_RECEIVER, "RECEIVER" }, + { 0, NULL } +}; +const struct YamlIdStr enum_TelemetrySensorFormula[] = { + { TELEM_FORMULA_ADD, "FORMULA_ADD" }, + { TELEM_FORMULA_AVERAGE, "FORMULA_AVERAGE" }, + { TELEM_FORMULA_MIN, "FORMULA_MIN" }, + { TELEM_FORMULA_MAX, "FORMULA_MAX" }, + { TELEM_FORMULA_MULTIPLY, "FORMULA_MULTIPLY" }, + { TELEM_FORMULA_TOTALIZE, "FORMULA_TOTALIZE" }, + { TELEM_FORMULA_CELL, "FORMULA_CELL" }, + { TELEM_FORMULA_CONSUMPTION, "FORMULA_CONSUMPTION" }, + { TELEM_FORMULA_DIST, "FORMULA_DIST" }, + { 0, NULL } +}; +const struct YamlIdStr enum_TelemetrySensorType[] = { + { TELEM_TYPE_CUSTOM, "TYPE_CUSTOM" }, + { TELEM_TYPE_CALCULATED, "TYPE_CALCULATED" }, + { 0, NULL } +}; +const struct YamlIdStr enum_ZoneOptionValueEnum[] = { + { ZOV_Unsigned, "Unsigned" }, + { ZOV_Signed, "Signed" }, + { ZOV_Bool, "Bool" }, + { ZOV_String, "String" }, + { ZOV_Source, "Source" }, + { ZOV_Color, "Color" }, + { 0, NULL } +}; +const struct YamlIdStr enum_USBJoystickIfMode[] = { + { USBJOYS_JOYSTICK, "JOYSTICK" }, + { USBJOYS_GAMEPAD, "GAMEPAD" }, + { USBJOYS_MULTIAXIS, "MULTIAXIS" }, + { 0, NULL } +}; +const struct YamlIdStr enum_USBJoystickCh[] = { + { USBJOYS_CH_NONE, "CH_NONE" }, + { USBJOYS_CH_BUTTON, "CH_BUTTON" }, + { USBJOYS_CH_AXIS, "CH_AXIS" }, + { USBJOYS_CH_SIM, "CH_SIM" }, + { 0, NULL } +}; + +// +// Structs last +// + +static const struct YamlNode struct_CalibData[] = { + YAML_IDX_CUST("calib",r_calib,w_calib), + YAML_SIGNED( "mid", 16 ), + YAML_SIGNED( "spanNeg", 16 ), + YAML_SIGNED( "spanPos", 16 ), + YAML_END +}; +static const struct YamlNode struct_signed_16[] = { + YAML_IDX, + YAML_SIGNED( "val", 16 ), + YAML_END +}; +static const struct YamlNode struct_TrainerMix[] = { + YAML_IDX, + YAML_UNSIGNED( "srcChn", 6 ), + YAML_ENUM("mode", 2, enum_TrainerMultiplex), + YAML_SIGNED( "studWeight", 8 ), + YAML_END +}; +static const struct YamlNode struct_TrainerData[] = { + YAML_ARRAY("calib", 16, 4, struct_signed_16, NULL), + YAML_ARRAY("mix", 16, 4, struct_TrainerMix, NULL), + YAML_END +}; +static const struct YamlNode struct_anonymous_1[] = { + YAML_STRING("name", 8), + YAML_END +}; +static const struct YamlNode struct_anonymous_2[] = { + YAML_SIGNED( "val", 16 ), + YAML_UNSIGNED( "mode", 8 ), + YAML_UNSIGNED( "param", 8 ), + YAML_SIGNED( "val2", 32 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_3[] = { + YAML_SIGNED( "val1", 32 ), + YAML_SIGNED( "val2", 32 ), + YAML_END +}; +static const struct YamlNode union_anonymous_0_elmts[] = { + YAML_STRUCT("play", 64, struct_anonymous_1, NULL), + YAML_STRUCT("all", 64, struct_anonymous_2, NULL), + YAML_STRUCT("clear", 64, struct_anonymous_3, NULL), + YAML_END +}; +static const struct YamlNode struct_CustomFunctionData[] = { + YAML_IDX, + YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), + YAML_ENUM("func", 6, enum_Functions), + YAML_CUSTOM("def",r_customFn,w_customFn), + YAML_PADDING( 64 ), + YAML_PADDING( 1 ), + YAML_PADDING( 7 ), + YAML_END +}; +static const struct YamlNode struct_RadioData[] = { + YAML_UNSIGNED( "manuallyEdited", 1 ), + YAML_SIGNED( "timezoneMinutes", 3 ), + YAML_UNSIGNED( "ppmunit", 2 ), + YAML_PADDING( 2 ), + YAML_CUSTOM("semver",nullptr,w_semver), + YAML_CUSTOM("board",nullptr,w_board), + YAML_ARRAY("calib", 48, 20, struct_CalibData, NULL), + YAML_PADDING( 16 ), + YAML_SIGNED( "currModel", 8 ), + YAML_UNSIGNED( "contrast", 8 ), + YAML_UNSIGNED( "vBatWarn", 8 ), + YAML_SIGNED( "txVoltageCalibration", 8 ), + YAML_ENUM("backlightMode", 3, enum_BacklightMode), + YAML_ENUM("antennaMode", 2, enum_AntennaModes), + YAML_UNSIGNED( "disableRtcWarning", 1 ), + YAML_UNSIGNED( "keysBacklight", 1 ), + YAML_UNSIGNED( "dontPlayHello", 1 ), + YAML_ENUM("internalModule", 8, enum_ModuleType), + YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), + YAML_UNSIGNED( "view", 8 ), + YAML_PADDING( 2 ), + YAML_UNSIGNED( "fai", 1 ), + YAML_SIGNED_CUST( "beepMode", 2, r_beeperMode, w_beeperMode ), + YAML_UNSIGNED( "alarmsFlash", 1 ), + YAML_UNSIGNED( "disableMemoryWarning", 1 ), + YAML_UNSIGNED( "disableAlarmWarning", 1 ), + YAML_UNSIGNED( "stickMode", 2 ), + YAML_SIGNED( "timezone", 5 ), + YAML_UNSIGNED( "adjustRTC", 1 ), + YAML_UNSIGNED( "inactivityTimer", 8 ), + YAML_CUSTOM("telemetryBaudrate",r_telemetryBaudrate,nullptr), + YAML_UNSIGNED( "internalModuleBaudrate", 3 ), + YAML_SIGNED( "splashMode", 3 ), + YAML_SIGNED_CUST( "hapticMode", 2, r_beeperMode, w_beeperMode ), + YAML_SIGNED( "switchesDelay", 8 ), + YAML_UNSIGNED( "lightAutoOff", 8 ), + YAML_UNSIGNED( "templateSetup", 8 ), + YAML_SIGNED( "PPM_Multiplier", 8 ), + YAML_SIGNED_CUST( "hapticLength", 8, r_5pos, w_5pos ), + YAML_SIGNED_CUST( "beepLength", 3, r_5pos, w_5pos ), + YAML_SIGNED_CUST( "hapticStrength", 3, r_5pos, w_5pos ), + YAML_UNSIGNED( "gpsFormat", 1 ), + YAML_UNSIGNED( "audioMuteEnable", 1 ), + YAML_UNSIGNED_CUST( "speakerPitch", 8, r_spPitch, w_spPitch ), + YAML_SIGNED_CUST( "speakerVolume", 8, r_vol, w_vol ), + YAML_SIGNED_CUST( "vBatMin", 8, r_vbat_min, w_vbat_min ), + YAML_SIGNED_CUST( "vBatMax", 8, r_vbat_max, w_vbat_max ), + YAML_UNSIGNED( "backlightBright", 8 ), + YAML_UNSIGNED( "globalTimer", 32 ), + YAML_UNSIGNED( "bluetoothBaudrate", 4 ), + YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes), + YAML_UNSIGNED( "countryCode", 2 ), + YAML_SIGNED( "pwrOnSpeed", 3 ), + YAML_SIGNED( "pwrOffSpeed", 3 ), + YAML_CUSTOM("jitterFilter",r_jitterFilter,nullptr), + YAML_UNSIGNED( "noJitterFilter", 1 ), + YAML_UNSIGNED( "imperial", 1 ), + YAML_UNSIGNED( "disableRssiPoweroffAlarm", 1 ), + YAML_UNSIGNED( "USBMode", 2 ), + YAML_UNSIGNED( "jackMode", 2 ), + YAML_PADDING( 1 ), + YAML_STRING("ttsLanguage", 2), + YAML_SIGNED_CUST( "beepVolume", 4, r_5pos, w_5pos ), + YAML_SIGNED_CUST( "wavVolume", 4, r_5pos, w_5pos ), + YAML_SIGNED_CUST( "varioVolume", 4, r_5pos, w_5pos ), + YAML_SIGNED_CUST( "backgroundVolume", 4, r_5pos, w_5pos ), + YAML_SIGNED_CUST( "varioPitch", 8, r_vPitch, w_vPitch ), + YAML_SIGNED_CUST( "varioRange", 8, r_vPitch, w_vPitch ), + YAML_SIGNED( "varioRepeat", 8 ), + YAML_ARRAY("customFn", 88, 64, struct_CustomFunctionData, cfn_is_active), + YAML_CUSTOM("auxSerialMode",r_serialMode,nullptr), + YAML_CUSTOM("aux2SerialMode",r_serialMode,nullptr), + YAML_ARRAY("serialPort", 8, 4, struct_serialConfig, nullptr), + YAML_ARRAY("sticksConfig", 0, MAX_STICKS, struct_stickConfig, stick_name_valid), + YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr), + YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr), + YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr), + YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid), + YAML_STRING("currModelFilename", 17), + YAML_UNSIGNED( "modelQuickSelect", 1 ), + YAML_UNSIGNED( "blOffBright", 7 ), + YAML_STRING("bluetoothName", 10), + YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 3 ), + YAML_SIGNED( "uartSampleMode", 2 ), + YAML_UNSIGNED( "stickDeadZone", 3 ), + YAML_STRING("selectedTheme", 26), + YAML_UNSIGNED( "labelSingleSelect", 1 ), + YAML_UNSIGNED( "labelMultiMode", 1 ), + YAML_UNSIGNED( "favMultiMode", 1 ), + YAML_UNSIGNED( "modelSelectLayout", 2 ), + YAML_UNSIGNED( "radioThemesDisabled", 1 ), + YAML_UNSIGNED( "radioGFDisabled", 1 ), + YAML_UNSIGNED( "radioTrainerDisabled", 1 ), + YAML_UNSIGNED( "modelHeliDisabled", 1 ), + YAML_UNSIGNED( "modelFMDisabled", 1 ), + YAML_UNSIGNED( "modelCurvesDisabled", 1 ), + YAML_UNSIGNED( "modelGVDisabled", 1 ), + YAML_UNSIGNED( "modelLSDisabled", 1 ), + YAML_UNSIGNED( "modelSFDisabled", 1 ), + YAML_UNSIGNED( "modelCustomScriptsDisabled", 1 ), + YAML_UNSIGNED( "modelTelemetryDisabled", 1 ), + YAML_UNSIGNED( "disableTrainerPoweroffAlarm", 1 ), + YAML_UNSIGNED( "disablePwrOnOffHaptic", 1 ), + YAML_PADDING( 6 ), + YAML_UNSIGNED( "pwrOffIfInactive", 8 ), + YAML_END +}; +static const struct YamlNode struct_unsigned_8[] = { + YAML_IDX, + YAML_UNSIGNED( "val", 8 ), + YAML_END +}; +static const struct YamlNode struct_ModelHeader[] = { + YAML_STRING("name", 15), + YAML_ARRAY("modelId", 8, 2, struct_unsigned_8, NULL), + YAML_STRING("bitmap", 14), + YAML_STRING("labels", 100), + YAML_END +}; +static const struct YamlNode struct_TimerData[] = { + YAML_IDX, + YAML_UNSIGNED( "start", 22 ), + YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), + YAML_SIGNED( "value", 22 ), + YAML_ENUM("mode", 3, enum_TimerModes), + YAML_UNSIGNED( "countdownBeep", 2 ), + YAML_UNSIGNED( "minuteBeep", 1 ), + YAML_UNSIGNED( "persistent", 2 ), + YAML_SIGNED( "countdownStart", 2 ), + YAML_UNSIGNED( "showElapsed", 1 ), + YAML_UNSIGNED( "extraHaptic", 1 ), + YAML_PADDING( 6 ), + YAML_STRING("name", 8), + YAML_END +}; +static const struct YamlNode struct_CurveRef[] = { + YAML_UNSIGNED( "type", 5 ), + YAML_SIGNED_CUST( "value", 11, r_sourceNumVal, w_sourceNumVal ), + YAML_END +}; +static const struct YamlNode struct_MixData[] = { + YAML_UNSIGNED( "destCh", 5 ), + YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ), + YAML_UNSIGNED( "carryTrim", 1 ), + YAML_UNSIGNED( "mixWarn", 2 ), + YAML_ENUM("mltpx", 2, enum_MixerMultiplex), + YAML_UNSIGNED( "delayPrec", 1 ), + YAML_UNSIGNED( "speedPrec", 1 ), + YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ), + YAML_PADDING( 1 ), + YAML_UNSIGNED_CUST( "weight", 11, r_sourceNumVal, w_sourceNumVal ), + YAML_UNSIGNED_CUST( "offset", 11, r_sourceNumVal, w_sourceNumVal ), + YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), + YAML_STRUCT("curve", 16, struct_CurveRef, NULL), + YAML_UNSIGNED( "delayUp", 8 ), + YAML_UNSIGNED( "delayDown", 8 ), + YAML_UNSIGNED( "speedUp", 8 ), + YAML_UNSIGNED( "speedDown", 8 ), + YAML_STRING("name", 6), + YAML_END +}; +static const struct YamlNode struct_LimitData[] = { + YAML_IDX, + YAML_SIGNED_CUST( "min", 11, in_read_weight, in_write_weight ), + YAML_SIGNED_CUST( "max", 11, in_read_weight, in_write_weight ), + YAML_SIGNED( "ppmCenter", 10 ), + YAML_SIGNED_CUST( "offset", 11, in_read_weight, in_write_weight ), + YAML_UNSIGNED( "symetrical", 1 ), + YAML_UNSIGNED( "revert", 1 ), + YAML_PADDING( 3 ), + YAML_SIGNED( "curve", 8 ), + YAML_STRING("name", 6), + YAML_END +}; +static const struct YamlNode struct_ExpoData[] = { + YAML_UNSIGNED( "mode", 2 ), + YAML_UNSIGNED( "scale", 14 ), + YAML_CUSTOM("carryTrim",r_carryTrim,nullptr), + YAML_SIGNED( "trimSource", 6 ), + YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ), + YAML_UNSIGNED_CUST( "weight", 11, r_sourceNumVal, w_sourceNumVal ), + YAML_UNSIGNED_CUST( "offset", 11, r_sourceNumVal, w_sourceNumVal ), + YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), + YAML_STRUCT("curve", 16, struct_CurveRef, NULL), + YAML_UNSIGNED( "chn", 5 ), + YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ), + YAML_PADDING( 2 ), + YAML_STRING("name", 6), + YAML_END +}; +static const struct YamlNode struct_CurveHeader[] = { + YAML_IDX, + YAML_UNSIGNED( "type", 1 ), + YAML_UNSIGNED( "smooth", 1 ), + YAML_SIGNED( "points", 6 ), + YAML_STRING("name", 3), + YAML_END +}; +static const struct YamlNode struct_signed_8[] = { + YAML_IDX, + YAML_SIGNED( "val", 8 ), + YAML_END +}; +static const struct YamlNode struct_LogicalSwitchData[] = { + YAML_IDX, + YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions), + YAML_CUSTOM("def",r_logicSw,w_logicSw), + YAML_PADDING( 10 ), + YAML_PADDING( 10 ), + YAML_SIGNED_CUST( "andsw", 10, r_swtchSrc, w_swtchSrc ), + YAML_UNSIGNED( "lsPersist", 1 ), + YAML_UNSIGNED( "lsState", 1 ), + YAML_PADDING( 16 ), + YAML_UNSIGNED( "delay", 8 ), + YAML_UNSIGNED( "duration", 8 ), + YAML_END +}; +static const struct YamlNode struct_SwashRingData[] = { + YAML_ENUM("type", 8, enum_SwashType), + YAML_UNSIGNED( "value", 8 ), + YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ), + YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ), + YAML_UNSIGNED_CUST( "elevatorSource", 8, r_mixSrcRaw, w_mixSrcRaw ), + YAML_SIGNED( "collectiveWeight", 8 ), + YAML_SIGNED( "aileronWeight", 8 ), + YAML_SIGNED( "elevatorWeight", 8 ), + YAML_END +}; +static const struct YamlNode struct_trim_t[] = { + YAML_IDX, + YAML_SIGNED( "value", 11 ), + YAML_UNSIGNED( "mode", 5 ), + YAML_END +}; +static const struct YamlNode struct_FlightModeData[] = { + YAML_IDX, + YAML_ARRAY("trim", 16, 8, struct_trim_t, NULL), + YAML_STRING("name", 10), + YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), + YAML_PADDING( 6 ), + YAML_UNSIGNED( "fadeIn", 8 ), + YAML_UNSIGNED( "fadeOut", 8 ), + YAML_ARRAY("gvars", 16, 9, struct_signed_16, gvar_is_active), + YAML_END +}; +static const struct YamlNode struct_GVarData[] = { + YAML_IDX, + YAML_STRING("name", 3), + YAML_UNSIGNED( "min", 12 ), + YAML_UNSIGNED( "max", 12 ), + YAML_UNSIGNED( "popup", 1 ), + YAML_UNSIGNED( "prec", 1 ), + YAML_UNSIGNED( "unit", 2 ), + YAML_PADDING( 4 ), + YAML_END +}; +static const struct YamlNode struct_VarioData[] = { + YAML_UNSIGNED_CUST( "source", 7, r_tele_sensor, w_tele_sensor ), + YAML_UNSIGNED( "centerSilent", 1 ), + YAML_SIGNED( "centerMax", 8 ), + YAML_SIGNED( "centerMin", 8 ), + YAML_SIGNED( "min", 8 ), + YAML_SIGNED( "max", 8 ), + YAML_END +}; +static const struct YamlNode struct_RssiAlarmData[] = { + YAML_CUSTOM("disabled",r_rssiDisabled,nullptr), + YAML_CUSTOM("warning",r_rssiWarning,nullptr), + YAML_CUSTOM("critical",r_rssiCritical,nullptr), + YAML_END +}; +static const struct YamlNode struct_RFAlarmData[] = { + YAML_SIGNED( "warning", 8 ), + YAML_SIGNED( "critical", 8 ), + YAML_END +}; +static const struct YamlNode struct_PpmModule[] = { + YAML_SIGNED( "delay", 6 ), + YAML_UNSIGNED( "pulsePol", 1 ), + YAML_UNSIGNED( "outputType", 1 ), + YAML_SIGNED( "frameLength", 8 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_5[] = { + YAML_PADDING( 8 ), + YAML_UNSIGNED( "disableTelemetry", 1 ), + YAML_UNSIGNED( "disableMapping", 1 ), + YAML_UNSIGNED( "autoBindMode", 1 ), + YAML_UNSIGNED( "lowPowerMode", 1 ), + YAML_UNSIGNED( "receiverTelemetryOff", 1 ), + YAML_UNSIGNED( "receiverHigherChannels", 1 ), + YAML_PADDING( 2 ), + YAML_SIGNED( "optionValue", 8 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_6[] = { + YAML_UNSIGNED( "power", 2 ), + YAML_PADDING( 2 ), + YAML_UNSIGNED( "receiverTelemetryOff", 1 ), + YAML_UNSIGNED( "receiverHigherChannels", 1 ), + YAML_SIGNED( "antennaMode", 2 ), + YAML_PADDING( 8 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_7[] = { + YAML_PADDING( 6 ), + YAML_UNSIGNED( "noninverted", 1 ), + YAML_PADDING( 1 ), + YAML_SIGNED( "refreshRate", 8 ), + YAML_END +}; +static const struct YamlNode struct_string_64[] = { + YAML_IDX, + YAML_STRING("val", 8), + YAML_END +}; +static const struct YamlNode struct_anonymous_8[] = { + YAML_UNSIGNED( "receivers", 7 ), + YAML_UNSIGNED( "racingMode", 1 ), + YAML_ARRAY("receiverName", 64, 3, struct_string_64, NULL), + YAML_END +}; +static const struct YamlNode struct_anonymous_9[] = { + YAML_ARRAY("rx_id", 8, 4, struct_unsigned_8, NULL), + YAML_UNSIGNED( "mode", 3 ), + YAML_UNSIGNED( "rfPower", 1 ), + YAML_UNSIGNED( "reserved", 4 ), + YAML_ARRAY("rx_freq", 8, 2, struct_unsigned_8, NULL), + YAML_END +}; +static const struct YamlNode struct_anonymous_10[] = { + YAML_UNSIGNED( "emi", 2 ), + YAML_UNSIGNED( "telemetry", 1 ), + YAML_UNSIGNED( "phyMode", 3 ), + YAML_UNSIGNED( "reserved", 2 ), + YAML_UNSIGNED( "rfPower", 8 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_11[] = { + YAML_UNSIGNED( "raw12bits", 1 ), + YAML_UNSIGNED( "telemetryBaudrate", 3 ), + YAML_PADDING( 4 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_12[] = { + YAML_UNSIGNED( "telemetryBaudrate", 3 ), + YAML_UNSIGNED( "crsfArmingMode", 1 ), + YAML_PADDING( 4 ), + YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ), + YAML_SIGNED( "spare3", 6 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_13[] = { + YAML_UNSIGNED( "flags", 8 ), + YAML_END +}; +static const struct YamlNode union_anonymous_4_elmts[] = { + YAML_ARRAY("raw", 8, 25, struct_unsigned_8, NULL), + YAML_STRUCT("ppm", 16, struct_PpmModule, NULL), + YAML_STRUCT("multi", 24, struct_anonymous_5, NULL), + YAML_STRUCT("pxx", 16, struct_anonymous_6, NULL), + YAML_STRUCT("sbus", 16, struct_anonymous_7, NULL), + YAML_STRUCT("pxx2", 200, struct_anonymous_8, NULL), + YAML_STRUCT("flysky", 56, struct_anonymous_9, NULL), + YAML_STRUCT("afhds3", 16, struct_anonymous_10, NULL), + YAML_STRUCT("ghost", 8, struct_anonymous_11, NULL), + YAML_STRUCT("crsf", 24, struct_anonymous_12, NULL), + YAML_STRUCT("dsmp", 8, struct_anonymous_13, NULL), + YAML_END +}; +static const struct YamlNode struct_ModuleData[] = { + YAML_IDX, + YAML_UNSIGNED_CUST( "type", 8, r_moduleType, w_moduleType ), + YAML_CUSTOM("subType",r_modSubtype,w_modSubtype), + YAML_UNSIGNED( "channelsStart", 8 ), + YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ), + YAML_ENUM("failsafeMode", 4, enum_FailsafeModes), + YAML_PADDING( 4 ), + YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type), + YAML_END +}; +static const struct YamlNode struct_TrainerModuleData[] = { + YAML_UNSIGNED_CUST( "mode", 8, r_trainerMode, w_trainerMode ), + YAML_UNSIGNED( "channelsStart", 8 ), + YAML_SIGNED( "channelsCount", 8 ), + YAML_SIGNED( "frameLength", 8 ), + YAML_SIGNED( "delay", 6 ), + YAML_UNSIGNED( "pulsePol", 1 ), + YAML_PADDING( 1 ), + YAML_END +}; +static const struct YamlNode union_ScriptDataInput_elmts[] = { + YAML_SIGNED( "value", 16 ), + YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ), + YAML_END +}; +static const struct YamlNode union_ScriptDataInput[] = { + YAML_IDX, + YAML_UNION("u", 16, union_ScriptDataInput_elmts, select_script_input), + YAML_END +}; +static const struct YamlNode struct_ScriptData[] = { + YAML_IDX, + YAML_STRING("file", 6), + YAML_STRING("name", 6), + YAML_ARRAY("inputs", 16, 6, union_ScriptDataInput, NULL), + YAML_END +}; +static const struct YamlNode struct_string_32[] = { + YAML_IDX, + YAML_STRING("val", 4), + YAML_END +}; +static const struct YamlNode union_anonymous_14_elmts[] = { + YAML_UNSIGNED( "id", 16 ), + YAML_UNSIGNED( "persistentValue", 16 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_16[] = { + YAML_UNSIGNED( "physID", 5 ), + YAML_UNSIGNED( "rxIndex", 3 ), + YAML_END +}; +static const struct YamlNode union_anonymous_15_elmts[] = { + YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL), + YAML_UNSIGNED( "instance", 8 ), + YAML_ENUM("formula", 8, enum_TelemetrySensorFormula), + YAML_END +}; +static const struct YamlNode struct_anonymous_18[] = { + YAML_UNSIGNED( "ratio", 16 ), + YAML_SIGNED( "offset", 16 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_19[] = { + YAML_UNSIGNED( "source", 8 ), + YAML_UNSIGNED( "index", 8 ), + YAML_PADDING( 16 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_20[] = { + YAML_ARRAY("sources", 8, 4, struct_signed_8, NULL), + YAML_END +}; +static const struct YamlNode struct_anonymous_21[] = { + YAML_UNSIGNED( "source", 8 ), + YAML_PADDING( 24 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_22[] = { + YAML_UNSIGNED( "gps", 8 ), + YAML_UNSIGNED( "alt", 8 ), + YAML_PADDING( 16 ), + YAML_END +}; +static const struct YamlNode union_anonymous_17_elmts[] = { + YAML_STRUCT("custom", 32, struct_anonymous_18, NULL), + YAML_STRUCT("cell", 32, struct_anonymous_19, NULL), + YAML_STRUCT("calc", 32, struct_anonymous_20, NULL), + YAML_STRUCT("consumption", 32, struct_anonymous_21, NULL), + YAML_STRUCT("dist", 32, struct_anonymous_22, NULL), + YAML_UNSIGNED( "param", 32 ), + YAML_END +}; +static const struct YamlNode struct_TelemetrySensor[] = { + YAML_IDX, + YAML_UNION("id1", 16, union_anonymous_14_elmts, select_id1), + YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2), + YAML_STRING("label", 4), + YAML_UNSIGNED( "subId", 8 ), + YAML_ENUM("type", 1, enum_TelemetrySensorType), + YAML_PADDING( 1 ), + YAML_UNSIGNED( "unit", 6 ), + YAML_UNSIGNED( "prec", 2 ), + YAML_UNSIGNED( "autoOffset", 1 ), + YAML_UNSIGNED( "filter", 1 ), + YAML_UNSIGNED( "logs", 1 ), + YAML_UNSIGNED( "persistent", 1 ), + YAML_UNSIGNED( "onlyPositive", 1 ), + YAML_PADDING( 1 ), + YAML_UNION("cfg", 32, union_anonymous_17_elmts, select_sensor_cfg), + YAML_END +}; +static const struct YamlNode union_ZoneOptionValue_elmts[] = { + YAML_UNSIGNED( "unsignedValue", 32 ), + YAML_SIGNED( "signedValue", 32 ), + YAML_UNSIGNED( "boolValue", 32 ), + YAML_STRING("stringValue", 12), + YAML_CUSTOM("source",r_zov_source,w_zov_source), + YAML_CUSTOM("color",r_zov_color,w_zov_color), + YAML_END +}; +static const struct YamlNode struct_ZoneOptionValueTyped[] = { + YAML_IDX, + YAML_ENUM("type", 32, enum_ZoneOptionValueEnum), + YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov), + YAML_END +}; +static const struct YamlNode struct_WidgetPersistentData[] = { + YAML_ARRAY("options", 128, 10, struct_ZoneOptionValueTyped, NULL), + YAML_END +}; +static const struct YamlNode struct_ZonePersistentData[] = { + YAML_IDX, + YAML_STRING("widgetName", 12), + YAML_STRUCT("widgetData", 1280, struct_WidgetPersistentData, NULL), + YAML_END +}; +static const struct YamlNode struct_LayoutPersistentData[] = { + YAML_ARRAY("zones", 1376, 10, struct_ZonePersistentData, NULL), + YAML_ARRAY("options", 128, 10, struct_ZoneOptionValueTyped, NULL), + YAML_END +}; +static const struct YamlNode struct_CustomScreenData[] = { + YAML_IDX, + YAML_STRING("LayoutId", 12), + YAML_STRUCT("layoutData", 15040, struct_LayoutPersistentData, NULL), + YAML_END +}; +static const struct YamlNode struct_TopBarPersistentData[] = { + YAML_ARRAY("zones", 1376, 4, struct_ZonePersistentData, NULL), + YAML_ARRAY("options", 128, 1, struct_ZoneOptionValueTyped, NULL), + YAML_END +}; +static const struct YamlNode struct_USBJoystickChData[] = { + YAML_IDX, + YAML_ENUM("mode", 3, enum_USBJoystickCh), + YAML_UNSIGNED( "inversion", 1 ), + YAML_UNSIGNED( "param", 4 ), + YAML_UNSIGNED( "btn_num", 5 ), + YAML_UNSIGNED( "switch_npos", 3 ), + YAML_END +}; +static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), + YAML_STRUCT("header", 1048, struct_ModelHeader, NULL), + YAML_ARRAY("timers", 136, 3, struct_TimerData, NULL), + YAML_UNSIGNED( "telemetryProtocol", 3 ), + YAML_UNSIGNED( "thrTrim", 1 ), + YAML_UNSIGNED( "noGlobalFunctions", 1 ), + YAML_UNSIGNED( "displayTrims", 2 ), + YAML_UNSIGNED( "ignoreSensorIds", 1 ), + YAML_SIGNED( "trimInc", 3 ), + YAML_UNSIGNED( "disableThrottleWarning", 1 ), + YAML_UNSIGNED( "displayChecklist", 1 ), + YAML_UNSIGNED( "extendedLimits", 1 ), + YAML_UNSIGNED( "extendedTrims", 1 ), + YAML_UNSIGNED( "throttleReversed", 1 ), + YAML_UNSIGNED( "enableCustomThrottleWarning", 1 ), + YAML_UNSIGNED( "disableTelemetryWarning", 1 ), + YAML_UNSIGNED( "showInstanceIds", 1 ), + YAML_UNSIGNED( "checklistInteractive", 1 ), + YAML_PADDING( 4 ), + YAML_SIGNED( "customThrottleWarningPosition", 8 ), + YAML_UNSIGNED( "beepANACenter", 16 ), + YAML_ARRAY("mixData", 160, 64, struct_MixData, NULL), + YAML_ARRAY("limitData", 104, 32, struct_LimitData, NULL), + YAML_ARRAY("expoData", 144, 64, struct_ExpoData, NULL), + YAML_ARRAY("curves", 32, 32, struct_CurveHeader, NULL), + YAML_ARRAY("points", 8, 512, struct_signed_8, NULL), + YAML_ARRAY("logicalSw", 72, 64, struct_LogicalSwitchData, NULL), + YAML_ARRAY("customFn", 88, 64, struct_CustomFunctionData, cfn_is_active), + YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active), + YAML_ARRAY("flightModeData", 384, 9, struct_FlightModeData, fmd_is_active), + YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ), + YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr), + YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr), + YAML_PADDING(1), + YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL), + YAML_STRUCT("varioData", 40, struct_VarioData, NULL), + YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ), + YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL), + YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL), + YAML_UNSIGNED( "thrTrimSw", 3 ), + YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode), + YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable), + YAML_PADDING( 1 ), + YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL), + YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL), + YAML_STRUCT("trainerData", 40, struct_TrainerModuleData, NULL), + YAML_ARRAY("scriptsData", 192, 9, struct_ScriptData, NULL), + YAML_ARRAY("inputNames", 32, 32, struct_string_32, NULL), + YAML_UNSIGNED( "potsWarnEnabled", 16 ), + YAML_ARRAY("potsWarnPosition", 8, 16, struct_signed_8, NULL), + YAML_ARRAY("telemetrySensors", 112, 60, struct_TelemetrySensor, NULL), + YAML_ARRAY("screenData", 15136, 10, struct_CustomScreenData, NULL), + YAML_STRUCT("topbarData", 5632, struct_TopBarPersistentData, NULL), + YAML_ARRAY("topbarWidgetWidth", 8, 4, struct_unsigned_8, NULL), + YAML_UNSIGNED( "view", 8 ), + YAML_STRING("modelRegistrationID", 8), + YAML_UNSIGNED( "usbJoystickExtMode", 1 ), + YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode), + YAML_UNSIGNED( "usbJoystickCircularCut", 4 ), + YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL), + YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable), + YAML_END +}; +static const struct YamlNode struct_PartialModel[] = { + YAML_STRUCT("header", 1048, struct_ModelHeader, NULL), + YAML_ARRAY("timers", 136, 3, struct_TimerData, NULL), + YAML_END +}; + +#define MAX_RADIODATA_MODELDATA_PARTIALMODEL_STR_LEN 29 + +static const struct YamlNode __RadioData_root_node = YAML_ROOT( struct_RadioData ); + +const YamlNode* get_radiodata_nodes() +{ + return &__RadioData_root_node; +} +static const struct YamlNode __ModelData_root_node = YAML_ROOT( struct_ModelData ); + +const YamlNode* get_modeldata_nodes() +{ + return &__ModelData_root_node; +} +static const struct YamlNode __PartialModel_root_node = YAML_ROOT( struct_PartialModel ); + +const YamlNode* get_partialmodel_nodes() +{ + return &__PartialModel_root_node; +} + diff --git a/radio/src/storage/yaml/yaml_datastructs_nv14_family.cpp b/radio/src/storage/yaml/yaml_datastructs_nv14_family.cpp new file mode 100644 index 00000000000..696cf2af90f --- /dev/null +++ b/radio/src/storage/yaml/yaml_datastructs_nv14_family.cpp @@ -0,0 +1,918 @@ +// generated by generate_yaml.py + +// +// Enums first +// + +const struct YamlIdStr enum_HatsMode[] = { + { HATSMODE_TRIMS_ONLY, "TRIMS_ONLY" }, + { HATSMODE_KEYS_ONLY, "KEYS_ONLY" }, + { HATSMODE_SWITCHABLE, "SWITCHABLE" }, + { HATSMODE_GLOBAL, "GLOBAL" }, + { 0, NULL } +}; +const struct YamlIdStr enum_BacklightMode[] = { + { e_backlight_mode_off, "backlight_mode_off" }, + { e_backlight_mode_keys, "backlight_mode_keys" }, + { e_backlight_mode_sticks, "backlight_mode_sticks" }, + { e_backlight_mode_all, "backlight_mode_all" }, + { e_backlight_mode_on, "backlight_mode_on" }, + { 0, NULL } +}; +const struct YamlIdStr enum_AntennaModes[] = { + { ANTENNA_MODE_INTERNAL, "MODE_INTERNAL" }, + { ANTENNA_MODE_ASK, "MODE_ASK" }, + { ANTENNA_MODE_PER_MODEL, "MODE_PER_MODEL" }, + { ANTENNA_MODE_EXTERNAL, "MODE_EXTERNAL" }, + { 0, NULL } +}; +const struct YamlIdStr enum_ModuleType[] = { + { MODULE_TYPE_NONE, "TYPE_NONE" }, + { MODULE_TYPE_PPM, "TYPE_PPM" }, + { MODULE_TYPE_XJT_PXX1, "TYPE_XJT_PXX1" }, + { MODULE_TYPE_ISRM_PXX2, "TYPE_ISRM_PXX2" }, + { MODULE_TYPE_DSM2, "TYPE_DSM2" }, + { MODULE_TYPE_CROSSFIRE, "TYPE_CROSSFIRE" }, + { MODULE_TYPE_MULTIMODULE, "TYPE_MULTIMODULE" }, + { MODULE_TYPE_R9M_PXX1, "TYPE_R9M_PXX1" }, + { MODULE_TYPE_R9M_PXX2, "TYPE_R9M_PXX2" }, + { MODULE_TYPE_R9M_LITE_PXX1, "TYPE_R9M_LITE_PXX1" }, + { MODULE_TYPE_R9M_LITE_PXX2, "TYPE_R9M_LITE_PXX2" }, + { MODULE_TYPE_GHOST, "TYPE_GHOST" }, + { MODULE_TYPE_R9M_LITE_PRO_PXX2, "TYPE_R9M_LITE_PRO_PXX2" }, + { MODULE_TYPE_SBUS, "TYPE_SBUS" }, + { MODULE_TYPE_XJT_LITE_PXX2, "TYPE_XJT_LITE_PXX2" }, + { MODULE_TYPE_FLYSKY_AFHDS2A, "TYPE_FLYSKY_AFHDS2A" }, + { MODULE_TYPE_FLYSKY_AFHDS3, "TYPE_FLYSKY_AFHDS3" }, + { MODULE_TYPE_LEMON_DSMP, "TYPE_LEMON_DSMP" }, + { 0, NULL } +}; +const struct YamlIdStr enum_TrainerMultiplex[] = { + { TRAINER_OFF, "OFF" }, + { TRAINER_ADD, "ADD" }, + { TRAINER_REPL, "REPL" }, + { 0, NULL } +}; +const struct YamlIdStr enum_BeeperMode[] = { + { e_mode_quiet, "mode_quiet" }, + { e_mode_alarms, "mode_alarms" }, + { e_mode_nokeys, "mode_nokeys" }, + { e_mode_all, "mode_all" }, + { 0, NULL } +}; +const struct YamlIdStr enum_BluetoothModes[] = { + { BLUETOOTH_OFF, "OFF" }, + { BLUETOOTH_TELEMETRY, "TELEMETRY" }, + { BLUETOOTH_TRAINER, "TRAINER" }, + { 0, NULL } +}; +const struct YamlIdStr enum_Functions[] = { + { FUNC_OVERRIDE_CHANNEL, "OVERRIDE_CHANNEL" }, + { FUNC_TRAINER, "TRAINER" }, + { FUNC_INSTANT_TRIM, "INSTANT_TRIM" }, + { FUNC_RESET, "RESET" }, + { FUNC_SET_TIMER, "SET_TIMER" }, + { FUNC_ADJUST_GVAR, "ADJUST_GVAR" }, + { FUNC_VOLUME, "VOLUME" }, + { FUNC_SET_FAILSAFE, "SET_FAILSAFE" }, + { FUNC_RANGECHECK, "RANGECHECK" }, + { FUNC_BIND, "BIND" }, + { FUNC_PLAY_SOUND, "PLAY_SOUND" }, + { FUNC_PLAY_TRACK, "PLAY_TRACK" }, + { FUNC_PLAY_VALUE, "PLAY_VALUE" }, + { FUNC_PLAY_SCRIPT, "PLAY_SCRIPT" }, + { FUNC_BACKGND_MUSIC, "BACKGND_MUSIC" }, + { FUNC_BACKGND_MUSIC_PAUSE, "BACKGND_MUSIC_PAUSE" }, + { FUNC_VARIO, "VARIO" }, + { FUNC_HAPTIC, "HAPTIC" }, + { FUNC_LOGS, "LOGS" }, + { FUNC_BACKLIGHT, "BACKLIGHT" }, + { FUNC_SCREENSHOT, "SCREENSHOT" }, + { FUNC_RACING_MODE, "RACING_MODE" }, + { FUNC_DISABLE_TOUCH, "DISABLE_TOUCH" }, + { FUNC_SET_SCREEN, "SET_SCREEN" }, + { FUNC_DISABLE_AUDIO_AMP, "DISABLE_AUDIO_AMP" }, + { FUNC_RGB_LED, "RGB_LED" }, + { FUNC_TEST, "TEST" }, + { 0, NULL } +}; +const struct YamlIdStr enum_TimerModes[] = { + { TMRMODE_OFF, "OFF" }, + { TMRMODE_ON, "ON" }, + { TMRMODE_START, "START" }, + { TMRMODE_THR, "THR" }, + { TMRMODE_THR_REL, "THR_REL" }, + { TMRMODE_THR_START, "THR_START" }, + { 0, NULL } +}; +const struct YamlIdStr enum_MixerMultiplex[] = { + { MLTPX_ADD, "ADD" }, + { MLTPX_MUL, "MUL" }, + { MLTPX_REPL, "REPL" }, + { 0, NULL } +}; +const struct YamlIdStr enum_MixSources[] = { + { MIXSRC_NONE, "NONE" }, + { MIXSRC_MIN, "MIN" }, + { MIXSRC_MAX, "MAX" }, + { MIXSRC_TX_VOLTAGE, "TX_VOLTAGE" }, + { MIXSRC_TX_TIME, "TX_TIME" }, + { MIXSRC_TX_GPS, "TX_GPS" }, + { 0, NULL } +}; +const struct YamlIdStr enum_LogicalSwitchesFunctions[] = { + { LS_FUNC_NONE, "FUNC_NONE" }, + { LS_FUNC_VEQUAL, "FUNC_VEQUAL" }, + { LS_FUNC_VALMOSTEQUAL, "FUNC_VALMOSTEQUAL" }, + { LS_FUNC_VPOS, "FUNC_VPOS" }, + { LS_FUNC_VNEG, "FUNC_VNEG" }, + { LS_FUNC_APOS, "FUNC_APOS" }, + { LS_FUNC_ANEG, "FUNC_ANEG" }, + { LS_FUNC_AND, "FUNC_AND" }, + { LS_FUNC_OR, "FUNC_OR" }, + { LS_FUNC_XOR, "FUNC_XOR" }, + { LS_FUNC_EDGE, "FUNC_EDGE" }, + { LS_FUNC_EQUAL, "FUNC_EQUAL" }, + { LS_FUNC_GREATER, "FUNC_GREATER" }, + { LS_FUNC_LESS, "FUNC_LESS" }, + { LS_FUNC_DIFFEGREATER, "FUNC_DIFFEGREATER" }, + { LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" }, + { LS_FUNC_TIMER, "FUNC_TIMER" }, + { LS_FUNC_STICKY, "FUNC_STICKY" }, + { 0, NULL } +}; +const struct YamlIdStr enum_SwashType[] = { + { SWASH_TYPE_NONE, "TYPE_NONE" }, + { SWASH_TYPE_120, "TYPE_120" }, + { SWASH_TYPE_120X, "TYPE_120X" }, + { SWASH_TYPE_140, "TYPE_140" }, + { SWASH_TYPE_90, "TYPE_90" }, + { 0, NULL } +}; +const struct YamlIdStr enum_SwitchSources[] = { + { SWSRC_NONE, "NONE" }, + { SWSRC_ON, "ON" }, + { SWSRC_ONE, "ONE" }, + { SWSRC_TELEMETRY_STREAMING, "TELEMETRY_STREAMING" }, + { SWSRC_RADIO_ACTIVITY, "RADIO_ACTIVITY" }, + { SWSRC_TRAINER_CONNECTED, "TRAINER_CONNECTED" }, + { SWSRC_OFF, "OFF" }, + { 0, NULL } +}; +const struct YamlIdStr enum_PotsWarnMode[] = { + { POTS_WARN_OFF, "WARN_OFF" }, + { POTS_WARN_MANUAL, "WARN_MANUAL" }, + { POTS_WARN_AUTO, "WARN_AUTO" }, + { 0, NULL } +}; +const struct YamlIdStr enum_ModelOverridableEnable[] = { + { OVERRIDE_GLOBAL, "GLOBAL" }, + { OVERRIDE_OFF, "OFF" }, + { OVERRIDE_ON, "ON" }, + { 0, NULL } +}; +const struct YamlIdStr enum_FailsafeModes[] = { + { FAILSAFE_NOT_SET, "NOT_SET" }, + { FAILSAFE_HOLD, "HOLD" }, + { FAILSAFE_CUSTOM, "CUSTOM" }, + { FAILSAFE_NOPULSES, "NOPULSES" }, + { FAILSAFE_RECEIVER, "RECEIVER" }, + { 0, NULL } +}; +const struct YamlIdStr enum_TelemetrySensorFormula[] = { + { TELEM_FORMULA_ADD, "FORMULA_ADD" }, + { TELEM_FORMULA_AVERAGE, "FORMULA_AVERAGE" }, + { TELEM_FORMULA_MIN, "FORMULA_MIN" }, + { TELEM_FORMULA_MAX, "FORMULA_MAX" }, + { TELEM_FORMULA_MULTIPLY, "FORMULA_MULTIPLY" }, + { TELEM_FORMULA_TOTALIZE, "FORMULA_TOTALIZE" }, + { TELEM_FORMULA_CELL, "FORMULA_CELL" }, + { TELEM_FORMULA_CONSUMPTION, "FORMULA_CONSUMPTION" }, + { TELEM_FORMULA_DIST, "FORMULA_DIST" }, + { 0, NULL } +}; +const struct YamlIdStr enum_TelemetrySensorType[] = { + { TELEM_TYPE_CUSTOM, "TYPE_CUSTOM" }, + { TELEM_TYPE_CALCULATED, "TYPE_CALCULATED" }, + { 0, NULL } +}; +const struct YamlIdStr enum_ZoneOptionValueEnum[] = { + { ZOV_Unsigned, "Unsigned" }, + { ZOV_Signed, "Signed" }, + { ZOV_Bool, "Bool" }, + { ZOV_String, "String" }, + { ZOV_Source, "Source" }, + { ZOV_Color, "Color" }, + { 0, NULL } +}; +const struct YamlIdStr enum_USBJoystickIfMode[] = { + { USBJOYS_JOYSTICK, "JOYSTICK" }, + { USBJOYS_GAMEPAD, "GAMEPAD" }, + { USBJOYS_MULTIAXIS, "MULTIAXIS" }, + { 0, NULL } +}; +const struct YamlIdStr enum_USBJoystickCh[] = { + { USBJOYS_CH_NONE, "CH_NONE" }, + { USBJOYS_CH_BUTTON, "CH_BUTTON" }, + { USBJOYS_CH_AXIS, "CH_AXIS" }, + { USBJOYS_CH_SIM, "CH_SIM" }, + { 0, NULL } +}; + +// +// Structs last +// + +static const struct YamlNode struct_CalibData[] = { + YAML_IDX_CUST("calib",r_calib,w_calib), + YAML_SIGNED( "mid", 16 ), + YAML_SIGNED( "spanNeg", 16 ), + YAML_SIGNED( "spanPos", 16 ), + YAML_END +}; +static const struct YamlNode struct_signed_16[] = { + YAML_IDX, + YAML_SIGNED( "val", 16 ), + YAML_END +}; +static const struct YamlNode struct_TrainerMix[] = { + YAML_IDX, + YAML_UNSIGNED( "srcChn", 6 ), + YAML_ENUM("mode", 2, enum_TrainerMultiplex), + YAML_SIGNED( "studWeight", 8 ), + YAML_END +}; +static const struct YamlNode struct_TrainerData[] = { + YAML_ARRAY("calib", 16, 4, struct_signed_16, NULL), + YAML_ARRAY("mix", 16, 4, struct_TrainerMix, NULL), + YAML_END +}; +static const struct YamlNode struct_anonymous_1[] = { + YAML_STRING("name", 8), + YAML_END +}; +static const struct YamlNode struct_anonymous_2[] = { + YAML_SIGNED( "val", 16 ), + YAML_UNSIGNED( "mode", 8 ), + YAML_UNSIGNED( "param", 8 ), + YAML_SIGNED( "val2", 32 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_3[] = { + YAML_SIGNED( "val1", 32 ), + YAML_SIGNED( "val2", 32 ), + YAML_END +}; +static const struct YamlNode union_anonymous_0_elmts[] = { + YAML_STRUCT("play", 64, struct_anonymous_1, NULL), + YAML_STRUCT("all", 64, struct_anonymous_2, NULL), + YAML_STRUCT("clear", 64, struct_anonymous_3, NULL), + YAML_END +}; +static const struct YamlNode struct_CustomFunctionData[] = { + YAML_IDX, + YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), + YAML_ENUM("func", 6, enum_Functions), + YAML_CUSTOM("def",r_customFn,w_customFn), + YAML_PADDING( 64 ), + YAML_PADDING( 1 ), + YAML_PADDING( 7 ), + YAML_END +}; +static const struct YamlNode struct_RadioData[] = { + YAML_UNSIGNED( "manuallyEdited", 1 ), + YAML_SIGNED( "timezoneMinutes", 3 ), + YAML_UNSIGNED( "ppmunit", 2 ), + YAML_ENUM("hatsMode", 2, enum_HatsMode), + YAML_CUSTOM("semver",nullptr,w_semver), + YAML_CUSTOM("board",nullptr,w_board), + YAML_ARRAY("calib", 48, 20, struct_CalibData, NULL), + YAML_PADDING( 16 ), + YAML_SIGNED( "currModel", 8 ), + YAML_UNSIGNED( "contrast", 8 ), + YAML_UNSIGNED( "vBatWarn", 8 ), + YAML_SIGNED( "txVoltageCalibration", 8 ), + YAML_ENUM("backlightMode", 3, enum_BacklightMode), + YAML_ENUM("antennaMode", 2, enum_AntennaModes), + YAML_UNSIGNED( "disableRtcWarning", 1 ), + YAML_UNSIGNED( "keysBacklight", 1 ), + YAML_UNSIGNED( "dontPlayHello", 1 ), + YAML_ENUM("internalModule", 8, enum_ModuleType), + YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), + YAML_UNSIGNED( "view", 8 ), + YAML_PADDING( 2 ), + YAML_UNSIGNED( "fai", 1 ), + YAML_SIGNED_CUST( "beepMode", 2, r_beeperMode, w_beeperMode ), + YAML_UNSIGNED( "alarmsFlash", 1 ), + YAML_UNSIGNED( "disableMemoryWarning", 1 ), + YAML_UNSIGNED( "disableAlarmWarning", 1 ), + YAML_UNSIGNED( "stickMode", 2 ), + YAML_SIGNED( "timezone", 5 ), + YAML_UNSIGNED( "adjustRTC", 1 ), + YAML_UNSIGNED( "inactivityTimer", 8 ), + YAML_CUSTOM("telemetryBaudrate",r_telemetryBaudrate,nullptr), + YAML_UNSIGNED( "internalModuleBaudrate", 3 ), + YAML_SIGNED( "splashMode", 3 ), + YAML_SIGNED_CUST( "hapticMode", 2, r_beeperMode, w_beeperMode ), + YAML_SIGNED( "switchesDelay", 8 ), + YAML_UNSIGNED( "lightAutoOff", 8 ), + YAML_UNSIGNED( "templateSetup", 8 ), + YAML_SIGNED( "PPM_Multiplier", 8 ), + YAML_SIGNED_CUST( "hapticLength", 8, r_5pos, w_5pos ), + YAML_SIGNED_CUST( "beepLength", 3, r_5pos, w_5pos ), + YAML_SIGNED_CUST( "hapticStrength", 3, r_5pos, w_5pos ), + YAML_UNSIGNED( "gpsFormat", 1 ), + YAML_UNSIGNED( "audioMuteEnable", 1 ), + YAML_UNSIGNED_CUST( "speakerPitch", 8, r_spPitch, w_spPitch ), + YAML_SIGNED_CUST( "speakerVolume", 8, r_vol, w_vol ), + YAML_SIGNED_CUST( "vBatMin", 8, r_vbat_min, w_vbat_min ), + YAML_SIGNED_CUST( "vBatMax", 8, r_vbat_max, w_vbat_max ), + YAML_UNSIGNED( "backlightBright", 8 ), + YAML_UNSIGNED( "globalTimer", 32 ), + YAML_UNSIGNED( "bluetoothBaudrate", 4 ), + YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes), + YAML_UNSIGNED( "countryCode", 2 ), + YAML_SIGNED( "pwrOnSpeed", 3 ), + YAML_SIGNED( "pwrOffSpeed", 3 ), + YAML_CUSTOM("jitterFilter",r_jitterFilter,nullptr), + YAML_UNSIGNED( "noJitterFilter", 1 ), + YAML_UNSIGNED( "imperial", 1 ), + YAML_UNSIGNED( "disableRssiPoweroffAlarm", 1 ), + YAML_UNSIGNED( "USBMode", 2 ), + YAML_UNSIGNED( "jackMode", 2 ), + YAML_PADDING( 1 ), + YAML_STRING("ttsLanguage", 2), + YAML_SIGNED_CUST( "beepVolume", 4, r_5pos, w_5pos ), + YAML_SIGNED_CUST( "wavVolume", 4, r_5pos, w_5pos ), + YAML_SIGNED_CUST( "varioVolume", 4, r_5pos, w_5pos ), + YAML_SIGNED_CUST( "backgroundVolume", 4, r_5pos, w_5pos ), + YAML_SIGNED_CUST( "varioPitch", 8, r_vPitch, w_vPitch ), + YAML_SIGNED_CUST( "varioRange", 8, r_vPitch, w_vPitch ), + YAML_SIGNED( "varioRepeat", 8 ), + YAML_ARRAY("customFn", 88, 64, struct_CustomFunctionData, cfn_is_active), + YAML_CUSTOM("auxSerialMode",r_serialMode,nullptr), + YAML_CUSTOM("aux2SerialMode",r_serialMode,nullptr), + YAML_ARRAY("serialPort", 8, 4, struct_serialConfig, nullptr), + YAML_ARRAY("sticksConfig", 0, MAX_STICKS, struct_stickConfig, stick_name_valid), + YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr), + YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr), + YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr), + YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid), + YAML_STRING("currModelFilename", 17), + YAML_UNSIGNED( "modelQuickSelect", 1 ), + YAML_UNSIGNED( "blOffBright", 7 ), + YAML_STRING("bluetoothName", 10), + YAML_STRING("ownerRegistrationID", 8), + YAML_PADDING( 3 ), + YAML_SIGNED( "uartSampleMode", 2 ), + YAML_UNSIGNED( "stickDeadZone", 3 ), + YAML_STRING("selectedTheme", 26), + YAML_UNSIGNED( "labelSingleSelect", 1 ), + YAML_UNSIGNED( "labelMultiMode", 1 ), + YAML_UNSIGNED( "favMultiMode", 1 ), + YAML_UNSIGNED( "modelSelectLayout", 2 ), + YAML_UNSIGNED( "radioThemesDisabled", 1 ), + YAML_UNSIGNED( "radioGFDisabled", 1 ), + YAML_UNSIGNED( "radioTrainerDisabled", 1 ), + YAML_UNSIGNED( "modelHeliDisabled", 1 ), + YAML_UNSIGNED( "modelFMDisabled", 1 ), + YAML_UNSIGNED( "modelCurvesDisabled", 1 ), + YAML_UNSIGNED( "modelGVDisabled", 1 ), + YAML_UNSIGNED( "modelLSDisabled", 1 ), + YAML_UNSIGNED( "modelSFDisabled", 1 ), + YAML_UNSIGNED( "modelCustomScriptsDisabled", 1 ), + YAML_UNSIGNED( "modelTelemetryDisabled", 1 ), + YAML_UNSIGNED( "disableTrainerPoweroffAlarm", 1 ), + YAML_UNSIGNED( "disablePwrOnOffHaptic", 1 ), + YAML_PADDING( 6 ), + YAML_UNSIGNED( "pwrOffIfInactive", 8 ), + YAML_END +}; +static const struct YamlNode struct_unsigned_8[] = { + YAML_IDX, + YAML_UNSIGNED( "val", 8 ), + YAML_END +}; +static const struct YamlNode struct_ModelHeader[] = { + YAML_STRING("name", 15), + YAML_ARRAY("modelId", 8, 2, struct_unsigned_8, NULL), + YAML_STRING("bitmap", 14), + YAML_STRING("labels", 100), + YAML_END +}; +static const struct YamlNode struct_TimerData[] = { + YAML_IDX, + YAML_UNSIGNED( "start", 22 ), + YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), + YAML_SIGNED( "value", 22 ), + YAML_ENUM("mode", 3, enum_TimerModes), + YAML_UNSIGNED( "countdownBeep", 2 ), + YAML_UNSIGNED( "minuteBeep", 1 ), + YAML_UNSIGNED( "persistent", 2 ), + YAML_SIGNED( "countdownStart", 2 ), + YAML_UNSIGNED( "showElapsed", 1 ), + YAML_UNSIGNED( "extraHaptic", 1 ), + YAML_PADDING( 6 ), + YAML_STRING("name", 8), + YAML_END +}; +static const struct YamlNode struct_CurveRef[] = { + YAML_UNSIGNED( "type", 5 ), + YAML_SIGNED_CUST( "value", 11, r_sourceNumVal, w_sourceNumVal ), + YAML_END +}; +static const struct YamlNode struct_MixData[] = { + YAML_UNSIGNED( "destCh", 5 ), + YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ), + YAML_UNSIGNED( "carryTrim", 1 ), + YAML_UNSIGNED( "mixWarn", 2 ), + YAML_ENUM("mltpx", 2, enum_MixerMultiplex), + YAML_UNSIGNED( "delayPrec", 1 ), + YAML_UNSIGNED( "speedPrec", 1 ), + YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ), + YAML_PADDING( 1 ), + YAML_UNSIGNED_CUST( "weight", 11, r_sourceNumVal, w_sourceNumVal ), + YAML_UNSIGNED_CUST( "offset", 11, r_sourceNumVal, w_sourceNumVal ), + YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), + YAML_STRUCT("curve", 16, struct_CurveRef, NULL), + YAML_UNSIGNED( "delayUp", 8 ), + YAML_UNSIGNED( "delayDown", 8 ), + YAML_UNSIGNED( "speedUp", 8 ), + YAML_UNSIGNED( "speedDown", 8 ), + YAML_STRING("name", 6), + YAML_END +}; +static const struct YamlNode struct_LimitData[] = { + YAML_IDX, + YAML_SIGNED_CUST( "min", 11, in_read_weight, in_write_weight ), + YAML_SIGNED_CUST( "max", 11, in_read_weight, in_write_weight ), + YAML_SIGNED( "ppmCenter", 10 ), + YAML_SIGNED_CUST( "offset", 11, in_read_weight, in_write_weight ), + YAML_UNSIGNED( "symetrical", 1 ), + YAML_UNSIGNED( "revert", 1 ), + YAML_PADDING( 3 ), + YAML_SIGNED( "curve", 8 ), + YAML_STRING("name", 6), + YAML_END +}; +static const struct YamlNode struct_ExpoData[] = { + YAML_UNSIGNED( "mode", 2 ), + YAML_UNSIGNED( "scale", 14 ), + YAML_CUSTOM("carryTrim",r_carryTrim,nullptr), + YAML_SIGNED( "trimSource", 6 ), + YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ), + YAML_UNSIGNED_CUST( "weight", 11, r_sourceNumVal, w_sourceNumVal ), + YAML_UNSIGNED_CUST( "offset", 11, r_sourceNumVal, w_sourceNumVal ), + YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), + YAML_STRUCT("curve", 16, struct_CurveRef, NULL), + YAML_UNSIGNED( "chn", 5 ), + YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ), + YAML_PADDING( 2 ), + YAML_STRING("name", 6), + YAML_END +}; +static const struct YamlNode struct_CurveHeader[] = { + YAML_IDX, + YAML_UNSIGNED( "type", 1 ), + YAML_UNSIGNED( "smooth", 1 ), + YAML_SIGNED( "points", 6 ), + YAML_STRING("name", 3), + YAML_END +}; +static const struct YamlNode struct_signed_8[] = { + YAML_IDX, + YAML_SIGNED( "val", 8 ), + YAML_END +}; +static const struct YamlNode struct_LogicalSwitchData[] = { + YAML_IDX, + YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions), + YAML_CUSTOM("def",r_logicSw,w_logicSw), + YAML_PADDING( 10 ), + YAML_PADDING( 10 ), + YAML_SIGNED_CUST( "andsw", 10, r_swtchSrc, w_swtchSrc ), + YAML_UNSIGNED( "lsPersist", 1 ), + YAML_UNSIGNED( "lsState", 1 ), + YAML_PADDING( 16 ), + YAML_UNSIGNED( "delay", 8 ), + YAML_UNSIGNED( "duration", 8 ), + YAML_END +}; +static const struct YamlNode struct_SwashRingData[] = { + YAML_ENUM("type", 8, enum_SwashType), + YAML_UNSIGNED( "value", 8 ), + YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ), + YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ), + YAML_UNSIGNED_CUST( "elevatorSource", 8, r_mixSrcRaw, w_mixSrcRaw ), + YAML_SIGNED( "collectiveWeight", 8 ), + YAML_SIGNED( "aileronWeight", 8 ), + YAML_SIGNED( "elevatorWeight", 8 ), + YAML_END +}; +static const struct YamlNode struct_trim_t[] = { + YAML_IDX, + YAML_SIGNED( "value", 11 ), + YAML_UNSIGNED( "mode", 5 ), + YAML_END +}; +static const struct YamlNode struct_FlightModeData[] = { + YAML_IDX, + YAML_ARRAY("trim", 16, 8, struct_trim_t, NULL), + YAML_STRING("name", 10), + YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), + YAML_PADDING( 6 ), + YAML_UNSIGNED( "fadeIn", 8 ), + YAML_UNSIGNED( "fadeOut", 8 ), + YAML_ARRAY("gvars", 16, 9, struct_signed_16, gvar_is_active), + YAML_END +}; +static const struct YamlNode struct_GVarData[] = { + YAML_IDX, + YAML_STRING("name", 3), + YAML_UNSIGNED( "min", 12 ), + YAML_UNSIGNED( "max", 12 ), + YAML_UNSIGNED( "popup", 1 ), + YAML_UNSIGNED( "prec", 1 ), + YAML_UNSIGNED( "unit", 2 ), + YAML_PADDING( 4 ), + YAML_END +}; +static const struct YamlNode struct_VarioData[] = { + YAML_UNSIGNED_CUST( "source", 7, r_tele_sensor, w_tele_sensor ), + YAML_UNSIGNED( "centerSilent", 1 ), + YAML_SIGNED( "centerMax", 8 ), + YAML_SIGNED( "centerMin", 8 ), + YAML_SIGNED( "min", 8 ), + YAML_SIGNED( "max", 8 ), + YAML_END +}; +static const struct YamlNode struct_RssiAlarmData[] = { + YAML_CUSTOM("disabled",r_rssiDisabled,nullptr), + YAML_CUSTOM("warning",r_rssiWarning,nullptr), + YAML_CUSTOM("critical",r_rssiCritical,nullptr), + YAML_END +}; +static const struct YamlNode struct_RFAlarmData[] = { + YAML_SIGNED( "warning", 8 ), + YAML_SIGNED( "critical", 8 ), + YAML_END +}; +static const struct YamlNode struct_PpmModule[] = { + YAML_SIGNED( "delay", 6 ), + YAML_UNSIGNED( "pulsePol", 1 ), + YAML_UNSIGNED( "outputType", 1 ), + YAML_SIGNED( "frameLength", 8 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_5[] = { + YAML_PADDING( 8 ), + YAML_UNSIGNED( "disableTelemetry", 1 ), + YAML_UNSIGNED( "disableMapping", 1 ), + YAML_UNSIGNED( "autoBindMode", 1 ), + YAML_UNSIGNED( "lowPowerMode", 1 ), + YAML_UNSIGNED( "receiverTelemetryOff", 1 ), + YAML_UNSIGNED( "receiverHigherChannels", 1 ), + YAML_PADDING( 2 ), + YAML_SIGNED( "optionValue", 8 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_6[] = { + YAML_UNSIGNED( "power", 2 ), + YAML_PADDING( 2 ), + YAML_UNSIGNED( "receiverTelemetryOff", 1 ), + YAML_UNSIGNED( "receiverHigherChannels", 1 ), + YAML_SIGNED( "antennaMode", 2 ), + YAML_PADDING( 8 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_7[] = { + YAML_PADDING( 6 ), + YAML_UNSIGNED( "noninverted", 1 ), + YAML_PADDING( 1 ), + YAML_SIGNED( "refreshRate", 8 ), + YAML_END +}; +static const struct YamlNode struct_string_64[] = { + YAML_IDX, + YAML_STRING("val", 8), + YAML_END +}; +static const struct YamlNode struct_anonymous_8[] = { + YAML_UNSIGNED( "receivers", 7 ), + YAML_UNSIGNED( "racingMode", 1 ), + YAML_ARRAY("receiverName", 64, 3, struct_string_64, NULL), + YAML_END +}; +static const struct YamlNode struct_anonymous_9[] = { + YAML_ARRAY("rx_id", 8, 4, struct_unsigned_8, NULL), + YAML_UNSIGNED( "mode", 3 ), + YAML_UNSIGNED( "rfPower", 1 ), + YAML_UNSIGNED( "reserved", 4 ), + YAML_ARRAY("rx_freq", 8, 2, struct_unsigned_8, NULL), + YAML_END +}; +static const struct YamlNode struct_anonymous_10[] = { + YAML_UNSIGNED( "emi", 2 ), + YAML_UNSIGNED( "telemetry", 1 ), + YAML_UNSIGNED( "phyMode", 3 ), + YAML_UNSIGNED( "reserved", 2 ), + YAML_UNSIGNED( "rfPower", 8 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_11[] = { + YAML_UNSIGNED( "raw12bits", 1 ), + YAML_UNSIGNED( "telemetryBaudrate", 3 ), + YAML_PADDING( 4 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_12[] = { + YAML_UNSIGNED( "telemetryBaudrate", 3 ), + YAML_UNSIGNED( "crsfArmingMode", 1 ), + YAML_PADDING( 4 ), + YAML_SIGNED_CUST( "crsfArmingTrigger", 10, r_swtchSrc, w_swtchSrc ), + YAML_SIGNED( "spare3", 6 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_13[] = { + YAML_UNSIGNED( "flags", 8 ), + YAML_END +}; +static const struct YamlNode union_anonymous_4_elmts[] = { + YAML_ARRAY("raw", 8, 25, struct_unsigned_8, NULL), + YAML_STRUCT("ppm", 16, struct_PpmModule, NULL), + YAML_STRUCT("multi", 24, struct_anonymous_5, NULL), + YAML_STRUCT("pxx", 16, struct_anonymous_6, NULL), + YAML_STRUCT("sbus", 16, struct_anonymous_7, NULL), + YAML_STRUCT("pxx2", 200, struct_anonymous_8, NULL), + YAML_STRUCT("flysky", 56, struct_anonymous_9, NULL), + YAML_STRUCT("afhds3", 16, struct_anonymous_10, NULL), + YAML_STRUCT("ghost", 8, struct_anonymous_11, NULL), + YAML_STRUCT("crsf", 24, struct_anonymous_12, NULL), + YAML_STRUCT("dsmp", 8, struct_anonymous_13, NULL), + YAML_END +}; +static const struct YamlNode struct_ModuleData[] = { + YAML_IDX, + YAML_UNSIGNED_CUST( "type", 8, r_moduleType, w_moduleType ), + YAML_CUSTOM("subType",r_modSubtype,w_modSubtype), + YAML_UNSIGNED( "channelsStart", 8 ), + YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ), + YAML_ENUM("failsafeMode", 4, enum_FailsafeModes), + YAML_PADDING( 4 ), + YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type), + YAML_END +}; +static const struct YamlNode struct_TrainerModuleData[] = { + YAML_UNSIGNED_CUST( "mode", 8, r_trainerMode, w_trainerMode ), + YAML_UNSIGNED( "channelsStart", 8 ), + YAML_SIGNED( "channelsCount", 8 ), + YAML_SIGNED( "frameLength", 8 ), + YAML_SIGNED( "delay", 6 ), + YAML_UNSIGNED( "pulsePol", 1 ), + YAML_PADDING( 1 ), + YAML_END +}; +static const struct YamlNode union_ScriptDataInput_elmts[] = { + YAML_SIGNED( "value", 16 ), + YAML_UNSIGNED_CUST( "source", 16, r_mixSrcRaw, w_mixSrcRaw ), + YAML_END +}; +static const struct YamlNode union_ScriptDataInput[] = { + YAML_IDX, + YAML_UNION("u", 16, union_ScriptDataInput_elmts, select_script_input), + YAML_END +}; +static const struct YamlNode struct_ScriptData[] = { + YAML_IDX, + YAML_STRING("file", 6), + YAML_STRING("name", 6), + YAML_ARRAY("inputs", 16, 6, union_ScriptDataInput, NULL), + YAML_END +}; +static const struct YamlNode struct_string_32[] = { + YAML_IDX, + YAML_STRING("val", 4), + YAML_END +}; +static const struct YamlNode union_anonymous_14_elmts[] = { + YAML_UNSIGNED( "id", 16 ), + YAML_UNSIGNED( "persistentValue", 16 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_16[] = { + YAML_UNSIGNED( "physID", 5 ), + YAML_UNSIGNED( "rxIndex", 3 ), + YAML_END +}; +static const struct YamlNode union_anonymous_15_elmts[] = { + YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL), + YAML_UNSIGNED( "instance", 8 ), + YAML_ENUM("formula", 8, enum_TelemetrySensorFormula), + YAML_END +}; +static const struct YamlNode struct_anonymous_18[] = { + YAML_UNSIGNED( "ratio", 16 ), + YAML_SIGNED( "offset", 16 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_19[] = { + YAML_UNSIGNED( "source", 8 ), + YAML_UNSIGNED( "index", 8 ), + YAML_PADDING( 16 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_20[] = { + YAML_ARRAY("sources", 8, 4, struct_signed_8, NULL), + YAML_END +}; +static const struct YamlNode struct_anonymous_21[] = { + YAML_UNSIGNED( "source", 8 ), + YAML_PADDING( 24 ), + YAML_END +}; +static const struct YamlNode struct_anonymous_22[] = { + YAML_UNSIGNED( "gps", 8 ), + YAML_UNSIGNED( "alt", 8 ), + YAML_PADDING( 16 ), + YAML_END +}; +static const struct YamlNode union_anonymous_17_elmts[] = { + YAML_STRUCT("custom", 32, struct_anonymous_18, NULL), + YAML_STRUCT("cell", 32, struct_anonymous_19, NULL), + YAML_STRUCT("calc", 32, struct_anonymous_20, NULL), + YAML_STRUCT("consumption", 32, struct_anonymous_21, NULL), + YAML_STRUCT("dist", 32, struct_anonymous_22, NULL), + YAML_UNSIGNED( "param", 32 ), + YAML_END +}; +static const struct YamlNode struct_TelemetrySensor[] = { + YAML_IDX, + YAML_UNION("id1", 16, union_anonymous_14_elmts, select_id1), + YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2), + YAML_STRING("label", 4), + YAML_UNSIGNED( "subId", 8 ), + YAML_ENUM("type", 1, enum_TelemetrySensorType), + YAML_PADDING( 1 ), + YAML_UNSIGNED( "unit", 6 ), + YAML_UNSIGNED( "prec", 2 ), + YAML_UNSIGNED( "autoOffset", 1 ), + YAML_UNSIGNED( "filter", 1 ), + YAML_UNSIGNED( "logs", 1 ), + YAML_UNSIGNED( "persistent", 1 ), + YAML_UNSIGNED( "onlyPositive", 1 ), + YAML_PADDING( 1 ), + YAML_UNION("cfg", 32, union_anonymous_17_elmts, select_sensor_cfg), + YAML_END +}; +static const struct YamlNode union_ZoneOptionValue_elmts[] = { + YAML_UNSIGNED( "unsignedValue", 32 ), + YAML_SIGNED( "signedValue", 32 ), + YAML_UNSIGNED( "boolValue", 32 ), + YAML_STRING("stringValue", 12), + YAML_CUSTOM("source",r_zov_source,w_zov_source), + YAML_CUSTOM("color",r_zov_color,w_zov_color), + YAML_END +}; +static const struct YamlNode struct_ZoneOptionValueTyped[] = { + YAML_IDX, + YAML_ENUM("type", 32, enum_ZoneOptionValueEnum), + YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov), + YAML_END +}; +static const struct YamlNode struct_WidgetPersistentData[] = { + YAML_ARRAY("options", 128, 10, struct_ZoneOptionValueTyped, NULL), + YAML_END +}; +static const struct YamlNode struct_ZonePersistentData[] = { + YAML_IDX, + YAML_STRING("widgetName", 12), + YAML_STRUCT("widgetData", 1280, struct_WidgetPersistentData, NULL), + YAML_END +}; +static const struct YamlNode struct_LayoutPersistentData[] = { + YAML_ARRAY("zones", 1376, 10, struct_ZonePersistentData, NULL), + YAML_ARRAY("options", 128, 10, struct_ZoneOptionValueTyped, NULL), + YAML_END +}; +static const struct YamlNode struct_CustomScreenData[] = { + YAML_IDX, + YAML_STRING("LayoutId", 12), + YAML_STRUCT("layoutData", 15040, struct_LayoutPersistentData, NULL), + YAML_END +}; +static const struct YamlNode struct_TopBarPersistentData[] = { + YAML_ARRAY("zones", 1376, 4, struct_ZonePersistentData, NULL), + YAML_ARRAY("options", 128, 1, struct_ZoneOptionValueTyped, NULL), + YAML_END +}; +static const struct YamlNode struct_USBJoystickChData[] = { + YAML_IDX, + YAML_ENUM("mode", 3, enum_USBJoystickCh), + YAML_UNSIGNED( "inversion", 1 ), + YAML_UNSIGNED( "param", 4 ), + YAML_UNSIGNED( "btn_num", 5 ), + YAML_UNSIGNED( "switch_npos", 3 ), + YAML_END +}; +static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), + YAML_STRUCT("header", 1048, struct_ModelHeader, NULL), + YAML_ARRAY("timers", 136, 3, struct_TimerData, NULL), + YAML_UNSIGNED( "telemetryProtocol", 3 ), + YAML_UNSIGNED( "thrTrim", 1 ), + YAML_UNSIGNED( "noGlobalFunctions", 1 ), + YAML_UNSIGNED( "displayTrims", 2 ), + YAML_UNSIGNED( "ignoreSensorIds", 1 ), + YAML_SIGNED( "trimInc", 3 ), + YAML_UNSIGNED( "disableThrottleWarning", 1 ), + YAML_UNSIGNED( "displayChecklist", 1 ), + YAML_UNSIGNED( "extendedLimits", 1 ), + YAML_UNSIGNED( "extendedTrims", 1 ), + YAML_UNSIGNED( "throttleReversed", 1 ), + YAML_UNSIGNED( "enableCustomThrottleWarning", 1 ), + YAML_UNSIGNED( "disableTelemetryWarning", 1 ), + YAML_UNSIGNED( "showInstanceIds", 1 ), + YAML_UNSIGNED( "checklistInteractive", 1 ), + YAML_ENUM("hatsMode", 2, enum_HatsMode), + YAML_PADDING( 2 ), + YAML_SIGNED( "customThrottleWarningPosition", 8 ), + YAML_UNSIGNED( "beepANACenter", 16 ), + YAML_ARRAY("mixData", 160, 64, struct_MixData, NULL), + YAML_ARRAY("limitData", 104, 32, struct_LimitData, NULL), + YAML_ARRAY("expoData", 144, 64, struct_ExpoData, NULL), + YAML_ARRAY("curves", 32, 32, struct_CurveHeader, NULL), + YAML_ARRAY("points", 8, 512, struct_signed_8, NULL), + YAML_ARRAY("logicalSw", 72, 64, struct_LogicalSwitchData, NULL), + YAML_ARRAY("customFn", 88, 64, struct_CustomFunctionData, cfn_is_active), + YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active), + YAML_ARRAY("flightModeData", 384, 9, struct_FlightModeData, fmd_is_active), + YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ), + YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr), + YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr), + YAML_PADDING(1), + YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL), + YAML_STRUCT("varioData", 40, struct_VarioData, NULL), + YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ), + YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL), + YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL), + YAML_UNSIGNED( "thrTrimSw", 3 ), + YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode), + YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable), + YAML_PADDING( 1 ), + YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL), + YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL), + YAML_STRUCT("trainerData", 40, struct_TrainerModuleData, NULL), + YAML_ARRAY("scriptsData", 192, 9, struct_ScriptData, NULL), + YAML_ARRAY("inputNames", 32, 32, struct_string_32, NULL), + YAML_UNSIGNED( "potsWarnEnabled", 16 ), + YAML_ARRAY("potsWarnPosition", 8, 16, struct_signed_8, NULL), + YAML_ARRAY("telemetrySensors", 112, 60, struct_TelemetrySensor, NULL), + YAML_ARRAY("screenData", 15136, 10, struct_CustomScreenData, NULL), + YAML_STRUCT("topbarData", 5632, struct_TopBarPersistentData, NULL), + YAML_ARRAY("topbarWidgetWidth", 8, 4, struct_unsigned_8, NULL), + YAML_UNSIGNED( "view", 8 ), + YAML_STRING("modelRegistrationID", 8), + YAML_UNSIGNED( "usbJoystickExtMode", 1 ), + YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode), + YAML_UNSIGNED( "usbJoystickCircularCut", 4 ), + YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL), + YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable), + YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable), + YAML_END +}; +static const struct YamlNode struct_PartialModel[] = { + YAML_STRUCT("header", 1048, struct_ModelHeader, NULL), + YAML_ARRAY("timers", 136, 3, struct_TimerData, NULL), + YAML_END +}; + +#define MAX_RADIODATA_MODELDATA_PARTIALMODEL_STR_LEN 29 + +static const struct YamlNode __RadioData_root_node = YAML_ROOT( struct_RadioData ); + +const YamlNode* get_radiodata_nodes() +{ + return &__RadioData_root_node; +} +static const struct YamlNode __ModelData_root_node = YAML_ROOT( struct_ModelData ); + +const YamlNode* get_modeldata_nodes() +{ + return &__ModelData_root_node; +} +static const struct YamlNode __PartialModel_root_node = YAML_ROOT( struct_PartialModel ); + +const YamlNode* get_partialmodel_nodes() +{ + return &__PartialModel_root_node; +} + diff --git a/radio/src/targets/nv14/touch_driver.cpp b/radio/src/targets/nv14/touch_driver.cpp index e79ba84acfb..36467e0ad14 100644 --- a/radio/src/targets/nv14/touch_driver.cpp +++ b/radio/src/targets/nv14/touch_driver.cpp @@ -45,6 +45,7 @@ volatile static bool touchEventOccured; enum TouchControllers {TC_NONE, TC_FT6236, TC_CST836U}; TouchControllers touchController = TC_NONE; +const char* boardTouchType = ""; static tc_handle_TypeDef tc_handle = {0, 0}; tmr10ms_t downTime = 0; @@ -388,9 +389,11 @@ void detectTouchController() { touchController = TC_CST836U; tc = &CST836U; + boardTouchType = "CST836U"; } else { touchController = TC_FT6236; tc = &FT6236; + boardTouchType = "FT6236"; } } diff --git a/radio/src/targets/pl18/CMakeLists.txt b/radio/src/targets/pl18/CMakeLists.txt index 9d4393ad9db..2f4e2010b8a 100644 --- a/radio/src/targets/pl18/CMakeLists.txt +++ b/radio/src/targets/pl18/CMakeLists.txt @@ -1,10 +1,13 @@ +option(DISK_CACHE "Enable SD card disk cache" ON) option(UNEXPECTED_SHUTDOWN "Enable the Unexpected Shutdown screen" ON) +option(STICKS_DEAD_ZONE "Enable sticks dead zone" YES) option(PXX1 "PXX1 protocol support" ON) option(PXX2 "PXX2 protocol support" OFF) option(AFHDS3 "AFHDS3 TX Module" ON) option(MULTIMODULE "DIY Multiprotocol TX Module (https://github.com/pascallanger/DIY-Multiprotocol-TX-Module)" ON) option(GHOST "Ghost TX Module" ON) option(MODULE_SIZE_STD "Standard size TX Module" ON) +option(USE_RTC_CLOCK "RTC Clock" ON) set(PWR_BUTTON "PRESS" CACHE STRING "Pwr button type (PRESS/SWITCH)") set(CPU_TYPE STM32F4) @@ -18,10 +21,6 @@ set(RTC_BACKUP_RAM YES) set(PPM_LIMITS_SYMETRICAL YES) set(USB_SERIAL ON CACHE BOOL "Enable USB serial (CDC)") set(HARDWARE_EXTERNAL_MODULE YES) -set(WIRELESS_CHARGER YES) - -#option(STICKS_DEAD_ZONE "Enable sticks dead zone" YES) -#option(AFHDS2 "Support for AFHDS2" OFF) # for size report script set(CPU_TYPE_FULL STM32F429xI) @@ -30,22 +29,65 @@ set(TARGET_SDRAM_START 0xC0000000) set(SIZE_TARGET_MEM_DEFINE "MEM_SIZE_SDRAM1=8192") -#set(RF_BAUD_RATE 921600 230400 115200 57600 38400 19200 9600 4800 2400 1200) -#set(PCB_RF_BAUD 921600 CACHE STRING "INTERNAL_MODULE_BAUDRATE: ${RF_BAUD_RATE}") -#set_property(CACHE PCB_RF_BAUD PROPERTY STRINGS ${RF_BAUD_RATE}) +set(RF_BAUD_RATE 921600 230400 115200 57600 38400 19200 9600 4800 2400 1200) +set(PCB_RF_BAUD 921600 CACHE STRING "INTERNAL_MODULE_BAUDRATE: ${RF_BAUD_RATE}") +set_property(CACHE PCB_RF_BAUD PROPERTY STRINGS ${RF_BAUD_RATE}) add_definitions(-DPCBPL18 -DPCBFLYSKY) add_definitions(-DBATTERY_CHARGE) -add_definitions(-DSOFTWARE_VOLUME) -add_definitions(-DSPI_FLASH) add_definitions(-DSTM32_SUPPORT_32BIT_TIMERS) -if(PCBREV STREQUAL PL18EV) +if (PCBREV STREQUAL EL18) + set(FLAVOUR el18) + add_definitions(-DRADIO_EL18 -DRADIO_NV14_FAMILY -DPCBNV14 -DUSE_HATS_AS_KEYS) + set(DISK_CACHE ON) + set(FLYSKY_GIMBAL ON) + set(USE_VS1053B ON) + set(AFHDS3 ON) + + # defines existing internal modules + set(INTERNAL_MODULES AFHDS3;CRSF CACHE STRING "Internal modules") + set(DEFAULT_INTERNAL_MODULE FLYSKY_AFHDS3 CACHE STRING "Default internal module") +elseif(PCBREV STREQUAL NV14) + set(FLAVOUR nv14) + add_definitions(-DRADIO_NV14 -DRADIO_NV14_FAMILY -DPCBNV14) + add_definitions(-DUSE_HATS_AS_KEYS -DAFHDS2_BAUDRATE=${PCB_RF_BAUD}) + set(DISK_CACHE ON) + set(FLYSKY_GIMBAL ON) + set(USE_VS1053B ON) + set(AFHDS2 ON) + set(AFHDS3 ON) + + # defines existing internal modules + set(INTERNAL_MODULES AFHDS2A CACHE STRING "Internal modules") + set(DEFAULT_INTERNAL_MODULE FLYSKY_AFHDS2A CACHE STRING "Default internal module") +elseif(PCBREV STREQUAL NB4P) + set(FLAVOUR nb4p) + add_definitions(-DRADIO_NB4P -DSPI_FLASH) + set(ROTARY_ENCODER YES) + set(LED_STRIP ON) + set(AFHDS3 ON) + set(KEY_DRIVER nb4p_key_driver.cpp) + + # Defines internal modules for PL18 via UART7 + set(INTERNAL_MODULES MULTI;AFHDS3;CRSF CACHE STRING "Internal modules") + set(DEFAULT_INTERNAL_MODULE MULTIMODULE CACHE STRING "Default internal module") +elseif(PCBREV STREQUAL PL18EV) set(FLAVOUR pl18ev) - add_definitions(-DRADIO_PL18EV) + add_definitions(-DRADIO_PL18EV -DSPI_FLASH -DUSE_HATS_AS_KEYS) + set(WIRELESS_CHARGER YES) + set(FLYSKY_GIMBAL ON) + set(LED_STRIP ON) + set(AFHDS3 ON) + set(KEY_DRIVER key_driver.cpp) else() set(FLAVOUR pl18) - add_definitions(-DRADIO_PL18) + add_definitions(-DRADIO_PL18 -DSPI_FLASH -DUSE_HATS_AS_KEYS) + set(WIRELESS_CHARGER YES) + set(FLYSKY_GIMBAL ON) + set(LED_STRIP ON) + set(AFHDS3 ON) + set(KEY_DRIVER key_driver.cpp) # Defines internal modules for PL18 via UART7 set(INTERNAL_MODULES MULTI CACHE STRING "Internal modules") @@ -62,22 +104,26 @@ set(FIRMWARE_DEPENDENCIES datacopy) set(HARDWARE_TOUCH ON) set(SOFTWARE_KEYBOARD ON) -set(FLYSKY_GIMBAL ON) add_definitions( -DSTM32F429_439xx -DSTM32F429xx -DSDRAM -DCCMRAM -DCOLORLCD -DLIBOPENUI -DHARDWARE_TOUCH -DHARDWARE_KEYS - -DSOFTWARE_KEYBOARD -DUSE_HATS_AS_KEYS) + -DSOFTWARE_KEYBOARD) set(SDRAM ON) -add_definitions(-DAUDIO -DVOICE -DRTCLOCK) +add_definitions(-DAUDIO -DVOICE) add_definitions(-DGPS_USART_BAUDRATE=${INTERNAL_GPS_BAUDRATE}) add_definitions(-DPWR_BUTTON_${PWR_BUTTON}) add_definitions(-DCROSSFIRE_NATIVE) add_definitions(-DHARDWARE_EXTERNAL_MODULE) +if(USE_RTC_CLOCK) + message("-- RTC Clock enabled") + add_definitions(-DRTCLOCK) +endif() + if(WIRELESS_CHARGER) add_definitions(-DWIRELESS_CHARGER) endif() @@ -90,8 +136,6 @@ if(NOT UNEXPECTED_SHUTDOWN) add_definitions(-DNO_UNEXPECTED_SHUTDOWN) endif() -set(AFHDS3 ON) - # VCP CLI set(ENABLE_SERIAL_PASSTHROUGH ON CACHE BOOL "Enable serial passthrough") set(CLI ON CACHE BOOL "Enable CLI") @@ -100,8 +144,7 @@ set(TARGET_SRC_DIR targets/${TARGET_DIR}) set(BOARD_COMMON_SRC ${TARGET_SRC_DIR}/board.cpp - ${TARGET_SRC_DIR}/led_driver.cpp - ${TARGET_SRC_DIR}/key_driver.cpp + ${TARGET_SRC_DIR}/${KEY_DRIVER} ${TARGET_SRC_DIR}/haptic_driver.cpp ${TARGET_SRC_DIR}/backlight_driver.cpp ${TARGET_SRC_DIR}/${LCD_DRIVER} @@ -118,6 +161,19 @@ set(BOARD_COMMON_SRC drivers/frftl.cpp ) +if(ROTARY_ENCODER) + set(BOARD_COMMON_SRC ${BOARD_COMMON_SRC} + targets/common/arm/stm32/rotary_encoder_driver.cpp + ) +endif() + +if(DISK_CACHE) + set(BOARD_COMMON_SRC ${BOARD_COMMON_SRC} + disk_cache.cpp + ) + add_definitions(-DDISK_CACHE) +endif() + # Bootloader board library add_library(board_bl OBJECT EXCLUDE_FROM_ALL ${BOARD_COMMON_SRC} @@ -131,7 +187,6 @@ add_library(board OBJECT EXCLUDE_FROM_ALL ${BOARD_COMMON_SRC} ${TARGET_SRC_DIR}/${TOUCH_DRIVER} ${TARGET_SRC_DIR}/battery_driver.cpp - targets/common/arm/stm32/audio_dac_driver.cpp targets/common/arm/stm32/delays_driver.cpp targets/common/arm/stm32/heartbeat_driver.cpp targets/common/arm/stm32/mixer_scheduler_driver.cpp @@ -139,14 +194,30 @@ add_library(board OBJECT EXCLUDE_FROM_ALL targets/common/arm/stm32/stm32_pulse_driver.cpp targets/common/arm/stm32/stm32_softserial_driver.cpp targets/common/arm/stm32/stm32_switch_driver.cpp - targets/common/arm/stm32/stm32_ws2812.cpp targets/common/arm/stm32/trainer_driver.cpp targets/common/arm/stm32/spi_flash.cpp targets/common/arm/stm32/diskio_spi_flash.cpp - drivers/frftl.cpp + drivers/frftl.cpp ) set(FIRMWARE_SRC ${FIRMWARE_SRC} $) +if(PCBREV STREQUAL NB4P) + target_sources(board PRIVATE ${TARGET_SRC_DIR}/nb4p_switch_driver.cpp) +endif() + +if(USE_VS1053B) + target_sources(board PRIVATE targets/common/arm/stm32/vs1053b.cpp) +else() + target_sources(board PRIVATE targets/common/arm/stm32/audio_dac_driver.cpp) + add_definitions(-DSOFTWARE_VOLUME) +endif() + +if(LED_STRIP) + target_sources(board PRIVATE ${TARGET_SRC_DIR}/led_driver.cpp) + target_sources(board PRIVATE targets/common/arm/stm32/stm32_ws2812.cpp) +endif() + + set(FIRMWARE_SRC ${FIRMWARE_SRC} targets/common/arm/loadboot.cpp diff --git a/radio/src/targets/pl18/backlight_driver.cpp b/radio/src/targets/pl18/backlight_driver.cpp index 3f72815f64a..38216247b6e 100644 --- a/radio/src/targets/pl18/backlight_driver.cpp +++ b/radio/src/targets/pl18/backlight_driver.cpp @@ -40,13 +40,12 @@ void backlightInit() // PIN init gpio_init_af(BACKLIGHT_GPIO, BACKLIGHT_GPIO_AF, GPIO_PIN_SPEED_LOW); - // TODO review this when the timer will be chosen stm32_timer_enable_clock(BACKLIGHT_TIMER); BACKLIGHT_TIMER->ARR = 100; BACKLIGHT_TIMER->PSC = BACKLIGHT_TIMER_FREQ / 1000000 - 1; // 10kHz (same as FrOS) BACKLIGHT_TIMER->CCMR1 = TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1PE; // PWM mode 1 BACKLIGHT_TIMER->CCER = TIM_CCER_CC1E | TIM_CCER_CC1NE; - BACKLIGHT_TIMER->CCR1 = 100; // 100% on init + BACKLIGHT_TIMER->CCR1 = 0; BACKLIGHT_TIMER->EGR = TIM_EGR_UG; BACKLIGHT_TIMER->CR1 |= TIM_CR1_CEN; // Counter enable BACKLIGHT_TIMER->BDTR |= TIM_BDTR_MOE; @@ -68,6 +67,11 @@ void backlightEnable(uint8_t dutyCycle) lastDutyCycle = dutyCycle; } +void backlightFullOn() +{ + backlightEnable(BACKLIGHT_LEVEL_MAX); +} + void lcdOff() { backlightEnable(0); } diff --git a/radio/src/targets/pl18/battery_driver.cpp b/radio/src/targets/pl18/battery_driver.cpp index f0ad2a93eeb..399f2c0eddb 100644 --- a/radio/src/targets/pl18/battery_driver.cpp +++ b/radio/src/targets/pl18/battery_driver.cpp @@ -26,7 +26,7 @@ #define __BATTERY_DRIVER_C__ #define BATTERY_W 140 -#define BATTERY_H 200 +#define BATTERY_H (LCD_H - 120) #define BATTERY_TOP ((LCD_H - BATTERY_H)/2) #define BATTERY_CONNECTOR_W 32 #define BATTERY_CONNECTOR_H 10 @@ -273,7 +273,9 @@ void battery_charge_init() // USB charger control pins +#if defined(UCHARGER_EN_GPIO) gpio_init(UCHARGER_EN_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW); +#endif // USB charger state init ENABLE_UCHARGER(); @@ -296,6 +298,7 @@ void battery_charge_init() } void ledChargingInfo(uint16_t chargeState) { +#if defined(LED_STRIP_GPIO) static int ledIdx = 0; ledIdx--; if (ledIdx < 0) { @@ -309,6 +312,7 @@ void ledChargingInfo(uint16_t chargeState) { } } rgbLedColorApply(); +#endif } void drawChargingInfo(uint16_t chargeState) { @@ -416,11 +420,13 @@ void handle_battery_charge(uint32_t last_press_time) sprintf(buffer, "%d,%d,%d,%d,%d,", uCharger.isChargingDetectionReady, uCharger.isChargeEnd, IS_UCHARGER_CHARGE_END_ACTIVE(), uCharger.chargingSamplingCount, uCharger.chargeEndSamplingCount); lcd->drawSizedText(100, 40, buffer, strlen(buffer), CENTERED | COLOR_THEME_PRIMARY2); +#if defined(WIRELESS_CHARGER) sprintf(buffer, "%d,%d,%d,%d,%d", wCharger.isChargerDetectionReady, wCharger.hasCharger, IS_WCHARGER_ACTIVE(), wCharger.chargerSamplingCount, wCharger.isHighCurrent); lcd->drawSizedText(100, 70, buffer, strlen(buffer), CENTERED | COLOR_THEME_PRIMARY2); sprintf(buffer, "%d,%d,%d,%d,%d,", wCharger.isChargingDetectionReady, wCharger.isChargeEnd, IS_WCHARGER_CHARGE_END_ACTIVE(), wCharger.chargingSamplingCount, wCharger.chargeEndSamplingCount); lcd->drawSizedText(100, 100, buffer, strlen(buffer), CENTERED | COLOR_THEME_PRIMARY2); +#endif sprintf(buffer, "%d", isChargerActive()); lcd->drawSizedText(100, 130, buffer, strlen(buffer), CENTERED | COLOR_THEME_PRIMARY2); diff --git a/radio/src/targets/pl18/battery_driver.h b/radio/src/targets/pl18/battery_driver.h index 60460686c9f..a03ac70d6e6 100644 --- a/radio/src/targets/pl18/battery_driver.h +++ b/radio/src/targets/pl18/battery_driver.h @@ -42,11 +42,6 @@ enum ChargeState CHARGE_FINISHED }; -#define IS_UCHARGER_ACTIVE() gpio_read(UCHARGER_GPIO) ? 1 : 0 -#define IS_UCHARGER_CHARGE_END_ACTIVE() gpio_read(UCHARGER_CHARGE_END_GPIO) ? 1 : 0 -#define ENABLE_UCHARGER() gpio_set(UCHARGER_EN_GPIO) -#define DISABLE_UCHARGER() gpio_clear(UCHARGER_EN_GPIO) - #define IS_WCHARGER_ACTIVE() gpio_read(WCHARGER_GPIO) ? 1 : 0 #define IS_WCHARGER_CHARGE_END_ACTIVE() gpio_read(WCHARGER_CHARGE_END_GPIO) ? 1 : 0 #define ENABLE_WCHARGER() gpio_set(WCHARGER_EN_GPIO) diff --git a/radio/src/targets/pl18/board.cpp b/radio/src/targets/pl18/board.cpp index 0fcb42f0360..3d6b6eb9364 100644 --- a/radio/src/targets/pl18/board.cpp +++ b/radio/src/targets/pl18/board.cpp @@ -21,13 +21,7 @@ #include "stm32_adc.h" #include "stm32_gpio.h" - -#include "stm32_gpio_driver.h" #include "stm32_ws2812.h" -#include "boards/generic_stm32/rgb_leds.h" - -#include "board.h" -#include "boards/generic_stm32/module_ports.h" #include "hal/adc_driver.h" #include "hal/trainer_driver.h" @@ -36,13 +30,20 @@ #include "hal/watchdog_driver.h" #include "hal/usb_driver.h" #include "hal/gpio.h" +#include "hal/rotary_encoder.h" + +#include "board.h" +#include "boards/generic_stm32/module_ports.h" +#include "boards/generic_stm32/rgb_leds.h" #include "globals.h" #include "sdcard.h" #include "touch.h" #include "debug.h" -#include "flysky_gimbal_driver.h" +#if defined(FLYSKY_GIMBAL) + #include "flysky_gimbal_driver.h" +#endif #include "timers_driver.h" #include "battery_driver.h" @@ -56,9 +57,6 @@ // Common ADC driver extern const etx_hal_adc_driver_t _adc_driver; -// Common LED driver -extern const stm32_pulse_timer_t _led_timer; - #if defined(SEMIHOSTING) extern "C" void initialise_monitor_handles(); #endif @@ -67,6 +65,25 @@ extern "C" void initialise_monitor_handles(); extern "C" void flushFTL(); #endif +#if defined(RADIO_NV14_FAMILY) + HardwareOptions hardwareOptions; + + static uint8_t boardGetPcbRev() + { + gpio_init(INTMODULE_PWR_GPIO, GPIO_IN, GPIO_PIN_SPEED_LOW); + delay_ms(1); // delay to let the input settle, else it does not work properly + + // detect NV14 vs EL18 + if (gpio_read(INTMODULE_PWR_GPIO)) { + // pull-up connected: EL18 + return PCBREV_EL18; + } else { + // pull-down connected: NV14 + return PCBREV_NV14; + } + } +#endif + void delay_self(int count) { for (int i = 50000; i > 0; i--) @@ -75,6 +92,10 @@ void delay_self(int count) } } +#if defined(LED_STRIP_GPIO) +// Common LED driver +extern const stm32_pulse_timer_t _led_timer; + void ledStripOff() { for (uint8_t i = 0; i < LED_STRIP_LENGTH; i++) { @@ -82,11 +103,43 @@ void ledStripOff() } ws2812_update(&_led_timer); } +#endif + +#if defined(RADIO_NB4P) +void disableVoiceChip() +{ + gpio_init(VOICE_CHIP_EN_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW); + gpio_clear(VOICE_CHIP_EN_GPIO); +} +#endif void boardBLInit() { // USB charger status pins gpio_init(UCHARGER_GPIO, GPIO_IN, GPIO_PIN_SPEED_LOW); + +#if defined(USB_SW_GPIO) + gpio_init(USB_SW_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW); +#endif + +#if defined(RADIO_NV14_FAMILY) + // detect NV14 vs EL18 + hardwareOptions.pcbrev = boardGetPcbRev(); +#endif +} + +#if defined(RADIO_NB4P) +void boardBLPreJump() +{ + LL_ADC_Disable(ADC_MAIN); +} +#endif + +static void monitorInit() +{ +#if defined(VBUS_MONITOR_GPIO) + gpio_init(VBUS_MONITOR_GPIO, GPIO_IN, GPIO_PIN_SPEED_LOW); +#endif } void boardInit() @@ -109,13 +162,19 @@ void boardInit() board_trainer_init(); battery_charge_init(); - flysky_gimbal_init(); + + #if defined(FLYSKY_GIMBAL) + flysky_gimbal_init(); + #endif + timersInit(); touchPanelInit(); usbInit(); +#if defined(LED_STRIP_GPIO) ws2812_init(&_led_timer, LED_STRIP_LENGTH, WS2812_GRB); ledStripOff(); +#endif uint32_t press_start = 0; uint32_t press_end = 0; @@ -150,7 +209,14 @@ void boardInit() keysInit(); switchInit(); +#if defined(ROTARY_ENCODER_NAVIGATION) && !defined(USE_HATS_AS_KEYS) + rotaryEncoderInit(); +#endif +#if defined(RADIO_NB4P) + disableVoiceChip(); +#endif audioInit(); + monitorInit(); adcInit(&_adc_driver); hapticInit(); @@ -190,10 +256,11 @@ void boardOff() rtcDisableBackupReg(); #if !defined(BOOT) +#if defined(LED_STRIP_GPIO) ledStripOff(); +#endif if (isChargerActive()) { - delay_ms(100); // Add a delay to wait for lcdOff // RTC->BKP0R = SOFTRESET_REQUEST; NVIC_SystemReset(); } @@ -225,12 +292,14 @@ void boardOff() } } +#if !defined(RADIO_NV14_FAMILY) int usbPlugged() { static uint8_t debouncedState = 0; static uint8_t lastState = 0; - uint8_t state = gpio_read(UCHARGER_GPIO) ? 1 : 0; + uint8_t state = IS_UCHARGER_ACTIVE(); + if (state == lastState) debouncedState = state; else @@ -238,3 +307,4 @@ int usbPlugged() return debouncedState; } +#endif diff --git a/radio/src/targets/pl18/board.h b/radio/src/targets/pl18/board.h index d05b45a7b9e..4e2f28957ee 100644 --- a/radio/src/targets/pl18/board.h +++ b/radio/src/targets/pl18/board.h @@ -29,6 +29,10 @@ #include "hal/serial_port.h" #include "hal/watchdog_driver.h" +#if defined(ADC_GPIO_PIN_STICK_TH) +#define SURFACE_RADIO true +#endif + #define FLASHSIZE 0x200000 #define FLASH_PAGESIZE 256 #define BOOTLOADER_SIZE 0x20000 @@ -55,14 +59,49 @@ void boardOff(); #define LEN_CPU_UID (3*8+2) void getCPUUniqueID(char * s); +#if defined(RADIO_NV14_FAMILY) + enum { + PCBREV_NV14 = 0, + PCBREV_EL18 = 1, + }; + + typedef struct { + uint8_t pcbrev; + } HardwareOptions; + + extern HardwareOptions hardwareOptions; +#endif + // SDRAM driver extern "C" void SDRAM_Init(); // Pulses driver #if !defined(SIMU) -#define INTERNAL_MODULE_ON() gpio_set(INTMODULE_PWR_GPIO) -#define INTERNAL_MODULE_OFF() gpio_clear(INTMODULE_PWR_GPIO); +#if defined(RADIO_NV14_FAMILLY) + #define INTERNAL_MODULE_OFF() \ + do { \ + if (hardwareOptions.pcbrev == PCBREV_NV14) \ + gpio_set(INTMODULE_PWR_GPIO); \ + else \ + gpio_clear(INTMODULE_PWR_GPIO); \ + } while (0) + + #define INTERNAL_MODULE_ON() \ + do { \ + if (hardwareOptions.pcbrev == PCBREV_NV14) \ + gpio_clear(INTMODULE_PWR_GPIO); \ + else \ + gpio_set(INTMODULE_PWR_GPIO); \ + } while (0) +#elif defined(RADIO_NB4P) + #define INTERNAL_MODULE_ON() gpio_clear(INTMODULE_PWR_GPIO) + #define INTERNAL_MODULE_OFF() gpio_set(INTMODULE_PWR_GPIO); +#else + #define INTERNAL_MODULE_ON() gpio_set(INTMODULE_PWR_GPIO) + #define INTERNAL_MODULE_OFF() gpio_clear(INTMODULE_PWR_GPIO); +#endif + #define EXTERNAL_MODULE_ON() gpio_set(EXTMODULE_PWR_GPIO) #define EXTERNAL_MODULE_OFF() gpio_clear(EXTMODULE_PWR_GPIO) #define EXTERNAL_MODULE_PWR_OFF EXTERNAL_MODULE_OFF @@ -71,7 +110,7 @@ extern "C" void SDRAM_Init(); #define IS_INTERNAL_MODULE_ON() (false) #define IS_EXTERNAL_MODULE_ON() (gpio_read(EXTMODULE_PWR_GPIO) ? 1 : 0) -#else +#else // defined(SIMU) #define INTERNAL_MODULE_OFF() #define INTERNAL_MODULE_ON() @@ -91,10 +130,23 @@ extern "C" void SDRAM_Init(); #define NUM_TRIMS 8 #define DEFAULT_STICK_DEADZONE 2 -#define BATTERY_WARN 37 // 3.7V -#define BATTERY_MIN 35 // 3.4V -#define BATTERY_MAX 43 // 4.3V -#define BATTERY_DIVIDER 962 +#if defined(RADIO_NV14_FAMILY) + #define BATTERY_WARN 36 // 3.6V + #define BATTERY_MIN 35 // 3.5V + #define BATTERY_MAX 42 // 4.2V +#else + #define BATTERY_WARN 37 // 3.7V + #define BATTERY_MIN 35 // 3.4V + #define BATTERY_MAX 43 // 4.3V +#endif + +#if defined(RADIO_NV14_FAMILY) + #define BATTERY_DIVIDER 3102 // = 2047 * 510k / (510k + 510k) * 10 / 3.3V +#elif defined(RADIO_NB4P) + #define BATTERY_DIVIDER 3102 // = 2047 * 10k / (10k + 10k) * 10 / 3.3V +#else + #define BATTERY_DIVIDER 962 // = 2047 * 22k / (120k + 22k) * 10 / 3.3V +#endif #if defined(__cplusplus) && !defined(SIMU) extern "C" { @@ -173,6 +225,31 @@ bool isBacklightEnabled(); } #endif +#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) + #define IS_UCHARGER_ACTIVE() gpio_read(UCHARGER_GPIO) ? (gpio_read(UCHARGER_CHARGE_END_GPIO) ? 0 : 1) : 1 +#else + #define IS_UCHARGER_ACTIVE() gpio_read(UCHARGER_GPIO) ? 1 : 0 +#endif + +#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) + #define IS_UCHARGER_CHARGE_END_ACTIVE() gpio_read(UCHARGER_CHARGE_END_GPIO) ? 0 : 1 +#else + #define IS_UCHARGER_CHARGE_END_ACTIVE() gpio_read(UCHARGER_CHARGE_END_GPIO) ? 1 : 0 +#endif + +#if defined(UCHARGER_EN_GPIO) + #if defined(RADIO_NV14_FAMILY) + #define ENABLE_UCHARGER() gpio_clear(UCHARGER_EN_GPIO) + #define DISABLE_UCHARGER() gpio_set(UCHARGER_EN_GPIO) + #else + #define ENABLE_UCHARGER() gpio_set(UCHARGER_EN_GPIO) + #define DISABLE_UCHARGER() gpio_clear(UCHARGER_EN_GPIO) + #endif +#else + #define ENABLE_UCHARGER() + #define DISABLE_UCHARGER() +#endif + // Audio driver void audioInit(); void audioConsumeCurrentBuffer(); @@ -197,11 +274,13 @@ bool audioChipReset(); #define audioDisableIrq() // interrupts must stay enabled on Horus #define audioEnableIrq() // interrupts must stay enabled on Horus -#if defined(PCBNV14) -#define setSampleRate(freq) + +#if defined(AUDIO_SPI) + #define setSampleRate(freq) #else -void setSampleRate(uint32_t frequency); + void setSampleRate(uint32_t frequency); #endif + void setScaledVolume(uint8_t volume); void setVolume(uint8_t volume); int32_t getVolume(); diff --git a/radio/src/targets/pl18/bootloader/boot_menu.cpp b/radio/src/targets/pl18/bootloader/boot_menu.cpp index c2b578b504b..151bf7c4226 100644 --- a/radio/src/targets/pl18/bootloader/boot_menu.cpp +++ b/radio/src/targets/pl18/bootloader/boot_menu.cpp @@ -19,6 +19,9 @@ * GNU General Public License for more details. */ +#include "hal/gpio.h" +#include "stm32_gpio.h" + #include "board.h" #include "fw_version.h" #include "lcd.h" @@ -30,6 +33,8 @@ #include +#define RADIO_MENU_LEN 2 + #define SELECTED_COLOR (INVERS | COLOR_THEME_SECONDARY1) #define DEFAULT_PADDING 28 #define DOUBLE_PADDING 56 @@ -53,10 +58,18 @@ LZ4BitmapBuffer BMP_USB_PLUGGED(BMP_ARGB4444, (LZ4Bitmap*)__bmp_usb_plugged); extern BitmapBuffer * lcd; +#if defined(USB_SW_GPIO) + #define USB_SW_TO_INTERNAL_MODULE() gpio_set(USB_SW_GPIO); + #define USB_SW_TO_MCU() gpio_clear(USB_SW_GPIO); + static bool rfUsbAccess = false; +#endif + void bootloaderInitScreen() { lcdInitDisplayDriver(); +#if defined(USE_HATS_AS_KEYS) setHatsAsKeys(true); +#endif } static void bootloaderDrawTitle(const char* text) @@ -67,7 +80,10 @@ static void bootloaderDrawTitle(const char* text) static void bootloaderDrawFooter() { + if (LCD_W > LCD_H) lcd->drawSolidFilledRect(DEFAULT_PADDING, LCD_H - (DEFAULT_PADDING + 10), LCD_W - DOUBLE_PADDING, 2, BL_FOREGROUND); + else + lcd->drawSolidFilledRect(DEFAULT_PADDING, LCD_H - (DOUBLE_PADDING + 4), LCD_W - DOUBLE_PADDING, 2, BL_FOREGROUND); } static void bootloaderDrawBackground() @@ -87,34 +103,53 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) } int center = LCD_W/2; + int menuItemX = center - 120; if (st == ST_START) { + int y = 75; bootloaderDrawTitle(BOOTLOADER_TITLE); - lcd->drawText(102, 75, LV_SYMBOL_CHARGE, BL_FOREGROUND); - coord_t pos = lcd->drawText(124, 75, TR_BL_WRITE_FW, BL_FOREGROUND); + lcd->drawText(menuItemX + 2, y, LV_SYMBOL_CHARGE, BL_FOREGROUND); + coord_t pos = lcd->drawText(menuItemX + 24, y, TR_BL_WRITE_FW, BL_FOREGROUND); pos += 8; + coord_t npos; + y += 35; #if defined(SPI_FLASH) - lcd->drawText(102, 110, LV_SYMBOL_SD_CARD, BL_FOREGROUND); - pos = lcd->drawText(124, 110, TR_BL_ERASE_FLASH, BL_FOREGROUND); - pos += 8; - - lcd->drawText(100, 145, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); - lcd->drawText(124, 145, TR_BL_EXIT, BL_FOREGROUND); -#else - lcd->drawText(100, 110, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); - lcd->drawText(124, 110, TR_BL_EXIT, BL_FOREGROUND); + lcd->drawText(menuItemX + 2, y, LV_SYMBOL_SD_CARD, BL_FOREGROUND); + npos = lcd->drawText(menuItemX + 24, y, TR_BL_ERASE_FLASH, BL_FOREGROUND); + npos += 8; + if (npos > pos) + pos = npos; + y += 35; +#endif +#if defined(USB_SW_GPIO) + lcd->drawText(menuItemX, y, LV_SYMBOL_WIFI, BL_FOREGROUND); + npos = lcd->drawText(menuItemX + 24, y, TR_BL_RF_USB_ACCESS, BL_FOREGROUND); + npos += 8; + if (npos > pos) + pos = npos; + y += 35; #endif + lcd->drawText(menuItemX, y, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); + lcd->drawText(menuItemX + 24, y, TR_BL_EXIT, BL_FOREGROUND); - pos -= 92; - lcd->drawSolidRect(92, 72 + (opt * 35), pos, 26, 2, BL_SELECTED); - - lcd->drawBitmap(60, 214, (const BitmapBuffer*)&BMP_PLUG_USB); - lcd->drawText(195, 223, TR_BL_USB_PLUGIN, BL_FOREGROUND); - lcd->drawText(195, 248, TR_BL_USB_MASS_STORE, BL_FOREGROUND); + pos -= menuItemX - 8; + lcd->drawSolidRect(menuItemX - 8, 72 + (opt * 35), pos, 26, 2, BL_SELECTED); + + if (LCD_W > LCD_H) { + lcd->drawBitmap(menuItemX - 40, LCD_H - 106, (const BitmapBuffer*)&BMP_PLUG_USB); + lcd->drawText(menuItemX + 95, LCD_H - 97, TR_BL_USB_PLUGIN, BL_FOREGROUND); + lcd->drawText(menuItemX + 95, LCD_H - 72, TR_BL_USB_MASS_STORE, BL_FOREGROUND); + } else { + lcd->drawBitmap(center - 55, LCD_H - DEFAULT_PADDING - 157, (const BitmapBuffer*)&BMP_PLUG_USB); + lcd->drawText(center, LCD_H - DEFAULT_PADDING - 97, TR_BL_USB_PLUGIN, CENTERED | BL_FOREGROUND); + lcd->drawText(center, LCD_H - DEFAULT_PADDING - 72, TR_BL_USB_MASS_STORE, CENTERED | BL_FOREGROUND); + } bootloaderDrawFooter(); + if (LCD_W < LCD_H) + lcd->drawText(center, LCD_H - DOUBLE_PADDING, TR_BL_CURRENT_FW, CENTERED | BL_FOREGROUND); lcd->drawText(center, LCD_H - DEFAULT_PADDING, getFirmwareVersion(), CENTERED | BL_FOREGROUND); } #if defined(SPI_FLASH) @@ -122,21 +157,28 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) bootloaderDrawTitle(TR_BL_ERASE_INT_FLASH); - lcd->drawText(102, 75, LV_SYMBOL_SD_CARD, BL_FOREGROUND); - coord_t pos = lcd->drawText(124, 75, TR_BL_ERASE_FLASH, BL_FOREGROUND); + lcd->drawText(menuItemX + 2, 75, LV_SYMBOL_SD_CARD, BL_FOREGROUND); + coord_t pos = lcd->drawText(menuItemX + 24, 75, TR_BL_ERASE_FLASH, BL_FOREGROUND); pos += 8; - lcd->drawText(100, 110, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); - lcd->drawText(124, 110, TR_BL_EXIT, BL_FOREGROUND); + lcd->drawText(menuItemX, 110, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); + lcd->drawText(menuItemX + 24, 110, TR_BL_EXIT, BL_FOREGROUND); - pos -= 92; - lcd->drawSolidRect(92, 72 + (opt * 35), pos, 26, 2, BL_SELECTED); + pos -= menuItemX - 8; + lcd->drawSolidRect(menuItemX - 8, 72 + (opt * 35), pos, 26, 2, BL_SELECTED); bootloaderDrawFooter(); - lcd->drawText(DEFAULT_PADDING, LCD_H - DEFAULT_PADDING, - LV_SYMBOL_SD_CARD TR_BL_ERASE_KEY, BL_FOREGROUND); - lcd->drawText(305, LCD_H - DEFAULT_PADDING, - LV_SYMBOL_NEW_LINE TR_BL_EXIT_KEY, BL_FOREGROUND); + if (LCD_W > LCD_H) { + lcd->drawText(DEFAULT_PADDING, LCD_H - DEFAULT_PADDING, + LV_SYMBOL_SD_CARD " " TR_BL_ERASE_KEY, BL_FOREGROUND); + lcd->drawText(LCD_W - 175, LCD_H - DEFAULT_PADDING, + LV_SYMBOL_NEW_LINE " " TR_BL_EXIT_KEY, BL_FOREGROUND); + } else { + lcd->drawText(DOUBLE_PADDING, LCD_H - DOUBLE_PADDING, + LV_SYMBOL_SD_CARD " " TR_BL_ERASE_KEY, BL_FOREGROUND); + lcd->drawText(DOUBLE_PADDING, LCD_H - DEFAULT_PADDING, + LV_SYMBOL_NEW_LINE " " TR_BL_EXIT_KEY, BL_FOREGROUND); + } } else if (st == ST_CLEAR_FLASH) { bootloaderDrawTitle(TR_BL_ERASE_INT_FLASH); @@ -145,7 +187,21 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) bootloaderDrawFooter(); } #endif +#if defined(USB_SW_GPIO) + else if (st == ST_RADIO_MENU) { + bootloaderDrawTitle(TR_BL_RF_USB_ACCESS); + + lcd->drawText(menuItemX + 2, 75, LV_SYMBOL_USB, BL_FOREGROUND); + coord_t pos = lcd->drawText(menuItemX + 24, 75, rfUsbAccess ? TR_BL_DISABLE : TR_BL_ENABLE, BL_FOREGROUND); + pos += 8; + lcd->drawText(menuItemX + 2, 110, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); + lcd->drawText(menuItemX + 24, 110, TR_BL_EXIT, BL_FOREGROUND); + + pos -= menuItemX - 8; + lcd->drawSolidRect(menuItemX - 8, 72 + (opt * 35), pos, 26, 2, BL_SELECTED); + } +#endif else if (st == ST_USB) { lcd->drawBitmap(center - 26, 98, (const BitmapBuffer*)&BMP_USB_PLUGGED); lcd->drawText(center, 168, TR_BL_USB_CONNECTED, CENTERED | BL_FOREGROUND); @@ -219,24 +275,32 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) if (st != ST_DIR_CHECK && (st != ST_FLASH_CHECK || opt == FC_OK)) { + int padding = DOUBLE_PADDING; + if (LCD_W > LCD_H) + padding = DEFAULT_PADDING; if (st == ST_FILE_LIST) { - lcd->drawText(DEFAULT_PADDING, LCD_H - DEFAULT_PADDING, - LV_SYMBOL_CHARGE TR_BL_SELECT_KEY, BL_FOREGROUND); + lcd->drawText(padding, LCD_H - padding, + LV_SYMBOL_CHARGE " " TR_BL_SELECT_KEY, BL_FOREGROUND); } else if (st == ST_FLASH_CHECK && opt == FC_OK) { - lcd->drawText(DEFAULT_PADDING, LCD_H - DEFAULT_PADDING, - LV_SYMBOL_CHARGE TR_BL_FLASH_KEY, BL_FOREGROUND); + lcd->drawText(padding, LCD_H - padding, + LV_SYMBOL_CHARGE " " TR_BL_FLASH_KEY, BL_FOREGROUND); } else if (st == ST_FLASHING) { - lcd->drawText(DEFAULT_PADDING, LCD_H - DEFAULT_PADDING, - LV_SYMBOL_CHARGE TR_BL_WRITING_FW, BL_FOREGROUND); + lcd->drawText(padding, LCD_H - padding, + LV_SYMBOL_CHARGE " " TR_BL_WRITING_FW, BL_FOREGROUND); } else if (st == ST_FLASH_DONE) { - lcd->drawText(DEFAULT_PADDING, LCD_H - DEFAULT_PADDING, - LV_SYMBOL_CHARGE TR_BL_WRITING_COMPL, BL_FOREGROUND); + lcd->drawText(padding, LCD_H - padding, + LV_SYMBOL_CHARGE " " TR_BL_WRITING_COMPL, BL_FOREGROUND); } } if (st != ST_FLASHING) { - lcd->drawText(305, LCD_H - DEFAULT_PADDING, - LV_SYMBOL_NEW_LINE TR_BL_EXIT_KEY, BL_FOREGROUND); + if (LCD_W > LCD_H) { + lcd->drawText(LCD_W - 175, LCD_H - DEFAULT_PADDING, + LV_SYMBOL_NEW_LINE " " TR_BL_EXIT_KEY, BL_FOREGROUND); + } else { + lcd->drawText(DOUBLE_PADDING, LCD_H - DEFAULT_PADDING, + LV_SYMBOL_NEW_LINE " " TR_BL_EXIT_KEY, BL_FOREGROUND); + } } } _first_screen = false; @@ -254,16 +318,57 @@ void bootloaderDrawFilename(const char* str, uint8_t line, bool selected) } uint32_t bootloaderGetMenuItemCount(int baseCount) { +#if defined(USB_SW_GPIO) + return baseCount+1; +#else return baseCount; +#endif } bool bootloaderRadioMenu(uint32_t menuItem, event_t event) { +#if defined(USB_SW_GPIO) + static int pos = 0; + + if (event == EVT_KEY_FIRST(KEY_DOWN)) { + if (pos < RADIO_MENU_LEN-1) + pos++; + } else if (event == EVT_KEY_FIRST(KEY_UP)) { + if (pos > 0) + pos--; + } else if (event == EVT_KEY_BREAK(KEY_ENTER)) { + switch (pos) { + case 0: + if (rfUsbAccess) + { + rfUsbAccess = false; + INTERNAL_MODULE_OFF(); + USB_SW_TO_MCU(); + } else { + rfUsbAccess = true; + INTERNAL_MODULE_ON(); + USB_SW_TO_INTERNAL_MODULE(); + } + break; + case 1: // fall through + default: + USB_SW_TO_MCU(); + pos = 0; + return true; + } + } + bootloaderDrawScreen(ST_RADIO_MENU, pos, nullptr); + return false; +#else return true; +#endif } void blExit(void) { +#if defined(USB_SW_GPIO) + USB_SW_TO_MCU(); +#endif lcdClear(); lcdRefresh(); lcdRefreshWait(); diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index c5c47c9594e..c259bc74e5c 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -51,6 +51,191 @@ // PL18/PL18EV only has virtual keys via trim buttons // #define KEYS_GPIO_PIN_PGUP /* for activating PGUP in keys diagnose screen */ +#if defined(RADIO_NV14_FAMILY) + // Trims + #define TRIMS_GPIO_REG_RHL GPIOD + #define TRIMS_GPIO_PIN_RHL LL_GPIO_PIN_7 // PD.07 + #define TRIMS_GPIO_REG_RHR GPIOG + #define TRIMS_GPIO_PIN_RHR LL_GPIO_PIN_10 // PG.10 + #define TRIMS_GPIO_REG_RVD GPIOJ + #define TRIMS_GPIO_PIN_RVD LL_GPIO_PIN_0 // PJ.00 + #define TRIMS_GPIO_REG_RVU GPIOB + #define TRIMS_GPIO_PIN_RVU LL_GPIO_PIN_15 // PB.15 + + #define TRIMS_GPIO_REG_LHL GPIOH + #define TRIMS_GPIO_PIN_LHL LL_GPIO_PIN_2 // PH.02 + #define TRIMS_GPIO_REG_LHR GPIOG + #define TRIMS_GPIO_PIN_LHR LL_GPIO_PIN_2 // PG.02 + #define TRIMS_GPIO_REG_LVU GPIOH + #define TRIMS_GPIO_PIN_LVU LL_GPIO_PIN_7 // PH.07 + #define TRIMS_GPIO_REG_LVD GPIOJ + #define TRIMS_GPIO_PIN_LVD LL_GPIO_PIN_12 // PJ.12 + + // Keys + #define KEYS_GPIO_REG_ENTER GPIOC + #define KEYS_GPIO_PIN_ENTER LL_GPIO_PIN_13 // PC.13 + #define KEYS_GPIO_REG_EXIT GPIOG + #define KEYS_GPIO_PIN_EXIT LL_GPIO_PIN_11 // PG.11 + + // Monitor pin + #define VBUS_MONITOR_GPIO GPIO_PIN(GPIOJ, 14) // PJ.14 + +// Switches +#define HARDWARE_SWITCH_A +#define STORAGE_SWITCH_A +#define HARDWARE_SWITCH_B +#define STORAGE_SWITCH_B +#define HARDWARE_SWITCH_C +#define STORAGE_SWITCH_C +#define HARDWARE_SWITCH_D +#define STORAGE_SWITCH_D +#define HARDWARE_SWITCH_E +#define STORAGE_SWITCH_E +#define HARDWARE_SWITCH_F +#define STORAGE_SWITCH_F +#define HARDWARE_SWITCH_G +#define STORAGE_SWITCH_G +#define HARDWARE_SWITCH_H +#define STORAGE_SWITCH_H + +// Index of all switches / trims +#define KEYS_GPIO_ACTIVE_HIGH +#define TRIMS_GPIO_ACTIVE_HIGH + + // ADC + + #define ADC_GPIO_PIN_STICK_LH LL_GPIO_PIN_2 // PA.02 + #define ADC_GPIO_PIN_STICK_LV LL_GPIO_PIN_3 // PA.03 + #define ADC_GPIO_PIN_STICK_RH LL_GPIO_PIN_4 // PA.04 + #define ADC_GPIO_PIN_STICK_RV LL_GPIO_PIN_5 // PA.05 + + #define ADC_GPIO_PIN_POT1 LL_GPIO_PIN_6 // PA.06 VRA + #define ADC_GPIO_PIN_POT2 LL_GPIO_PIN_4 // PC.04 VRB + #define ADC_GPIO_PIN_SWA LL_GPIO_PIN_1 // PB.01 + #define ADC_GPIO_PIN_SWB LL_GPIO_PIN_8 // PF.08 + #define ADC_GPIO_PIN_SWC LL_GPIO_PIN_0 // PB.00 + #define ADC_GPIO_PIN_SWD LL_GPIO_PIN_10 // PF.10 + #define ADC_GPIO_PIN_SWE LL_GPIO_PIN_0 // PC.00 + #define ADC_GPIO_PIN_SWF LL_GPIO_PIN_1 // PC.01 + #define ADC_GPIO_PIN_SWG LL_GPIO_PIN_2 // PC.02 + #define ADC_GPIO_PIN_SWH LL_GPIO_PIN_7 // PA.07 + + #define ADC_GPIO_PIN_BATT LL_GPIO_PIN_5 // PC.05 + + #define ADC_GPIOA_PINS (ADC_GPIO_PIN_STICK_LH | ADC_GPIO_PIN_STICK_LV | ADC_GPIO_PIN_STICK_RV | ADC_GPIO_PIN_STICK_RH \ + | ADC_GPIO_PIN_POT1 | ADC_GPIO_PIN_SWH) + #define ADC_GPIOB_PINS (ADC_GPIO_PIN_SWA | ADC_GPIO_PIN_SWC) + #define ADC_GPIOC_PINS (ADC_GPIO_PIN_POT2 | ADC_GPIO_PIN_SWE | ADC_GPIO_PIN_SWF | ADC_GPIO_PIN_SWG | ADC_GPIO_PIN_BATT) + #define ADC_GPIOF_PINS (ADC_GPIO_PIN_SWB | ADC_GPIO_PIN_SWD) + + #define ADC_CHANNEL_STICK_LH LL_ADC_CHANNEL_2 // ADC123_IN2 -> ADC1_IN2 + #define ADC_CHANNEL_STICK_LV LL_ADC_CHANNEL_3 // ADC123_IN3 -> ADC1_IN3 + #define ADC_CHANNEL_STICK_RH LL_ADC_CHANNEL_4 // ADC12_IN4 -> ADC1_IN4 + #define ADC_CHANNEL_STICK_RV LL_ADC_CHANNEL_5 // ADC12_IN5 -> ADC1_IN5 + + #define ADC_CHANNEL_POT1 LL_ADC_CHANNEL_6 // ADC12_IN6 -> ADC1_IN6 + #define ADC_CHANNEL_POT2 LL_ADC_CHANNEL_14 // ADC12_IN14 -> ADC1_IN14 + #define ADC_CHANNEL_SWA LL_ADC_CHANNEL_9 // ADC12_IN9 -> ADC1_IN9 + #define ADC_CHANNEL_SWB LL_ADC_CHANNEL_6 // ADC3_IN6 -> ADC3_IN6 + #define ADC_CHANNEL_SWC LL_ADC_CHANNEL_8 // ADC12_IN8 -> ADC1_IN8 + #define ADC_CHANNEL_SWD LL_ADC_CHANNEL_8 // ADC3_IN8 -> ADC3_IN8 + #define ADC_CHANNEL_SWE LL_ADC_CHANNEL_10 // ADC123_IN10-> ADC1_IN10 + #define ADC_CHANNEL_SWF LL_ADC_CHANNEL_11 // ADC123_IN11-> ADC1_IN11 + #define ADC_CHANNEL_SWG LL_ADC_CHANNEL_12 // ADC123_IN12-> ADC1_IN12 + #define ADC_CHANNEL_SWH LL_ADC_CHANNEL_7 // ADC12_IN7 -> ADC1_IN7 + + #define ADC_CHANNEL_BATT LL_ADC_CHANNEL_15 // ADC12_IN15 -> ADC1_IN15 + #define ADC_CHANNEL_RTC_BAT LL_ADC_CHANNEL_VBAT // ADC1_IN18 + + #define ADC_MAIN ADC1 + #define ADC_EXT ADC3 + #define ADC_EXT_CHANNELS { ADC_CHANNEL_SWB, ADC_CHANNEL_SWD } + #define ADC_SAMPTIME LL_ADC_SAMPLINGTIME_28CYCLES + #define ADC_DMA DMA2 + #define ADC_DMA_CHANNEL LL_DMA_CHANNEL_0 + #define ADC_DMA_STREAM LL_DMA_STREAM_4 + #define ADC_DMA_STREAM_IRQ DMA2_Stream4_IRQn + #define ADC_DMA_STREAM_IRQHandler DMA2_Stream4_IRQHandler + + #define ADC_EXT_DMA DMA2 + #define ADC_EXT_DMA_CHANNEL LL_DMA_CHANNEL_2 + #define ADC_EXT_DMA_STREAM LL_DMA_STREAM_0 + #define ADC_EXT_DMA_STREAM_IRQ DMA2_Stream0_IRQn + #define ADC_EXT_DMA_STREAM_IRQHandler DMA2_Stream0_IRQHandler + #define ADC_EXT_SAMPTIME LL_ADC_SAMPLINGTIME_28CYCLES + #define ADC_VREF_PREC2 660 + + #define ADC_DIRECTION \ + { 0 /*STICK1*/, 0 /*STICK2*/, 0 /*STICK3*/, 0 /*STICK4*/, \ + -1 /*POT1*/, 0 /*POT2*/, 0 /*TX_VOLTAGE*/, 0 /*TX_VBAT*/, \ + 0 /*SWA*/, 0 /*SWB*/, 0 /*SWC*/, 0 /*SWD*/, 0 /*SWE*/, \ + -1 /*SWF*/, -1 /*SWG*/, 0 /*SWH*/ \ + } + +#elif defined(RADIO_NB4P) + // Trims + #define TRIMS_GPIO_REG_T1L + #define TRIMS_GPIO_PIN_T1L + #define TRIMS_GPIO_REG_T1R + #define TRIMS_GPIO_PIN_T1R + #define TRIMS_GPIO_REG_T2L + #define TRIMS_GPIO_PIN_T2L + #define TRIMS_GPIO_REG_T2R + #define TRIMS_GPIO_PIN_T2R + + // Switches + #define SWITCHES_A_2POS + #define SWITCHES_B_2POS + + // Keys + #define KEYS_GPIO_PIN_ENTER + #define KEYS_GPIO_REG_ENTER + #define KEYS_GPIO_PIN_EXIT + #define KEYS_GPIO_REG_EXIT + + #define ADC_GPIO_PIN_STICK_TH LL_GPIO_PIN_3 // PA.03 + #define ADC_GPIO_PIN_STICK_ST LL_GPIO_PIN_2 // PA.02 + #define ADC_CHANNEL_STICK_TH LL_ADC_CHANNEL_3 // ADC123_IN3 -> ADC1_IN3 + #define ADC_CHANNEL_STICK_ST LL_ADC_CHANNEL_2 // ADC123_IN2 -> ADC1_IN2 + #define ADC_GPIO_RAW1 GPIOC + #define ADC_GPIO_PIN_POT1 LL_GPIO_PIN_2 // PC.02 + #define ADC_GPIO_PIN_POT2 LL_GPIO_PIN_7 // PA.07 + #define ADC_GPIO_PIN_RAW1 LL_GPIO_PIN_1 // PC.01 (SW1) + #define ADC_GPIO_PIN_RAW2 LL_GPIO_PIN_0 // PC.00 (SW2 SW3) + #define ADC_GPIO_PIN_RAW3 LL_GPIO_PIN_6 // PA.06 (TR1) + #define ADC_GPIO_PIN_RAW4 LL_GPIO_PIN_4 // PC.04 (TR2) + #define ADC_GPIO_PIN_BATT LL_GPIO_PIN_5 // PC.05 + #define ADC_CHANNEL_POT1 LL_ADC_CHANNEL_12 // ADC123_IN12 -> ADC1_IN12 + #define ADC_CHANNEL_POT2 LL_ADC_CHANNEL_7 // ADC12_IN7 -> ADC1_IN7 + #define ADC_CHANNEL_RAW1 LL_ADC_CHANNEL_11 // ADC123_IN11 -> ADC1_IN11 + #define ADC_CHANNEL_RAW2 LL_ADC_CHANNEL_10 // ADC123_IN10 -> ADC1_IN10 + #define ADC_CHANNEL_RAW3 LL_ADC_CHANNEL_6 // ADC12_IN6 -> ADC1_IN6 + #define ADC_CHANNEL_RAW4 LL_ADC_CHANNEL_14 // ADC12_IN14 -> ADC1_IN14 + #define ADC_CHANNEL_BATT LL_ADC_CHANNEL_15 // ADC12_IN15 -> ADC1_IN15 + #define ADC_CHANNEL_RTC_BAT LL_ADC_CHANNEL_VBAT // ADC1_IN18 + #define ADC_GPIOA_PINS (ADC_GPIO_PIN_STICK_TH | ADC_GPIO_PIN_STICK_ST | ADC_GPIO_PIN_POT2 | ADC_GPIO_PIN_RAW3) + #define ADC_GPIOC_PINS (ADC_GPIO_PIN_RAW1 | ADC_GPIO_PIN_RAW2 | ADC_GPIO_PIN_POT1 | ADC_GPIO_PIN_RAW4 | ADC_GPIO_PIN_BATT) + + #define ADC_MAIN ADC1 + #define ADC_SAMPTIME LL_ADC_SAMPLINGTIME_28CYCLES + #define ADC_DMA DMA2 + #define ADC_DMA_CHANNEL LL_DMA_CHANNEL_0 + #define ADC_DMA_STREAM LL_DMA_STREAM_4 + #define ADC_DMA_STREAM_IRQ DMA2_Stream4_IRQn + #define ADC_DMA_STREAM_IRQHandler DMA2_Stream4_IRQHandler + + #define ADC_VREF_PREC2 660 + + #define ADC_DIRECTION { \ + 0,0, /* gimbals */ \ + 0,0, /* pots */ \ + 0,0,0,0, /* raw1-4 */ \ + 0, /* vbat */ \ + 0 /* rtc_bat */ \ + } + +#else // !defined(RADIO_NB4P) && !defined(RADIO_NV14_FAMILY) + // Trims #define TRIMS_GPIO_REG_LHL #define TRIMS_GPIO_PIN_LHL @@ -303,16 +488,26 @@ } #endif +#endif + // Power -#define PWR_SWITCH_GPIO GPIO_PIN(GPIOI, 11) // PI.11 -#define PWR_ON_GPIO GPIO_PIN(GPIOI, 14) // PI.14 +#define PWR_SWITCH_GPIO GPIO_PIN(GPIOI, 11) // PI.11 +#define PWR_ON_GPIO GPIO_PIN(GPIOI, 14) // PI.14 // Chargers (USB and wireless) -#define UCHARGER_GPIO GPIO_PIN(GPIOB, 14) // PB.14 input - -#define UCHARGER_CHARGE_END_GPIO GPIO_PIN(GPIOB, 13) // PB.13 input - -#define UCHARGER_EN_GPIO GPIO_PIN(GPIOG, 3) // PG.03 output +#define UCHARGER_GPIO GPIO_PIN(GPIOB, 14) // PB.14 input +#define UCHARGER_CHARGE_END_GPIO GPIO_PIN(GPIOB, 13) // PB.13 input +//#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) +// #define UCHARGER_GPIO_INV +// #define UCHARGER_CHARGE_END_GPIO_INV +//#endif + +#if defined(RADIO_PL18) || defined(RADIO_PL18EV) + #define UCHARGER_EN_GPIO GPIO_PIN(GPIOG, 3) // PG.03 output +#elif defined(RADIO_NV14_FAMILY) + #define UCHARGER_EN_GPIO GPIO_PIN(GPIOH, 11) // PH.11 output +// #define UCHARGER_EN_GPIO_INV +#endif #if defined (WIRELESS_CHARGER) #define WCHARGER_GPIO GPIO_PIN(GPIOI, 9) // PI.09 input @@ -391,11 +586,15 @@ // USB #define USB_RCC_AHB1Periph_GPIO RCC_AHB1Periph_GPIOA #define USB_GPIO GPIOA -// #define USB_GPIO_VBUS GPIO_PIN(GPIOA,9) // PA.09 #define USB_GPIO_DM GPIO_PIN(GPIOA, 11) // PA.11 #define USB_GPIO_DP GPIO_PIN(GPIOA, 12) // PA.12 #define USB_GPIO_AF GPIO_AF10 +#if defined(RADIO_NV14_FAMILY) +#define USB_GPIO_VBUS GPIO_PIN(GPIOA, 9) // PA.09 +#define USB_SW_GPIO GPIO_PIN(GPIOI, 10) // PI.10 +#endif + // LCD #define LCD_NRST_GPIO GPIO_PIN(GPIOG, 9) // PG.09 #define LCD_SPI_CS_GPIO GPIO_PIN(GPIOE, 4) // PE.04 @@ -408,7 +607,7 @@ // Backlight // TODO TIM3, TIM8, TIM14, review the channel in backlight_driver.cpp according to the chosen timer #define BACKLIGHT_RCC_APB2Periph 0 -#define BACKLIGHT_GPIO GPIO_PIN(GPIOA, 15) +#define BACKLIGHT_GPIO GPIO_PIN(GPIOA, 15) // PA.15 #define BACKLIGHT_TIMER TIM2 #define BACKLIGHT_GPIO_AF GPIO_AF1 #define BACKLIGHT_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) @@ -416,7 +615,39 @@ //used in BOOTLOADER #define SERIAL_RCC_AHB1Periph 0 #define SERIAL_RCC_APB1Periph 0 -#define ROTARY_ENCODER_RCC_APB1Periph 0 + +#if defined(RADIO_NB4P) +// Rotary Encoder +#define ROTARY_ENCODER_GPIO GPIOH +#define ROTARY_ENCODER_GPIO_PIN_A LL_GPIO_PIN_11 // PH.11 +#define ROTARY_ENCODER_GPIO_PIN_B LL_GPIO_PIN_10 // PH.10 +#define ROTARY_ENCODER_POSITION() ((ROTARY_ENCODER_GPIO->IDR >> 10) & 0x03) +#define ROTARY_ENCODER_EXTI_LINE1 LL_EXTI_LINE_11 +#define ROTARY_ENCODER_EXTI_LINE2 LL_EXTI_LINE_10 +#if !defined(USE_EXTI15_10_IRQ) + #define USE_EXTI15_10_IRQ + #define EXTI15_10_IRQ_Priority 5 +#endif +#define ROTARY_ENCODER_EXTI_PORT LL_SYSCFG_EXTI_PORTH +#define ROTARY_ENCODER_EXTI_SYS_LINE1 LL_SYSCFG_EXTI_LINE11 +#define ROTARY_ENCODER_EXTI_SYS_LINE2 LL_SYSCFG_EXTI_LINE10 +#define ROTARY_ENCODER_TIMER TIM13 +#define ROTARY_ENCODER_TIMER_IRQn TIM8_UP_TIM13_IRQn +#define ROTARY_ENCODER_TIMER_IRQHandler TIM8_UP_TIM13_IRQHandler +#endif + +#if defined(RADIO_NV14_FAMILY) + // SD card + #define SD_PRESENT_GPIO GPIO_PIN(GPIOH, 10) // PH.10 + #define SD_SDIO_DMA DMA2 + #define SD_SDIO_DMA_STREAM DMA2_Stream3 + #define SD_SDIO_DMA_CHANNEL LL_DMA_CHANNEL_4 + #define SD_SDIO_DMA_IRQn DMA2_Stream3_IRQn + #define SD_SDIO_DMA_IRQHANDLER DMA2_Stream3_IRQHandler + #define SD_SDIO_CLK_DIV(fq) ((48000000 / (fq)) - 2) + #define SD_SDIO_INIT_CLK_DIV SD_SDIO_CLK_DIV(400000) + #define SD_SDIO_TRANSFER_CLK_DIV SD_SDIO_CLK_DIV(24000000) +#endif // SPI NOR Flash #define FLASH_SPI SPI6 @@ -430,23 +661,60 @@ #define FLASH_SPI_DMA_CHANNEL LL_DMA_CHANNEL_1 #define FLASH_SPI_DMA_TX_STREAM LL_DMA_STREAM_5 #define FLASH_SPI_DMA_RX_STREAM LL_DMA_STREAM_6 -#define STORAGE_USE_SPI_FLASH + +#if defined(RADIO_NV14_FAMILY) + #define STORAGE_USE_SDIO +#else + #define STORAGE_USE_SPI_FLASH +#endif // SDRAM #define SDRAM_RCC_AHB1Periph (RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOE | RCC_AHB1Periph_GPIOF | RCC_AHB1Periph_GPIOG | RCC_AHB1Periph_GPIOH) #define SDRAM_RCC_AHB3Periph RCC_AHB3Periph_FMC // Audio -#define AUDIO_RCC_APB1Periph (RCC_APB1Periph_TIM6 | RCC_APB1Periph_DAC) -#define AUDIO_RCC_AHB1Periph (RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_DMA1) -#define AUDIO_OUTPUT_GPIO GPIO_PIN(GPIOA, 4) // PA.04 -#define AUDIO_DMA_Stream DMA1_Stream5 -#define AUDIO_DMA_Stream_IRQn DMA1_Stream5_IRQn -#define AUDIO_TIM_IRQn TIM6_DAC_IRQn -#define AUDIO_TIM_IRQHandler TIM6_DAC_IRQHandler -#define AUDIO_DMA_Stream_IRQHandler DMA1_Stream5_IRQHandler -#define AUDIO_TIMER TIM6 -#define AUDIO_DMA DMA1 +#if defined(RADIO_NV14_FAMILY) + #define AUDIO_XDCS_GPIO GPIOH + #define AUDIO_XDCS_GPIO_PIN LL_GPIO_PIN_14 // PH.14 + #define AUDIO_CS_GPIO GPIOH + #define AUDIO_CS_GPIO_PIN LL_GPIO_PIN_13 // PH.13 + #define AUDIO_DREQ_GPIO GPIOH + #define AUDIO_DREQ_GPIO_PIN LL_GPIO_PIN_15 // PH.15 + #define AUDIO_RST_GPIO GPIOD + #define AUDIO_RST_GPIO_PIN LL_GPIO_PIN_4 // PD.04 + #define AUDIO_SPI SPI1 + #define AUDIO_SPI_GPIO_AF LL_GPIO_AF_5 + #define AUDIO_SPI_SCK_GPIO GPIOB + #define AUDIO_SPI_SCK_GPIO_PIN LL_GPIO_PIN_3 // PB.03 + #define AUDIO_SPI_MISO_GPIO GPIOB + #define AUDIO_SPI_MISO_GPIO_PIN LL_GPIO_PIN_4 // PB.04 + #define AUDIO_SPI_MOSI_GPIO GPIOB + #define AUDIO_SPI_MOSI_GPIO_PIN LL_GPIO_PIN_5 // PB.05 +#else + #define AUDIO_RCC_APB1Periph (RCC_APB1Periph_TIM6 | RCC_APB1Periph_DAC) + #define AUDIO_RCC_AHB1Periph (RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_DMA1) + #define AUDIO_OUTPUT_GPIO GPIO_PIN(GPIOA, 4) // PA.04 + #define AUDIO_DMA_Stream DMA1_Stream5 + #define AUDIO_DMA_Stream_IRQn DMA1_Stream5_IRQn + #define AUDIO_TIM_IRQn TIM6_DAC_IRQn + #define AUDIO_TIM_IRQHandler TIM6_DAC_IRQHandler + #define AUDIO_DMA_Stream_IRQHandler DMA1_Stream5_IRQHandler + #define AUDIO_TIMER TIM6 + #define AUDIO_DMA DMA1 +#endif + +#if defined(RADIO_NV14_FAMILY) + #define AUDIO_MUTE_GPIO GPIO_PIN(GPIOH, 8) // PH.08 audio amp control pin + #define AUDIO_UNMUTE_DELAY 120 // ms + #define AUDIO_MUTE_DELAY 500 // ms + #define INVERTED_MUTE_PIN +#elif defined(RADIO_NB4P) + #define AUDIO_MUTE_GPIO GPIO_PIN(GPIOH, 9) // PH.09 audio amp control pin + #define AUDIO_UNMUTE_DELAY 120 // ms + #define AUDIO_MUTE_DELAY 500 // ms + #define INVERTED_MUTE_PIN + #define VOICE_CHIP_EN_GPIO GPIO_PIN(GPIOI, 5) // PI.05 +#endif // I2C Bus #define I2C_B1 I2C1 @@ -471,13 +739,23 @@ #endif // Haptic: TIM1_CH1 +#if defined(RADIO_NB4P) +#define HAPTIC_PWM +#define HAPTIC_GPIO GPIO_PIN(GPIOB, 0) // PB.00 +#define HAPTIC_GPIO_TIMER TIM1 +#define HAPTIC_GPIO_AF GPIO_AF1 +#define HAPTIC_TIMER_OUTPUT_ENABLE TIM_CCER_CC2NE +#define HAPTIC_TIMER_MODE TIM_CCMR1_OC2M_1 | TIM_CCMR1_OC2M_2 | TIM_CCMR1_OC2PE +#define HAPTIC_TIMER_COMPARE_VALUE HAPTIC_GPIO_TIMER->CCR2 +#else #define HAPTIC_PWM #define HAPTIC_GPIO GPIO_PIN(GPIOA, 8) // PA.08 #define HAPTIC_GPIO_TIMER TIM1 #define HAPTIC_GPIO_AF GPIO_AF1 -#define HAPTIC_TIMER_OUTPUT_ENABLE TIM_CCER_CC1E | TIM_CCER_CC1NE; +#define HAPTIC_TIMER_OUTPUT_ENABLE TIM_CCER_CC1E | TIM_CCER_CC1NE #define HAPTIC_TIMER_MODE TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1PE #define HAPTIC_TIMER_COMPARE_VALUE HAPTIC_GPIO_TIMER->CCR1 +#endif // Flysky Hall Stick #define FLYSKY_HALL_SERIAL_USART UART4 @@ -496,55 +774,98 @@ #define FLYSKY_HALL_DMA_Stream_TX LL_DMA_STREAM_4 // LED Strip -#define LED_STRIP_LENGTH 4 -#define LED_STRIP_GPIO GPIO_PIN(GPIOH, 12) // PH.12 / TIM5_CH3 -#define LED_STRIP_GPIO_AF LL_GPIO_AF_2 // TIM3/4/5 -#define LED_STRIP_TIMER TIM5 -#define LED_STRIP_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) -#define LED_STRIP_TIMER_CHANNEL LL_TIM_CHANNEL_CH3 -#define LED_STRIP_TIMER_DMA DMA1 -#define LED_STRIP_TIMER_DMA_CHANNEL LL_DMA_CHANNEL_6 -#define LED_STRIP_TIMER_DMA_STREAM LL_DMA_STREAM_0 -#define LED_STRIP_TIMER_DMA_IRQn DMA1_Stream0_IRQn -#define LED_STRIP_TIMER_DMA_IRQHandler DMA1_Stream0_IRQHandler -#define LED_STRIP_REFRESH_PERIOD 50 //ms - -#define STATUS_LEDS - +#if !defined(RADIO_NV14_FAMILY) + #define LED_STRIP_LENGTH 4 + #define LED_STRIP_GPIO GPIO_PIN(GPIOH, 12) // PH.12 / TIM5_CH3 + #define LED_STRIP_GPIO_AF LL_GPIO_AF_2 // TIM3/4/5 + #define LED_STRIP_TIMER TIM5 + #define LED_STRIP_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) + #define LED_STRIP_TIMER_CHANNEL LL_TIM_CHANNEL_CH3 + #define LED_STRIP_TIMER_DMA DMA1 + #define LED_STRIP_TIMER_DMA_CHANNEL LL_DMA_CHANNEL_6 + #define LED_STRIP_TIMER_DMA_STREAM LL_DMA_STREAM_0 + #define LED_STRIP_TIMER_DMA_IRQn DMA1_Stream0_IRQn + #define LED_STRIP_TIMER_DMA_IRQHandler DMA1_Stream0_IRQHandler + #define LED_STRIP_REFRESH_PERIOD 50 //ms + + #define STATUS_LEDS +#endif // Internal Module #if defined(RADIO_PL18) -#define INTMODULE_RCC_AHB1Periph (RCC_AHB1Periph_GPIOF | RCC_AHB1Periph_GPIOI | RCC_AHB1Periph_DMA1) -#define INTMODULE_PWR_GPIO GPIO_PIN(GPIOI, 0) // PI.00 -#define INTMODULE_TX_GPIO GPIO_PIN(GPIOF, 7) // PF.07 -#define INTMODULE_RX_GPIO GPIO_PIN(GPIOF, 6) // PF.06 -#define INTMODULE_USART UART7 -#define INTMODULE_GPIO_AF LL_GPIO_AF_8 -#define INTMODULE_USART_IRQn UART7_IRQn -#define INTMODULE_USART_IRQHandler UART7_IRQHandler -#define INTMODULE_DMA DMA1 -#define INTMODULE_DMA_STREAM LL_DMA_STREAM_1 -#define INTMODULE_DMA_STREAM_IRQ DMA1_Stream1_IRQn -#define INTMODULE_DMA_FLAG_TC DMA_FLAG_TCIF1 -#define INTMODULE_DMA_CHANNEL LL_DMA_CHANNEL_5 -#define INTMODULE_RX_DMA DMA1 -#define INTMODULE_RX_DMA_STREAM LL_DMA_STREAM_3 -#define INTMODULE_RX_DMA_CHANNEL LL_DMA_CHANNEL_5 + #define INTMODULE_PWR_GPIO GPIO_PIN(GPIOI, 0) // PI.00 + #define INTMODULE_TX_GPIO GPIO_PIN(GPIOF, 7) // PF.07 + #define INTMODULE_RX_GPIO GPIO_PIN(GPIOF, 6) // PF.06 + #define INTMODULE_USART UART7 + #define INTMODULE_GPIO_AF LL_GPIO_AF_8 + #define INTMODULE_USART_IRQn UART7_IRQn + #define INTMODULE_USART_IRQHandler UART7_IRQHandler + #define INTMODULE_DMA DMA1 + #define INTMODULE_DMA_STREAM LL_DMA_STREAM_1 + #define INTMODULE_DMA_STREAM_IRQ DMA1_Stream1_IRQn + #define INTMODULE_DMA_FLAG_TC DMA_FLAG_TCIF1 + #define INTMODULE_DMA_CHANNEL LL_DMA_CHANNEL_5 + #define INTMODULE_RX_DMA DMA1 + #define INTMODULE_RX_DMA_STREAM LL_DMA_STREAM_3 + #define INTMODULE_RX_DMA_CHANNEL LL_DMA_CHANNEL_5 // #define INTMODULE_RX_DMA_Stream_IRQn DMA1_Stream3_IRQn // #define INTMODULE_RX_DMA_Stream_IRQHandler DMA1_Stream_IRQHandler -#define INTMODULE_TIMER TIM3 -#define INTMODULE_TIMER_IRQn TIM3_IRQn -#define INTMODULE_TIMER_IRQHandler TIM3_IRQHandler -#define INTMODULE_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) -#else -#define INTMODULE_RCC_AHB1Periph 0 + #define INTMODULE_TIMER TIM3 + #define INTMODULE_TIMER_IRQn TIM3_IRQn + #define INTMODULE_TIMER_IRQHandler TIM3_IRQHandler + #define INTMODULE_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) +#elif defined(RADIO_NB4P) + #define INTMODULE_PWR_GPIO GPIO_PIN(GPIOI, 8) // PI.08 + #define INTMODULE_TX_GPIO GPIO_PIN(GPIOB, 10) // PB.10 + #define INTMODULE_RX_GPIO GPIO_PIN(GPIOB, 11) // PB.11 + #define INTMODULE_USART USART3 + #define INTMODULE_GPIO_AF LL_GPIO_AF_7 + #define INTMODULE_USART_IRQn USART3_IRQn + #define INTMODULE_USART_IRQHandler USART3_IRQHandler + #define INTMODULE_DMA DMA1 + #define INTMODULE_DMA_STREAM LL_DMA_STREAM_3 + #define INTMODULE_DMA_STREAM_IRQ DMA1_Stream3_IRQn + #define INTMODULE_DMA_FLAG_TC DMA_FLAG_TCIF1 + #define INTMODULE_DMA_CHANNEL LL_DMA_CHANNEL_4 + #define INTMODULE_RX_DMA DMA1 + #define INTMODULE_RX_DMA_STREAM LL_DMA_STREAM_1 + #define INTMODULE_RX_DMA_CHANNEL LL_DMA_CHANNEL_4 + + #define INTMODULE_TIMER TIM3 + #define INTMODULE_TIMER_IRQn TIM3_IRQn + #define INTMODULE_TIMER_IRQHandler TIM3_IRQHandler + #define INTMODULE_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) +#elif defined(RADIO_NV14_FAMILY) + #define INTMODULE_PWR_GPIO GPIO_PIN(GPIOH, 9) // PH.09 + #define INTMODULE_TX_GPIO GPIO_PIN(GPIOF, 7) // PF.07 + #define INTMODULE_RX_GPIO GPIO_PIN(GPIOF, 6) // PF.06 + #define INTMODULE_USART UART7 + #define INTMODULE_USART_IRQn UART7_IRQn + #define INTMODULE_DMA DMA1 + #define INTMODULE_DMA_STREAM LL_DMA_STREAM_1 + #define INTMODULE_DMA_STREAM_IRQ DMA1_Stream1_IRQn + #define INTMODULE_DMA_CHANNEL LL_DMA_CHANNEL_5 + + #define INTMODULE_RX_DMA DMA1 + #define INTMODULE_RX_DMA_STREAM LL_DMA_STREAM_3 + #define INTMODULE_RX_DMA_CHANNEL LL_DMA_CHANNEL_5 + // #define INTMODULE_RX_DMA_Stream_IRQn DMA1_Stream3_IRQn + // #define INTMODULE_RX_DMA_Stream_IRQHandler DMA1_Stream_IRQHandler + + #define INTMODULE_TIMER TIM3 + #define INTMODULE_TIMER_IRQn TIM3_IRQn + #define INTMODULE_TIMER_IRQHandler TIM3_IRQHandler + #define INTMODULE_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) #endif // External Module #define EXTMODULE #define EXTMODULE_PULSES #define EXTMODULE_PWR_GPIO GPIO_PIN(GPIOD, 11) // PD.11 +#if defined(RADIO_NV14_FAMILY) + #define EXTMODULE_PWR_FIX_GPIO GPIO_PIN(GPIOA, 2) // PA.02 +#endif #define EXTMODULE_TX_GPIO GPIO_PIN(GPIOC, 6) // PC.06 #define EXTMODULE_RX_GPIO GPIO_PIN(GPIOC, 7) // PC.07 #define EXTMODULE_TX_GPIO_AF LL_GPIO_AF_3 // TIM8_CH1 @@ -552,8 +873,13 @@ #define EXTMODULE_RX_GPIO_AF_USART GPIO_AF_USART6 #define EXTMODULE_TIMER TIM8 #define EXTMODULE_TIMER_Channel LL_TIM_CHANNEL_CH1 +#if defined(RADIO_NB4P) +#define EXTMODULE_TIMER_IRQn TIM5_IRQn +#define EXTMODULE_TIMER_IRQHandler TIM5_IRQHandler +#else #define EXTMODULE_TIMER_IRQn TIM8_UP_TIM13_IRQn #define EXTMODULE_TIMER_IRQHandler TIM8_UP_TIM13_IRQHandler +#endif #define EXTMODULE_TIMER_FREQ (PERI2_FREQUENCY * TIMER_MULT_APB2) #define EXTMODULE_TIMER_TX_GPIO_AF LL_GPIO_AF_3 //USART @@ -603,29 +929,18 @@ //ROTARY emulation for trims as buttons #define ROTARY_ENCODER_NAVIGATION -//BLUETOOTH -#define BT_EN_GPIO GPIOI -#define BT_EN_GPIO_PIN GPIO_Pin_8 // PI.8 - -#define BT_RCC_AHB1Periph (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOI | RCC_AHB1Periph_GPIOH) -#define BT_RCC_APB1Periph (RCC_APB1Periph_USART3) -#define BT_RCC_APB2Periph 0 - -#define BT_USART USART3 -#define BT_GPIO_AF GPIO_AF_USART3 -#define BT_USART_IRQn USART3_IRQn -#define BT_GPIO_TXRX GPIOB -#define BT_TX_GPIO_PIN GPIO_Pin_10 // PB.10 -#define BT_RX_GPIO_PIN GPIO_Pin_11 // PB.11 -#define BT_TX_GPIO_PinSource GPIO_PinSource10 -#define BT_RX_GPIO_PinSource GPIO_PinSource11 -#define BT_USART_IRQHandler USART3_IRQHandler - -#define BT_CONNECTED_GPIO GPIOJ -#define BT_CONNECTED_GPIO_PIN GPIO_Pin_1 // PJ.01 - -#define BT_CMD_MODE_GPIO GPIOH -#define BT_CMD_MODE_GPIO_PIN GPIO_Pin_6 // PH.6 +// Bluetooth +#if !defined(RADIO_NB4P) + #define BLUETOOTH_ON_GPIO GPIO_PIN(GPIOI, 8) // PI.8 + #define BT_USART USART3 + #define BT_USART_IRQn USART3_IRQn + #define BT_GPIO_TXRX GPIOB + #define BT_TX_GPIO GPIO_PIN(GPIOB, 10) // PB.10 + #define BT_RX_GPIO GPIO_PIN(GPIOB, 11) // PB.11 + #define BT_EN_GPIO GPIO_PIN(GPIOI, 8) // PI.08 + #define BT_CONNECTED_GPIO GPIO_PIN(GPIOJ, 1) // PJ.01 + #define BT_CMD_MODE_GPIO GPIO_PIN(GPIOH, 6) // PH.06 +#endif // Millisecond timer #define MS_TIMER TIM14 @@ -641,11 +956,17 @@ // SDRAM #define SDRAM_BANK1 -#define PORTRAIT_LCD false -#define LANDSCAPE_LCD true - -#define LCD_W 480 -#define LCD_H 320 +#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) + #define PORTRAIT_LCD true + #define LANDSCAPE_LCD false + #define LCD_W 320 + #define LCD_H 480 +#else + #define PORTRAIT_LCD false + #define LANDSCAPE_LCD true + #define LCD_W 480 + #define LCD_H 320 +#endif #define LCD_PHYS_W 320 #define LCD_PHYS_H 480 diff --git a/radio/src/targets/pl18/haptic_driver.cpp b/radio/src/targets/pl18/haptic_driver.cpp index 7a9b79a5e29..7b49304745e 100644 --- a/radio/src/targets/pl18/haptic_driver.cpp +++ b/radio/src/targets/pl18/haptic_driver.cpp @@ -47,7 +47,9 @@ void hapticInit(void) HAPTIC_GPIO_TIMER->PSC = (PERI2_FREQUENCY * TIMER_MULT_APB2) / 10000 - 1; HAPTIC_GPIO_TIMER->CCMR1 = HAPTIC_TIMER_MODE; // PWM HAPTIC_GPIO_TIMER->CCER = HAPTIC_TIMER_OUTPUT_ENABLE; - HAPTIC_GPIO_TIMER->CCR1 = 0; + + hapticOff(); + HAPTIC_GPIO_TIMER->EGR = TIM_EGR_UG; HAPTIC_GPIO_TIMER->CR1 = TIM_CR1_CEN; // counter enable HAPTIC_GPIO_TIMER->BDTR |= TIM_BDTR_MOE; diff --git a/radio/src/targets/pl18/lcd_driver.cpp b/radio/src/targets/pl18/lcd_driver.cpp index 6b398fb3ff8..070bdb5f19a 100644 --- a/radio/src/targets/pl18/lcd_driver.cpp +++ b/radio/src/targets/pl18/lcd_driver.cpp @@ -1150,18 +1150,33 @@ void LCD_ST7796S_Init(void) { lcdWriteData( 0x96 ); lcdWriteCommand( 0x36 ); - lcdWriteData( 0x28 ); - - lcdWriteCommand( 0x2A ); - lcdWriteData( 0x00 ); - lcdWriteData( 0x00 ); - lcdWriteData( 0x01 ); - lcdWriteData( 0xDF ); - lcdWriteCommand( 0x2B ); - lcdWriteData( 0x00 ); - lcdWriteData( 0x00 ); - lcdWriteData( 0x01 ); - lcdWriteData( 0x3F ); + if (LCD_W != LCD_PHYS_W) { + lcdWriteData( 0x28 ); + + lcdWriteCommand( 0x2A ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x01 ); + lcdWriteData( 0xDF ); + lcdWriteCommand( 0x2B ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x01 ); + lcdWriteData( 0x3F ); + } else { + lcdWriteData( 0x88 ); + + lcdWriteCommand( 0x2A ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x01 ); + lcdWriteData( 0x3F ); + lcdWriteCommand( 0x2B ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x01 ); + lcdWriteData( 0xDF ); + } lcdWriteCommand( 0x3A ); lcdWriteData( 0x66 ); diff --git a/radio/src/targets/pl18/nb4p_key_driver.cpp b/radio/src/targets/pl18/nb4p_key_driver.cpp new file mode 100644 index 00000000000..0e55d173b9c --- /dev/null +++ b/radio/src/targets/pl18/nb4p_key_driver.cpp @@ -0,0 +1,175 @@ +/* + * Copyright (C) EdgeTX + * + * Based on code named + * opentx - https://github.com/opentx/opentx + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "hal/key_driver.h" + +#include "stm32_hal_ll.h" +#include "stm32_gpio_driver.h" + +#include "hal.h" +#include "delays_driver.h" +#include "keys.h" + +#if !defined(BOOT) + #include "hal/adc_driver.h" +#endif + +#define BOOTLOADER_KEYS 0x42 + +/* The output bit-order has to be: + 0 LHL STD (Left equals down) + 1 LHR STU + 2 LVD THD + 3 LVU THU +*/ + +enum PhysicalTrims +{ + STD = 0, + STU, + THD = 2, + THU, +/* TR2L = 4, + TR2R, + TR2D = 8, + TR2U,*/ +}; + +void keysInit() +{ +#if defined(BOOT) + LL_GPIO_InitTypeDef pinInit; + LL_GPIO_StructInit(&pinInit); + + pinInit.Pin = ADC_GPIO_PIN_RAW1; + pinInit.Mode = LL_GPIO_MODE_ANALOG; + pinInit.Pull = LL_GPIO_PULL_NO; + stm32_gpio_enable_clock(ADC_GPIO_RAW1); + LL_GPIO_Init(ADC_GPIO_RAW1, &pinInit); + + // Init ADC clock + uint32_t adc_idx = (((uint32_t) ADC_MAIN) - ADC1_BASE) / 0x100UL; + uint32_t adc_msk = RCC_APB2ENR_ADC1EN << adc_idx; + LL_APB2_GRP1_EnableClock(adc_msk); + + // Init common to all ADCs + LL_ADC_CommonInitTypeDef commonInit; + LL_ADC_CommonStructInit(&commonInit); + + commonInit.CommonClock = LL_ADC_CLOCK_SYNC_PCLK_DIV4; + LL_ADC_CommonInit(__LL_ADC_COMMON_INSTANCE(ADC_MAIN), &commonInit); + + // ADC must be disabled for the functions used here + LL_ADC_Disable(ADC_MAIN); + + LL_ADC_InitTypeDef adcInit; + LL_ADC_StructInit(&adcInit); + adcInit.SequencersScanMode = LL_ADC_SEQ_SCAN_DISABLE; + adcInit.DataAlignment = LL_ADC_DATA_ALIGN_RIGHT; + adcInit.Resolution = LL_ADC_RESOLUTION_12B; + LL_ADC_Init(ADC_MAIN, &adcInit); + + LL_ADC_REG_InitTypeDef adcRegInit; + LL_ADC_REG_StructInit(&adcRegInit); + adcRegInit.TriggerSource = LL_ADC_REG_TRIG_SOFTWARE; + adcRegInit.ContinuousMode = LL_ADC_REG_CONV_SINGLE; + LL_ADC_REG_Init(ADC_MAIN, &adcRegInit); + + // Enable ADC + LL_ADC_Enable(ADC_MAIN); +#endif +} + +#if defined(BOOT) +uint16_t _adcRead() +{ + // Configure ADC channel + LL_ADC_REG_SetSequencerRanks(ADC_MAIN, LL_ADC_REG_RANK_1, ADC_CHANNEL_RAW1); + LL_ADC_SetChannelSamplingTime(ADC_MAIN, ADC_CHANNEL_RAW1, LL_ADC_SAMPLINGTIME_3CYCLES); + + // Start ADC conversion + LL_ADC_REG_StartConversionSWStart(ADC_MAIN); + + // Wait until ADC conversion is complete + uint32_t timeout = 0; + while (!LL_ADC_IsActiveFlag_EOCS(ADC_MAIN)); + + // Read ADC converted value + return LL_ADC_REG_ReadConversionData12(ADC_MAIN); +} +#endif + +uint32_t readKeys() +{ + uint32_t result = 0; + +#if defined(BOOT) + uint16_t value = _adcRead(); + if (value >= 3584) + result |= 1 << KEY_EXIT; + else if (value < 512) + result |= 1 << KEY_ENTER; +#else + uint16_t value = getAnalogValue(4); + if (value >= 3584) + result |= 1 << KEY_EXIT; + else if (value < 512) + result |= 1 << KEY_ENTER; +#endif + + return result; +} + +uint32_t readTrims() +{ + uint32_t result = 0; + +#if defined(BOOT) + uint16_t value = _adcRead(); + if (value >= 1536 && value < 2560) + result = BOOTLOADER_KEYS; +#else + uint16_t tr1Val = getAnalogValue(6); + uint16_t tr2Val = getAnalogValue(7); + if (tr1Val < 500) // Physical TR1 Left +// result |= 1 << TR1L; + ; + else if (tr1Val < 1500) // Physical TR1 Up + result |= 1 << STD; + else if (tr1Val < 2500) // Physical TR1 Right +// result |= 1 << TR1R; + ; + else if (tr1Val < 3500) // Physical TR1 Down + result |= 1 << STU; + if (tr2Val < 500) // Physical TR2 Left +// result |= 1 << TR2L; + ; + else if (tr2Val < 1500) // Physical TR2 Up + result |= 1 << THD; + else if (tr2Val < 2500) // Physical TR2 Right +// result |= 1 << TR2R; + ; + else if (tr2Val < 3500) // Physical TR2 Down + result |= 1 << THU; +#endif + + return result; +} \ No newline at end of file diff --git a/radio/src/targets/pl18/nb4p_switch_driver.cpp b/radio/src/targets/pl18/nb4p_switch_driver.cpp new file mode 100644 index 00000000000..614694b7ece --- /dev/null +++ b/radio/src/targets/pl18/nb4p_switch_driver.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) EdgeTX + * + * Based on code named + * opentx - https://github.com/opentx/opentx + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "hal/switch_driver.h" +#include "stm32_switch_driver.h" +//#include "stm32_gpio_driver.h" + +#include "definitions.h" +#include "edgetx_constants.h" +#include "myeeprom.h" +#include "hal/adc_driver.h" + +#include + +static const char _switch_names[][4] = {"SW2", "SW3"}; + +SwitchHwPos boardSwitchGetPosition(uint8_t cat, uint8_t idx) +{ + if (idx <= 1) { +// uint16_t swVal = getAnalogValue(4); + uint16_t swVal = getAnalogValue(5); + if (idx == 0 && (swVal >= 3584 || (swVal >= 1536 && swVal < 2560))) { + return SWITCH_HW_DOWN; + } + if (idx == 1 && (swVal < 512 || (swVal >= 1536 && swVal < 2560))) { + return SWITCH_HW_DOWN; + } + } /*else if (idx <= 3) { + uint16_t swVal = getAnalogValue(5); + if (idx == 3 && (swVal < 512 || (swVal >= 1536 && swVal < 2560))) { + return SWITCH_HW_DOWN; + } + if (idx == 2 && (swVal >= 3584 || (swVal >= 1536 && swVal < 2560))) { + return SWITCH_HW_DOWN; + } + }*/ + return SWITCH_HW_UP; +} + +const char* boardSwitchGetName(uint8_t cat, uint8_t idx) +{ + return _switch_names[idx]; +} diff --git a/radio/src/targets/pl18/touch_driver.cpp b/radio/src/targets/pl18/touch_driver.cpp index 8e09f810bd2..dbb3ca5918b 100644 --- a/radio/src/targets/pl18/touch_driver.cpp +++ b/radio/src/targets/pl18/touch_driver.cpp @@ -66,7 +66,22 @@ #define TOUCH_CHSC5448_EVT_CONTACT 0x08 #define TOUCH_CHSC5448_MAX_POINTS 5 -typedef enum {TC_NONE, TC_FT6236, TC_CST340, TC_CHSC5448} TouchController; +// CST836U definitions +#define TOUCH_CST836U_I2C_ADDRESS 0x15 +#define TOUCH_CST836U_REG_NUM 0x02 +#define TOUCH_CST836U_REG_P1_XH 0x03 +#define TOUCH_CST836U_EVT_SHIFT 6 +#define TOUCH_CST836U_EVT_MASK (3 << TOUCH_FT6206_EVT_SHIFT) +#define TOUCH_CST836U_EVT_CONTACT 0x02 +#define TOUCH_CST836U_FW_VERSION_L_REG 0xa6 +#define TOUCH_CST836U_FW_VERSION_H_REG 0xa7 +#define TOUCH_CST836U_MODULE_VERSION_REG 0xa8 +#define TOUCH_CST836U_PROJECT_NAME_REG 0xa9 +#define TOUCH_CST836U_CHIP_TYPE_L_REG 0xaa +#define TOUCH_CST836U_CHIP_TYPE_H_REG 0xab + + +typedef enum {TC_NONE, TC_FT6236, TC_CST836U, TC_CST340, TC_CHSC5448} TouchController; #if defined(DEBUG) const char TOUCH_CONTROLLER_STR[][10] = {"", "FT6236", "CST340", "CHSC5448"}; @@ -74,12 +89,20 @@ const char TOUCH_CONTROLLER_STR[][10] = {"", "FT6236", "CST340", "CHSC5448"}; TouchController touchController = TC_NONE; +enum TouchRotate +{ + DEG_0, + DEG_90, + DEG_180, + DEG_270 +}; + struct TouchControllerDescriptor { bool (*hasTouchEvent)(); bool (*touchRead)(uint16_t * X, uint16_t * Y); void (*printDebugInfo)(); - bool needTranspose; + TouchRotate rotate; }; union rpt_point_t @@ -99,6 +122,7 @@ union rpt_point_t extern uint8_t TouchControllerType; +const char* boardTouchType = ""; static const TouchControllerDescriptor *tcd = nullptr; static TouchState internalTouchState = {}; volatile static bool touchEventOccured; @@ -131,8 +155,8 @@ static void _i2c_init(void) static void _i2c_reInit(void) { - stm32_i2c_deinit(TOUCH_I2C_BUS); - _i2c_init(); +// stm32_i2c_deinit(TOUCH_I2C_BUS); +// _i2c_init(); } static int _i2c_read(uint8_t addr, uint32_t reg, uint8_t regSize, uint8_t* data, uint16_t len, uint32_t timeout) @@ -170,6 +194,11 @@ static uint16_t _i2c_readMultipleRetry(uint8_t addr, uint32_t reg, uint8_t regSi return length; } +static bool defaultHasTouchEvent() +{ + return touchEventOccured; +} + static bool ft6236TouchRead(uint16_t * X, uint16_t * Y) { // Read register FT6206_TD_STAT_REG to check number of touches detection @@ -193,11 +222,6 @@ static bool ft6236TouchRead(uint16_t * X, uint16_t * Y) return false; } -static bool ft6236HasTouchEvent() -{ - return touchEventOccured; -} - static void ft6236PrintDebugInfo() { #if defined(DEBUG) @@ -213,6 +237,38 @@ static void ft6236PrintDebugInfo() } +static bool cst836uTouchRead(uint16_t * X, uint16_t * Y) +{ + // Read register TOUCH_CST836U_REG_NUM to check number of touches detection + uint8_t nbTouch = _i2c_readRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_REG_NUM, 1); + bool hasTouch = nbTouch > 0; + + if (hasTouch) { + uint8_t dataxy[4]; + // Read X and Y positions and event + _i2c_readMultipleRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_REG_P1_XH, 1, dataxy, sizeof(dataxy)); + + // Send back ready X position to caller + *X = ((dataxy[0] & 0x0f) << 8) | dataxy[1]; + // Send back ready Y position to caller + *Y = ((dataxy[2] & 0x0f) << 8) | dataxy[3]; + + uint8_t event = (dataxy[0] & TOUCH_CST836U_EVT_MASK) >> TOUCH_CST836U_EVT_SHIFT; + return event == TOUCH_CST836U_EVT_CONTACT; + } + return false; +} + +static void cst836uPrintDebugInfo(void) +{ +#if defined(DEBUG) + TRACE("cst836u: fw ver 0x%02X %02X", _i2c_readRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_FW_VERSION_H_REG, 1), _i2c_readRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_FW_VERSION_L_REG, 1)); + TRACE("cst836u: module version 0x%02X", _i2c_readRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_MODULE_VERSION_REG, 1)); + TRACE("cst836u: project name 0x%02X", _i2c_readRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_PROJECT_NAME_REG, 1)); + TRACE("cst836u: chip type 0x%02X 0x%02X", _i2c_readRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_CHIP_TYPE_H_REG, 1), _i2c_readRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_CHIP_TYPE_L_REG, 1)); +#endif +} + static bool cst340TouchRead(uint16_t * X, uint16_t * Y) { uint8_t data[4]; @@ -268,11 +324,6 @@ static bool chsc5448TouchRead(uint16_t * X, uint16_t * Y) return ptCnt > 0 && event == TOUCH_CHSC5448_EVT_CONTACT; } -static bool chsc5448HasTouchEvent() -{ - return touchEventOccured; -} - static void chsc5448PrintDebugInfo() { // TODO, when necessary @@ -280,10 +331,26 @@ static void chsc5448PrintDebugInfo() static const TouchControllerDescriptor FT6236 = { - .hasTouchEvent = ft6236HasTouchEvent, + .hasTouchEvent = defaultHasTouchEvent, .touchRead = ft6236TouchRead, .printDebugInfo = ft6236PrintDebugInfo, - .needTranspose = true, +#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) + .rotate = DEG_180, +#else + .rotate = DEG_270, +#endif +}; + +static const TouchControllerDescriptor CST836U = +{ + .hasTouchEvent = defaultHasTouchEvent, + .touchRead = cst836uTouchRead, + .printDebugInfo = cst836uPrintDebugInfo, +#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) + .rotate = DEG_180, +#else + .rotate = DEG_270, +#endif }; static const TouchControllerDescriptor CST340 = @@ -291,15 +358,19 @@ static const TouchControllerDescriptor CST340 = .hasTouchEvent = cst340HasTouchEvent, .touchRead = cst340TouchRead, .printDebugInfo = cst340PrintDebugInfo, - .needTranspose = true, +#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) + .rotate = DEG_180, +#else + .rotate = DEG_270, +#endif }; static const TouchControllerDescriptor CHSC5448 = { - .hasTouchEvent = chsc5448HasTouchEvent, + .hasTouchEvent = defaultHasTouchEvent, .touchRead = chsc5448TouchRead, .printDebugInfo = chsc5448PrintDebugInfo, - .needTranspose = false, + .rotate = DEG_0, }; void _detect_touch_controller() @@ -307,15 +378,26 @@ void _detect_touch_controller() if (stm32_i2c_is_dev_ready(TOUCH_I2C_BUS, TOUCH_CST340_I2C_ADDRESS, 3, I2C_TIMEOUT_MAX) == 0) { touchController = TC_CST340; tcd = &CST340; + boardTouchType = "CST340"; TouchControllerType = 0; } else if (stm32_i2c_is_dev_ready(TOUCH_I2C_BUS, TOUCH_CHSC5448_I2C_ADDRESS, 3, I2C_TIMEOUT_MAX) == 0) { touchController = TC_CHSC5448; tcd = &CHSC5448; TouchControllerType = 0; + boardTouchType = "CHSC5448"; + } else if (stm32_i2c_is_dev_ready(TOUCH_I2C_BUS, TOUCH_CST836U_I2C_ADDRESS, 3, 5) == 0) { + touchController = TC_CST836U; + tcd = &CST836U; + boardTouchType = "CST836U"; } else { touchController = TC_FT6236; tcd = &FT6236; + boardTouchType = "FT6236"; +#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) + TouchControllerType = 0; +#else TouchControllerType = 1; +#endif } } @@ -354,11 +436,19 @@ struct TouchState touchPanelRead() unsigned short touchY; bool hasTouchContact = tcd->touchRead(&touchX, &touchY); - if (tcd->needTranspose) { - // Touch sensor is rotated by 90 deg - unsigned short tmp = touchY; - touchY = 319 - touchX; - touchX = tmp; + unsigned short tmp; + switch(tcd->rotate) { + case DEG_270: + tmp = touchY; + touchY = 319 - touchX; + touchX = tmp; + break; + case DEG_180: + touchY = 479 - touchY; + touchX = 319 - touchX; + break; + default: + break; } if (hasTouchContact) { diff --git a/radio/src/targets/pl18/usb_descriptor.h b/radio/src/targets/pl18/usb_descriptor.h index 27ec010c9a5..43e3fe62542 100644 --- a/radio/src/targets/pl18/usb_descriptor.h +++ b/radio/src/targets/pl18/usb_descriptor.h @@ -21,12 +21,24 @@ #pragma once -#if defined(RADIO_PL18EV) -#define USB_NAME "FlySky PL18EV" -#define USB_MANUFACTURER 'F', 'l', 'y', 'S', 'k', 'y', ' ', ' ' /* 8 bytes */ -#define USB_PRODUCT 'P', 'L', '1', '8', 'E', 'V', ' ', ' ' /* 8 Bytes */ -#else -#define USB_NAME "FlySky PL18" -#define USB_MANUFACTURER 'F', 'l', 'y', 'S', 'k', 'y', ' ', ' ' /* 8 bytes */ -#define USB_PRODUCT 'P', 'L', '1', '8', ' ', ' ', ' ', ' ' /* 8 Bytes */ +#if defined(RADIO_EL18) + #define USB_NAME "Flysky EL18" + #define USB_MANUFACTURER 'F', 'l', 'y', 's', 'k', 'y', ' ', ' ' /* 8 bytes */ + #define USB_PRODUCT 'E', 'L', '1', '8', ' ', ' ', ' ', ' ' /* 8 Bytes */ +#elif defined(RADIO_NV14) + #define USB_NAME "Flysky NV14" + #define USB_MANUFACTURER 'F', 'l', 'y', 's', 'k', 'y', ' ', ' ' /* 8 bytes */ + #define USB_PRODUCT 'N', 'V', '1', '4', ' ', ' ', ' ', ' ' /* 8 Bytes */ +#elif defined(RADIO_NB4P) + #define USB_NAME "FlySky NB4+" + #define USB_MANUFACTURER 'F', 'l', 'y', 'S', 'k', 'y', ' ', ' ' /* 8 bytes */ + #define USB_PRODUCT 'N', 'B', '4', '+', ' ', ' ', ' ', ' ' /* 8 Bytes */ +#elif defined(RADIO_PL18EV) + #define USB_NAME "FlySky PL18EV" + #define USB_MANUFACTURER 'F', 'l', 'y', 'S', 'k', 'y', ' ', ' ' /* 8 bytes */ + #define USB_PRODUCT 'P', 'L', '1', '8', 'E', 'V', ' ', ' ' /* 8 Bytes */ +#else + #define USB_NAME "FlySky PL18" + #define USB_MANUFACTURER 'F', 'l', 'y', 'S', 'k', 'y', ' ', ' ' /* 8 bytes */ + #define USB_PRODUCT 'P', 'L', '1', '8', ' ', ' ', ' ', ' ' /* 8 Bytes */ #endif diff --git a/radio/src/tests/mixer.cpp b/radio/src/tests/mixer.cpp index 43e36c24ebf..2d541cc4fc7 100644 --- a/radio/src/tests/mixer.cpp +++ b/radio/src/tests/mixer.cpp @@ -660,6 +660,8 @@ TEST_F(MixerTest, RecursiveAddChannel) TEST_F(MixerTest, RecursiveAddChannelAfterInactivePhase) { + if (switchGetMaxSwitches() < 4) return; + g_model.flightModeData[1].swtch = SWSRC_FIRST_SWITCH + 1; g_model.mixData[0].destCh = 0; g_model.mixData[0].mltpx = MLTPX_ADD; diff --git a/radio/src/translations/cn.h b/radio/src/translations/cn.h index d29c78d2cc1..d9b5484ac43 100644 --- a/radio/src/translations/cn.h +++ b/radio/src/translations/cn.h @@ -1044,8 +1044,6 @@ #define TR_BL_HOLD_ENTER_TO_START "\012Hold [ENT] to start writing" #define TR_BL_INVALID_FIRMWARE "\011Not a valid firmware file! " #define TR_BL_INVALID_EEPROM "\011Not a valid EEPROM file! " - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #else #define TR_BL_OR_PLUGIN_USB_CABLE TR_BL_USB_PLUGIN #define TR_BL_HOLD_ENTER_TO_START "\006Hold [ENT] to start" @@ -1069,6 +1067,31 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1076,16 +1099,8 @@ #define TR_BL_SELECT_KEY "[R TRIM] to select file" #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" #define TR_BL_EXIT_KEY " [L TRIM] to exit" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/cz.h b/radio/src/translations/cz.h index d7ac164164a..77b605daf7e 100644 --- a/radio/src/translations/cz.h +++ b/radio/src/translations/cz.h @@ -1082,6 +1082,31 @@ #define TR_BL_FLASH_KEY "Drzet dlouze [ENT] pro nahrani" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] pro ukonceni" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB pristup" + #define TR_BL_CURRENT_FW "Aktualni firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Povoleno" + #define TR_BL_DISABLE "Zakazano" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] pro vybrani souboru" + #define TR_BL_FLASH_KEY "Drzet dlouze [R TRIM] pro nahrani" + #define TR_BL_ERASE_KEY "Drzet dlouze [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] pro ukonceni" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] pro vybrani souboru" + #define TR_BL_FLASH_KEY "Drzet dlouze [SW1A] pro nahrani" + #define TR_BL_ERASE_KEY "Drzet dlouze [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] pro ukonceni" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] pro vybrani souboru" + #define TR_BL_FLASH_KEY "Drzet dlouze [TR4 Dn] pro nahrani" + #define TR_BL_ERASE_KEY "Drzet dlouze [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] pro ukonceni" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB pristup" @@ -1091,16 +1116,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] pro ukonceni" #define TR_BL_ENABLE "Povoleno" #define TR_BL_DISABLE "Zakazano" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" #endif // About screen diff --git a/radio/src/translations/da.h b/radio/src/translations/da.h index 64bcdb2edde..3379b2632c1 100644 --- a/radio/src/translations/da.h +++ b/radio/src/translations/da.h @@ -1070,6 +1070,31 @@ #define TR_BL_FLASH_KEY "[ENT] længe, for at starte" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] for at forlade" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB adgang" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Slet intern flash lager" + #define TR_BL_ERASE_FLASH "Slet flash lager" + #define TR_BL_ERASE_FLASH_MSG "Dette kan vare op til 200s" + #define TR_BL_ENABLE "Aktiver" + #define TR_BL_DISABLE "Deaktiver" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] for at bruge fil" + #define TR_BL_FLASH_KEY "[R TRIM] længe, for at starte" + #define TR_BL_ERASE_KEY "[R TRIM] længe, for sletning" + #define TR_BL_EXIT_KEY "[L TRIM] for at forlade" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] for at bruge fil" + #define TR_BL_FLASH_KEY "Hold [SW1A] længe, for brænding" + #define TR_BL_ERASE_KEY "Hold [SW1A] længe, for sletning" + #define TR_BL_EXIT_KEY "[SW1B] for at forlade" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] for at bruge fil" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] længe, for brænding" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] længe, for sletning" + #define TR_BL_EXIT_KEY "[TR4 Up] for at forlade" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB adgang" @@ -1079,16 +1104,6 @@ #define TR_BL_EXIT_KEY "[L TRIM] for at forlade" #define TR_BL_ENABLE "Aktiver" #define TR_BL_DISABLE "Deaktiver" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB adgang" - #define TR_BL_ERASE_INT_FLASH "Slet intern flash lager" - #define TR_BL_ERASE_FLASH "Slet flash lager" - #define TR_BL_ERASE_FLASH_MSG "Dette kan vare op til 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] for at bruge fil" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] længe, for brænding" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] længe, for sletning" - #define TR_BL_EXIT_KEY " [TR4 Up] for at forlade" #endif // About screen diff --git a/radio/src/translations/de.h b/radio/src/translations/de.h index 085df8707ff..86c7e1392e1 100644 --- a/radio/src/translations/de.h +++ b/radio/src/translations/de.h @@ -1060,6 +1060,31 @@ #define TR_BL_FLASH_KEY "Halte [ENT] gedrückt, zum schreiben" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] zum beenden" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB Zugriff" + #define TR_BL_CURRENT_FW "Aktuelle Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Aktivieren" + #define TR_BL_DISABLE "Deaktivieren" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] um Datei auszuwählen" + #define TR_BL_FLASH_KEY "Halte [R TRIM] gedrückt, zum schreiben" + #define TR_BL_ERASE_KEY "Halte [R TRIM] gedrückt, to erase" + #define TR_BL_EXIT_KEY "[L TRIM] zum beenden" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] um Datei auszuwählen" + #define TR_BL_FLASH_KEY "Halte [SW1A] gedrückt, zum schreiben" + #define TR_BL_ERASE_KEY "Halte [SW1A] gedrückt, to erase" + #define TR_BL_EXIT_KEY "[SW1B] zum beenden" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] um Datei auszuwählen" + #define TR_BL_FLASH_KEY "Halte [TR4 Dn] gedrückt, zum schreiben" + #define TR_BL_ERASE_KEY "Halte [TR4 Dn] gedrückt, to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] zum beenden" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB Zugriff" @@ -1069,16 +1094,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] zum beenden" #define TR_BL_ENABLE "Aktivieren" #define TR_BL_DISABLE "Deaktivieren" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" #endif // Taranis Info Zeile Anzeigen diff --git a/radio/src/translations/en.h b/radio/src/translations/en.h index 6618d5c7637..6f22f86102f 100644 --- a/radio/src/translations/en.h +++ b/radio/src/translations/en.h @@ -1073,6 +1073,31 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1082,16 +1107,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] to exit" #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" #endif // About screen diff --git a/radio/src/translations/es.h b/radio/src/translations/es.h index 523c6485b9b..ac2aa7450f0 100644 --- a/radio/src/translations/es.h +++ b/radio/src/translations/es.h @@ -1068,6 +1068,31 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1077,16 +1102,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] to exit" #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" #endif // About screen diff --git a/radio/src/translations/fi.h b/radio/src/translations/fi.h index 97b7564a5c8..2fd2964099a 100644 --- a/radio/src/translations/fi.h +++ b/radio/src/translations/fi.h @@ -1080,6 +1080,31 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1089,16 +1114,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] to exit" #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" #endif // About screen diff --git a/radio/src/translations/fr.h b/radio/src/translations/fr.h index b0b407eed96..ad7c359467b 100644 --- a/radio/src/translations/fr.h +++ b/radio/src/translations/fr.h @@ -1081,6 +1081,31 @@ #define TR_BL_FLASH_KEY "Appui long [ENT] pour flasher" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] pour quitter" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Firmware actuel:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Activer" + #define TR_BL_DISABLE "Désactiver" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] pour sélect. fichier" + #define TR_BL_FLASH_KEY "Appui long [R TRIM] pour flasher" + #define TR_BL_ERASE_KEY "Appui long [R TRIM] to erase" + #define TR_BL_EXIT_KEY " [L TRIM] pour quitter" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] pour sélect. fichier" + #define TR_BL_FLASH_KEY "Appui long [SW1A] pour flasher" + #define TR_BL_ERASE_KEY "Appui long [SW1A] to erase" + #define TR_BL_EXIT_KEY "[SW1B] pour quitter" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] pour sélect. fichier" + #define TR_BL_FLASH_KEY "Appui long [TR4 Dn] pour flasher" + #define TR_BL_ERASE_KEY "Appui long [TR4 Dn] to erase" + #define TR_BL_EXIT_KEY "[TR4 U] pour quitter" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1090,16 +1115,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] pour quitter" #define TR_BL_ENABLE "Activer" #define TR_BL_DISABLE "Désactiver" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" #endif // About screen diff --git a/radio/src/translations/he.h b/radio/src/translations/he.h index 633e5bc7f46..e3a74660d14 100644 --- a/radio/src/translations/he.h +++ b/radio/src/translations/he.h @@ -1070,6 +1070,31 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1079,16 +1104,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] to exit" #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" #endif // About screen diff --git a/radio/src/translations/it.h b/radio/src/translations/it.h index 9476941a5da..8863a5b1c48 100644 --- a/radio/src/translations/it.h +++ b/radio/src/translations/it.h @@ -1065,6 +1065,31 @@ #define TR_BL_FLASH_KEY "Tenere premuto [ENT] per scrivere" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] per uscire" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF Accesso USB" + #define TR_BL_CURRENT_FW "Firmware corrente:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Abilita" + #define TR_BL_DISABLE "Disabilita" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] per scegliere il file" + #define TR_BL_FLASH_KEY "Tener premuto [R TRIM] per scrivere" + #define TR_BL_ERASE_KEY "Tener premuto [R TRIM] to erase" + #define TR_BL_EXIT_KEY "[L TRIM] per uscire" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] per scegliere il file" + #define TR_BL_FLASH_KEY "Tener premuto [SW1A] per scrivere" + #define TR_BL_ERASE_KEY "Tener premuto [SW1A] to erase" + #define TR_BL_EXIT_KEY "[SW1B] per uscire" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] per scegliere il file" + #define TR_BL_FLASH_KEY "Tener premuto [TR4 Dn] per scrivere" + #define TR_BL_ERASE_KEY "Tener premuto [TR4 Dn] to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] per uscire" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF Accesso USB" @@ -1074,16 +1099,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] per uscire" #define TR_BL_ENABLE "Abilita" #define TR_BL_DISABLE "Disabilita" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" #endif // About screen diff --git a/radio/src/translations/jp.h b/radio/src/translations/jp.h index c71f6720866..391834038f5 100644 --- a/radio/src/translations/jp.h +++ b/radio/src/translations/jp.h @@ -1070,6 +1070,31 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1079,16 +1104,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] to exit" #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" #endif // About screen diff --git a/radio/src/translations/nl.h b/radio/src/translations/nl.h index f9644277fa2..6c6d302e7d4 100644 --- a/radio/src/translations/nl.h +++ b/radio/src/translations/nl.h @@ -1073,6 +1073,31 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1082,16 +1107,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] to exit" #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" #endif // About screen diff --git a/radio/src/translations/pl.h b/radio/src/translations/pl.h index bbc0c15bc36..a4c7aa7fa94 100644 --- a/radio/src/translations/pl.h +++ b/radio/src/translations/pl.h @@ -1067,6 +1067,31 @@ #define TR_BL_FLASH_KEY "Przytrzymaj [ENT] aby flashowac" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] aby wyjsc" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "Dostep RF USB" + #define TR_BL_CURRENT_FW "Obecny firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] aby wybrac plik" + #define TR_BL_FLASH_KEY "Przytrzymaj [R TRIM] aby flashowac" + #define TR_BL_ERASE_KEY "Przytrzymaj [R TRIM] to erase" + #define TR_BL_EXIT_KEY "[L TRIM] aby wyjsc" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] aby wybrac plik" + #define TR_BL_FLASH_KEY "Przytrzymaj [SW1A] aby flashowac" + #define TR_BL_ERASE_KEY "Przytrzymaj [SW1A] to erase" + #define TR_BL_EXIT_KEY "[SW1B] aby wyjsc" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] aby wybrac plik" + #define TR_BL_FLASH_KEY "Przytrzymaj [TR4 Dn] aby flashowac" + #define TR_BL_ERASE_KEY "Przytrzymaj [TR4 Dn] to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] aby wyjsc" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "Dostep RF USB" @@ -1076,16 +1101,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] aby wyjsc" #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" #endif // About screen diff --git a/radio/src/translations/pt.h b/radio/src/translations/pt.h index 376207e13c7..b480796a510 100644 --- a/radio/src/translations/pt.h +++ b/radio/src/translations/pt.h @@ -1074,6 +1074,31 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1082,17 +1107,7 @@ #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" #define TR_BL_EXIT_KEY " [L TRIM] to exit" #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Desativar" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/ru.h b/radio/src/translations/ru.h index 4673472c8ef..6ca14de42c5 100644 --- a/radio/src/translations/ru.h +++ b/radio/src/translations/ru.h @@ -1073,6 +1073,31 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1082,16 +1107,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] to exit" #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" #endif // About screen diff --git a/radio/src/translations/se.h b/radio/src/translations/se.h index c75f6351c58..28f9b29dd95 100644 --- a/radio/src/translations/se.h +++ b/radio/src/translations/se.h @@ -1096,6 +1096,31 @@ #define TR_BL_FLASH_KEY "Tryck [ENT] foer att flasha" #define TR_BL_ERASE_KEY "Haall ner [ENT] foer att raderag" #define TR_BL_EXIT_KEY "[RTN] foer att avbryta" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Nuvarande firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Aktivera" + #define TR_BL_DISABLE "Inaktivera" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] foer att vaelja fil" + #define TR_BL_FLASH_KEY "Tryck [R TRIM] foer att flasha" + #define TR_BL_ERASE_KEY "Tryck [R TRIM] foer att erase" + #define TR_BL_EXIT_KEY "[L TRIM] för att avsluta" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] foer att vaelja fil" + #define TR_BL_FLASH_KEY "Tryck [SW1A] foer att flasha" + #define TR_BL_ERASE_KEY "Tryck [SW1A] foer att erase" + #define TR_BL_EXIT_KEY "[SW1B] för att avsluta" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] foer att vaelja fil" + #define TR_BL_FLASH_KEY "Tryck [TR4 Dn] foer att flasha" + #define TR_BL_ERASE_KEY "Tryck [TR4 Dn] foer att erase" + #define TR_BL_EXIT_KEY "[TR4 Up] för att avsluta" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1105,16 +1130,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] för att avsluta" #define TR_BL_ENABLE "Aktivera" #define TR_BL_DISABLE "Inaktivera" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Radera interna flashminnet" - #define TR_BL_ERASE_FLASH "Radera flashminnet" - #define TR_BL_ERASE_FLASH_MSG "Detta kan ta upp till 200s" - #define TR_BL_SELECT_KEY " Tryck [TR4 Ner] foer att vaelja fil" - #define TR_BL_FLASH_KEY " Haall [TR4 Ner] foer att flasha" - #define TR_BL_ERASE_KEY " Haall [TR4 Ner] foer att radera" - #define TR_BL_EXIT_KEY " Tryck [TR4 Upp] foer att avbryta" #endif // About screen diff --git a/radio/src/translations/tw.h b/radio/src/translations/tw.h index d42ee4d93bd..756abced9fb 100644 --- a/radio/src/translations/tw.h +++ b/radio/src/translations/tw.h @@ -1072,6 +1072,31 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1081,16 +1106,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] to exit" #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" #endif // About screen diff --git a/radio/src/translations/ua.h b/radio/src/translations/ua.h index 0cfe90f96d5..2a522625d88 100644 --- a/radio/src/translations/ua.h +++ b/radio/src/translations/ua.h @@ -1069,6 +1069,31 @@ #define TR_BL_SELECT_KEY "[ENT] to select file" #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_EXIT_KEY "[RTN] to exit" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1078,16 +1103,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] to exit" #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" -#elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" #endif // About screen diff --git a/radio/util/hw_defs/hal_adc.py b/radio/util/hw_defs/hal_adc.py index 3b5be8cd190..f21410fe162 100644 --- a/radio/util/hw_defs/hal_adc.py +++ b/radio/util/hw_defs/hal_adc.py @@ -3,6 +3,7 @@ MAX_POTS = 4 MAX_SLIDERS = 4 MAX_EXTS = 4 +MAX_RAWS = 4 def eprint(*args, **kwargs): @@ -14,6 +15,7 @@ class ADCInput: TYPE_STICK = 'STICK' TYPE_FLEX = 'FLEX' TYPE_SWITCH = 'SWITCH' + TYPE_RAW = 'RAW' # TYPE_BATT = 'BATT' def __init__(self, name, adc_input_type, adc, gpio, pin, channel): @@ -76,6 +78,12 @@ class ADCInputParser: 'suffix': 'EXT{}', 'name': 'EXT{}', }, + { + 'range': range(1, MAX_RAWS + 1), + 'type': ADCInput.TYPE_RAW, + 'suffix': 'RAW{}', + 'name': 'RAW{}', + }, { 'range': range(1, 2 + 1), 'type': ADCInput.TYPE_FLEX, diff --git a/radio/util/hw_defs/hal_adc_inputs.jinja b/radio/util/hw_defs/hal_adc_inputs.jinja index 19a860d0346..26d15829250 100644 --- a/radio/util/hw_defs/hal_adc_inputs.jinja +++ b/radio/util/hw_defs/hal_adc_inputs.jinja @@ -21,7 +21,16 @@ static const etx_hal_adc_input_t _flex_inputs[] = { {% endfor %} }; -{% set vbat_offset = flex_offset + n_flex %} +{% set raw_offset = flex_offset + n_flex %} +{% set raw_inputs = adc_inputs.inputs | selectattr('type', '==', 'RAW') | list %} +{% set n_raw = raw_inputs | count %} +static const etx_hal_adc_input_t _raw_inputs[] = { + {% for input in raw_inputs %} + { "{{ input.name }}", "{{ input.label }}", "{{ input.short_label }}" }, + {% endfor %} +}; + +{% set vbat_offset = raw_offset + n_raw %} {% set vbat_inputs = adc_inputs.inputs | selectattr('type', '==', 'VBAT') | list %} {% set n_vbat = vbat_inputs | count %} static const etx_hal_adc_input_t _vbat_inputs[] = { diff --git a/radio/util/hw_defs/legacy_names.py b/radio/util/hw_defs/legacy_names.py index 1eb60d719a7..1f4ea132544 100644 --- a/radio/util/hw_defs/legacy_names.py +++ b/radio/util/hw_defs/legacy_names.py @@ -679,6 +679,37 @@ } } }, + { + "targets": { + "nb4p" + }, + "inputs": { + "ST": { + "yaml": "ST", + "lua": "ste", + "description": "Steering" + }, + "TH": { + "yaml": "TH", + "lua": "thr", + "description": "Throttle" + }, + "P1": { + "yaml": "POT1", + "lua": "s1", + "label": "VR1L", + "short_label": "1", + "description": "Potentiometer 1" + }, + "P2": { + "yaml": "POT2", + "lua": "s2", + "label": "VR1R", + "short_label": "2", + "description": "Potentiometer 2" + } + } + }, { "targets": {"v12", "v14"}, "inputs": { diff --git a/radio/util/hw_defs/pot_config.py b/radio/util/hw_defs/pot_config.py index 153beb93c8a..6f4f6b3276d 100644 --- a/radio/util/hw_defs/pot_config.py +++ b/radio/util/hw_defs/pot_config.py @@ -39,6 +39,10 @@ "EXT3": {"default": "MULTIPOS"}, "EXT4": {"default": "MULTIPOS"} }, + "nb4p": { + "P1": {"default": "POT"}, + "P2": {"default": "POT"} + }, "v12": { "P1": {"default": "POT_CENTER"}, "P2": {"default": "POT_CENTER"}, diff --git a/radio/util/hw_defs/stm32_keys.jinja b/radio/util/hw_defs/stm32_keys.jinja index e3271f56778..2a01d08a2d9 100644 --- a/radio/util/hw_defs/stm32_keys.jinja +++ b/radio/util/hw_defs/stm32_keys.jinja @@ -3,15 +3,18 @@ // This file has been generated from the target's JSON hardware description // +{% set hw_keys = keys | rejectattr('pin', 'none') | rejectattr('gpio', 'none') | list %} static inline void _init_keys() { {% for key_gpio, pins in key_gpios | dictsort %} - stm32_gpio_enable_clock({{ key_gpio }}); + {% if key_gpio %} + stm32_gpio_enable_clock({{ key_gpio }}); + {% endif %} {% endfor %} LL_GPIO_InitTypeDef pinInit; LL_GPIO_StructInit(&pinInit); pinInit.Mode = LL_GPIO_MODE_INPUT; -{% for key in keys %} +{% for key in hw_keys %} pinInit.Pin = {{ key.pin }}; pinInit.Pull = {{ 'LL_GPIO_PULL_UP' if key.active_low else 'LL_GPIO_PULL_DOWN' }}; LL_GPIO_Init({{ key.gpio }}, &pinInit); @@ -21,7 +24,7 @@ static inline void _init_keys() static inline uint32_t _read_keys() { uint32_t keys = 0; -{% for key in keys %} +{% for key in hw_keys %} if ({{'!' if key.active_low }}LL_GPIO_IsInputPinSet({{ key.gpio }}, {{ key.pin }})) keys |= (1 << {{ key.key }}); {% endfor %} diff --git a/radio/util/hw_defs/stm32_switches.jinja b/radio/util/hw_defs/stm32_switches.jinja index 32010075f0e..fcc4eda1bae 100644 --- a/radio/util/hw_defs/stm32_switches.jinja +++ b/radio/util/hw_defs/stm32_switches.jinja @@ -59,9 +59,11 @@ static inline void _init_switches() pinInit.Mode = LL_GPIO_MODE_INPUT; pinInit.Pull = LL_GPIO_PULL_UP; {% for sw_gpio, pins in switch_gpios.items() | sort %} + {% if sw_gpio %} stm32_gpio_enable_clock({{ sw_gpio }}); pinInit.Pin = {{ pins | join('|') }}; LL_GPIO_Init({{ sw_gpio }}, &pinInit); + {% endif %} {% endfor %} } diff --git a/radio/util/hw_defs/switch_config.py b/radio/util/hw_defs/switch_config.py index 523cc69f81e..d7522d323b4 100644 --- a/radio/util/hw_defs/switch_config.py +++ b/radio/util/hw_defs/switch_config.py @@ -65,6 +65,10 @@ "SI": { "default": "3POS" }, "SJ": { "default": "3POS" } }, + "nb4p": { + "SA" : { "default": "TOGGLE" }, + "SB" : { "default": "TOGGLE" } + }, "lr3pro": { # left side "SA": {"default": "3POS", "display": [0, 0]}, diff --git a/tools/build-common.sh b/tools/build-common.sh index 6989b4f900b..7a7dd7fc09e 100644 --- a/tools/build-common.sh +++ b/tools/build-common.sh @@ -132,10 +132,10 @@ get_target_build_options() { BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=V16" ;; nv14) - BUILD_OPTIONS+="-DPCB=NV14" + BUILD_OPTIONS+="-DPCB=PL18 -DPCBREV=NV14" ;; el18) - BUILD_OPTIONS+="-DPCB=NV14 -DPCBREV=EL18" + BUILD_OPTIONS+="-DPCB=PL18 -DPCBREV=EL18" ;; pl18) BUILD_OPTIONS+="-DPCB=PL18" @@ -143,6 +143,9 @@ get_target_build_options() { pl18ev) BUILD_OPTIONS+="-DPCB=PL18 -DPCBREV=PL18EV" ;; + nb4p) + BUILD_OPTIONS+="-DPCB=PL18 -DPCBREV=NB4P" + ;; *) echo "Unknown target: $target_name" return 1 diff --git a/tools/build-flysky.py b/tools/build-flysky.py index 22be920ccee..a327f5c49e0 100644 --- a/tools/build-flysky.py +++ b/tools/build-flysky.py @@ -9,8 +9,8 @@ boards = { - "NV14": { "PCB": "NV14" }, - "EL18": { "PCB": "NV14", "PCBREV": "EL18" }, + "NV14": { "PCB": "PL18", "PCBREV": "NV14" }, + "EL18": { "PCB": "PL18", "PCBREV": "EL18" }, "PL18": { "PCB": "PL18" }, "PL18EV": { "PCB": "PL18", "PCBREV": "PL18EV" }, } diff --git a/tools/generate-yaml.sh b/tools/generate-yaml.sh index 71ada347431..dcdef10b9b1 100755 --- a/tools/generate-yaml.sh +++ b/tools/generate-yaml.sh @@ -11,7 +11,7 @@ if [[ -n ${GCC_ARM} ]] ; then export PATH=${GCC_ARM}:$PATH fi -: ${FLAVOR:="t15;tx16s;nv14;pl18;x9d;x9dp2019;x9e;xlite;xlites;x7;tpro;t20;f16;gx12"} +: ${FLAVOR:="t15;tx16s;nv14;pl18;nb4p;x9d;x9dp2019;x9e;xlite;xlites;x7;tpro;t20;f16;gx12"} : ${SRCDIR:=$(dirname "$(pwd)/$0")/..} : ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_RULE_MESSAGES=OFF -Wno-dev -DDISABLE_COMPANION=YES -DCMAKE_MESSAGE_LOG_LEVEL=WARNING"}