diff --git a/companion/src/firmwares/edgetx/yaml_customfunctiondata.cpp b/companion/src/firmwares/edgetx/yaml_customfunctiondata.cpp index 29a016604..f0475f47b 100644 --- a/companion/src/firmwares/edgetx/yaml_customfunctiondata.cpp +++ b/companion/src/firmwares/edgetx/yaml_customfunctiondata.cpp @@ -27,7 +27,8 @@ static bool fnHasEnable(AssignFunc fn) return (fn <= FuncInstantTrim) || (fn >= FuncReset && fn <= FuncSetTimerLast) || (fn >= FuncAdjustGV1 && fn <= FuncBindExternalModule) - || (fn == FuncVolume); + || (fn == FuncVolume) + || (fn == FuncBacklight); } static bool fnHasRepeat(AssignFunc fn) diff --git a/companion/src/firmwares/edgetx/yaml_generalsettings.cpp b/companion/src/firmwares/edgetx/yaml_generalsettings.cpp index d5c5ddaea..c46d6f50e 100644 --- a/companion/src/firmwares/edgetx/yaml_generalsettings.cpp +++ b/companion/src/firmwares/edgetx/yaml_generalsettings.cpp @@ -147,6 +147,7 @@ Node convert::encode(const GeneralSettings& rhs) node["gpsFormat"] = rhs.gpsFormat; node["speakerVolume"] = rhs.speakerVolume + 12; node["backlightBright"] = rhs.backlightBright; + node["blOffBright"] = rhs.backlightOffBright; node["switchesDelay"] = rhs.switchesDelay; node["globalTimer"] = rhs.globalTimer; node["bluetoothName"] = rhs.bluetoothName; @@ -169,6 +170,8 @@ Node convert::encode(const GeneralSettings& rhs) node["aux2SerialMode"] = uartModeLut << rhs.aux2SerialMode; node["antennaMode"] = antennaModeLut << rhs.antennaMode; node["backlightColor"] = rhs.backlightColor; + node["pwrOnSpeed"] = rhs.pwrOnSpeed; + node["pwrOffSpeed"] = rhs.pwrOffSpeed; for (int i = 0; i < CPN_MAX_SPECIAL_FUNCTIONS; i++) { const CustomFunctionData& fn = rhs.customFn[i]; @@ -304,6 +307,7 @@ bool convert::decode(const Node& node, GeneralSettings& rhs) node["gpsFormat"] >> rhs.gpsFormat; node["speakerVolume"] >> ioffset_int(rhs.speakerVolume, 12); node["backlightBright"] >> rhs.backlightBright; + node["blOffBright"] >> rhs.backlightOffBright; node["switchesDelay"] >> rhs.switchesDelay; node["globalTimer"] >> rhs.globalTimer; node["bluetoothName"] >> rhs.bluetoothName; @@ -326,6 +330,9 @@ bool convert::decode(const Node& node, GeneralSettings& rhs) node["aux2SerialMode"] >> uartModeLut >> rhs.aux2SerialMode; node["antennaMode"] >> antennaModeLut >> rhs.antennaMode; node["backlightColor"] >> rhs.backlightColor; + node["pwrOnSpeed"] >> rhs.pwrOnSpeed; + node["pwrOffSpeed"] >> rhs.pwrOffSpeed; + node["customFn"] >> rhs.customFn; YamlStickConfig stickConfig; diff --git a/companion/src/firmwares/edgetx/yaml_modeldata.cpp b/companion/src/firmwares/edgetx/yaml_modeldata.cpp index 66b4f87f7..5ee008b1f 100644 --- a/companion/src/firmwares/edgetx/yaml_modeldata.cpp +++ b/companion/src/firmwares/edgetx/yaml_modeldata.cpp @@ -369,7 +369,7 @@ struct convert { Node node; node["value"] = rhs.value; if (rhs.mode < 0) { - node["mode"] = -1; + node["mode"] = (1 << 5) - 1; } else { node["mode"] = 2 * rhs.ref + rhs.mode; } @@ -381,8 +381,8 @@ struct convert { int trimMode = 0; node["mode"] >> trimMode; - if (trimMode < 0) { - rhs.mode = trimMode; + if (trimMode == (1 << 5) - 1) { + rhs.mode = -1; } else { rhs.mode = trimMode % 2; rhs.ref = trimMode / 2; diff --git a/companion/src/firmwares/edgetx/yaml_rawsource.cpp b/companion/src/firmwares/edgetx/yaml_rawsource.cpp index 2e32bcf3c..d9bbbbfef 100644 --- a/companion/src/firmwares/edgetx/yaml_rawsource.cpp +++ b/companion/src/firmwares/edgetx/yaml_rawsource.cpp @@ -49,7 +49,7 @@ std::string YamlRawSourceEncode(const RawSource& rhs) break; case SOURCE_TYPE_CUSTOM_SWITCH: src_str += "ls("; - src_str += std::to_string(rhs.index); + src_str += std::to_string(rhs.index + 1); src_str += ")"; break; case SOURCE_TYPE_CYC: @@ -108,7 +108,7 @@ RawSource YamlRawSourceDecode(const std::string& src_str) if (idx < CPN_MAX_INPUTS) { rhs = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, idx); } - } else if (val_len >= 2 + } else if (val_len == 2 && val[0] == 'S' && val[1] >= 'A' && val[1] <= 'Z') { @@ -139,8 +139,8 @@ RawSource YamlRawSourceDecode(const std::string& src_str) std::stringstream src(src_str.substr(3)); int ls = 0; src >> ls; - if (ls < CPN_MAX_LOGICAL_SWITCHES) - rhs = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, ls); + if (ls > 0 && ls < CPN_MAX_LOGICAL_SWITCHES) + rhs = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, ls - 1); } else if (val_len > 3 && val[0] == 't' && diff --git a/companion/src/firmwares/edgetx/yaml_rawswitch.cpp b/companion/src/firmwares/edgetx/yaml_rawswitch.cpp index d1e7e6a3f..0b83ea70c 100644 --- a/companion/src/firmwares/edgetx/yaml_rawswitch.cpp +++ b/companion/src/firmwares/edgetx/yaml_rawswitch.cpp @@ -50,7 +50,7 @@ std::string YamlRawSwitchEncode(const RawSwitch& rhs) break; case SWITCH_TYPE_TRIM: - sw_str += getCurrentFirmware()->getTrimSwitchesTag(sval); + sw_str += getCurrentFirmware()->getTrimSwitchesTag(sval - 1); break; case SWITCH_TYPE_FLIGHT_MODE: @@ -132,7 +132,7 @@ RawSwitch YamlRawSwitchDecode(const std::string& sw_str) int tsw_idx = getCurrentFirmware()->getTrimSwitchesIndex(sw_str_tmp.c_str()); if (tsw_idx >= 0) { rhs.type = SWITCH_TYPE_TRIM; - rhs.index = tsw_idx; + rhs.index = tsw_idx + 1; } } else if (val_len >= 3 && val[0] == 'S' &&