From 8d0d8ad33f7e3b4ff4a2fabca4192c862bf1729d Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Tue, 6 Aug 2024 09:38:52 +0000 Subject: [PATCH 1/6] Squashed commit of #2085 commit e898e851460f0b76873d4442cdc8144474863f5e Author: Peter Feerick Date: Wed Dec 7 19:43:16 2022 +1000 chore: Cleanup commit e0b2b3e7f44d15d01a6056fc3e605431271cad31 Author: Peter Feerick Date: Wed Dec 7 16:30:28 2022 +1000 fix: Updated translation files commit 68594e606ae5b7d32ecf7102074d1f207dc131ed Author: Peter Feerick Date: Wed Dec 7 16:22:03 2022 +1000 fix: Add missing LR3 and TX12MKII, rebase cleanup commit 55d0fa591533660287232f7db7308a5775bdab7c Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Mon Oct 10 20:14:57 2022 +1100 Companion: model edit Mixes view shows Mix name in a column for easy reference commit ce36ca63d051f01f81664f63705c9c541bc422d7 Author: elecpower Date: Mon Oct 10 08:38:21 2022 +1100 cpn: refresh all model refs to LS when name changed. UI tweaks. commit a58c3a4b8dc948f64f2655c31e5f3731c8df4c93 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sun Oct 9 15:27:34 2022 +1100 display friendly LS name on viewlayout commit 785c6b64978ab91b4882d6bd405cd8196329e819 Author: Peter Feerick Date: Mon Sep 26 16:40:38 2022 +1000 chore: Set codename commit 65333741218537ce1a0b8fc11cc2f67511d6d905 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sat Oct 8 19:13:51 2022 +1100 TODO: put LS friendly name on radio output window. commit 29b35fdaf2adca67bb733da7e2e84572c797e31e Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sat Oct 8 16:47:57 2022 +1100 companion: dynamily populate list with LS name commit 2fe540b70a4e59907b9c6d66dd3cd4d2a5be03d0 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sat Oct 8 14:36:42 2022 +1100 Companion: bug: display correct name commit a54b5e482f8d7b166ddeff64a34c1c88ac5823b3 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sat Oct 8 14:15:27 2022 +1100 companion: display LS friendly name in Comboxes commit 3e8b1ab23446d4d4e45886a2b2ddd26e8084cdd5 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Thu Oct 6 20:02:19 2022 +1100 special funcns: stop data loss in selectin new ch commit 776ead9fc412139046904f026f783ebaab26c5a3 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sun Oct 2 13:00:58 2022 +1100 logic sw & custom fn: friendly name copy & paste commit 207650e95dd99f707c7d1758933bdab8348de29f Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sat Oct 1 22:40:40 2022 +1000 Companion: custom function Friendly Name Label commit 45b0b7b9dd87f9fa0eb0c3018431bc60c25f2e4e Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sat Oct 1 15:29:57 2022 +1000 Companion: new Logic Switch & Friendly Name Label commit f380a35473c0d636fd8086b370760ea7885926c6 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sat Oct 1 15:25:50 2022 +1000 storage conversions for Logic switch Safe commit 52601fd787430e9b4e6bb2838cebb557d063fba1 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sat Oct 1 15:22:15 2022 +1000 bug: re enabled logic switch sticky. commit 7c19f89c2e9f2b205270cb318eafc3cec9b5dbe6 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sat Oct 1 05:16:05 2022 +0000 print logic switch safe commit 42331d9dfa3e26198e51b5ad633d5ce967612918 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Mon Jun 20 14:30:37 2022 +1000 translations non English Texts (cherry picked from commit 8ee9c821034b7dd84b981eb1a845025afd384575) commit 19cdbfd1c4bff117056090caa2baa1247b2d908e Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Tue Jun 14 07:56:37 2022 +0000 update gui for new logic switch type (cherry picked from commit 6fd47d7b54c089c4e813cb6b2fa95bbdfd779adb) commit 5a631cdd076b787c8906e5851d4b5a2e531cdc05 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Tue Jun 14 01:14:20 2022 +0000 removed AndSw for Logic Switch mode Safe (cherry picked from commit 0d95f2f9e5780b914188c0736a0736f326a62547) commit c7c751245e210c6b6739c22d781ccd7bf50e5033 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Tue Jun 14 01:04:56 2022 +0000 evaluation logic for LogicSwitchFunctionSafe: disassociates the AndSwitch from affecting the new Logic Switch Type (cherry picked from commit 62a3fd10037346ea08df7e4cc77b94ec159f96d5) commit 3da59ea5a7eaae0027f7fe4519545b163cba2d34 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Mon Jun 13 02:26:14 2022 +0000 new logic switch type Safe graphical display (cherry picked from commit c3f1a32107b63bbacd5ffd2633105684c5780aa3) commit 90d27e77eb7ce574623bf0a91b1f64b32edf4641 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sun Jun 12 23:09:38 2022 +0000 English translations commit 767b765b1bc734e1728ceeb4e0fc15c82352afcd Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sun Jun 12 22:49:41 2022 +0000 new logical switch function in dropdown (cherry picked from commit 5b165c05a559ec46b12777510856b024149b30aa) commit d1ae63de8a35e9bddbc2ce8253b884336bc24212 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sun Jun 12 22:47:00 2022 +0000 new logic switch family (cherry picked from commit 514a60e2ed38544d11815dec024a4993f2946036) commit 195c3256faf972591ee4bac85dd6be914c274f69 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Tue Jun 7 15:56:55 2022 +1000 radio\src\gui\colorlcd\special_functions.cpp changed variable from translation to dynamic string (cherry picked from commit 1d4a0f42b4e642389948a7e5b582545b450c78a9) commit b372cd3b77da08911a4ce5be9995d63c5ea874e6 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Tue Jun 7 15:26:25 2022 +1000 Update en.h re enabled definition inorder to compile simu (cherry picked from commit 2ca101cef51a132fd4d5c662792b2b508e99263d) commit 41782df3ee3ba6e5f877d303427ef621d4ea1a5d Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Tue Jun 7 15:19:45 2022 +1000 radio\src\translations\en.h moved translations to txt file as requested by @eshifri (cherry picked from commit d10f5d634f10ca8eecf79f1ceef6c9b43554cee4) commit ba8a0f799a435a63c6ed9771c7f7d8cc6e154a41 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Tue Jun 7 15:04:23 2022 +1000 Update special_functions.cpp changed variable from string to translation (cherry picked from commit 65df17bf1f03ab53fef98f1309b743234babd517) commit 39661a00c4d2979181c620289833384859b9006f Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sun Jun 5 09:34:03 2022 +1000 Update special_functions.cpp fixed string changed to translation (cherry picked from commit 52366eed73004b1dea153dff35bd45a0f993a35e) commit 114c69d5b9d282d7c4687695461ccc59bbaaac04 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sun Jun 5 09:01:28 2022 +1000 Update translations.cpp variable for model special function custom name (cherry picked from commit a8c494285d774c0d2268dd96ed615a957e3767c9) commit 843ae4ddbe878ba0c6871eb05bf6bf57da144fc8 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sun Jun 5 08:51:21 2022 +1000 Update en.h in special functions edit screen, variable data for English translation (cherry picked from commit 82490e34094ea0ed740e58bcffe95ad66d084ca7) commit 9d588e6b430f7a51963fa307a6ee9fc108709143 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sun Jun 5 07:56:55 2022 +1000 Update special_functions.cpp removed code comment (cherry picked from commit 391ad2f44d538c594e278e6be4bfc49714a5ff40) commit 00030ded93e9372e9bdae17d8a39caeca807d76c Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sat Jun 4 21:11:28 2022 +1000 Update special_functions.cpp paint special function custom name (cherry picked from commit 59fc7c1938cd9cea8618d7b80af9c70a96cf0921) commit 5c16aefff5a7770a26545d8fa49ec22f72e501d7 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Sat Jun 4 20:52:24 2022 +1000 Update yaml_datastructs_funcs.cpp increase data size (cherry picked from commit 98276f4d3f1aab8ad4f699349ec7659df5f5225a) commit 13581d11dad4c38f1a6410801151c2ad7d86a020 Author: shane-droid <61736830+shane-droid@users.noreply.github.com> Date: Thu Jun 2 21:34:58 2022 +1000 special functions gui --- companion/src/firmwares/customfunctiondata.h | 3 + .../edgetx/yaml_customfunctiondata.cpp | 4 + .../edgetx/yaml_logicalswitchdata.cpp | 18 +- companion/src/firmwares/logicalswitchdata.cpp | 12 +- companion/src/firmwares/logicalswitchdata.h | 13 +- companion/src/firmwares/modeldata.cpp | 6 + .../src/firmwares/opentx/opentxeeprom.cpp | 5 +- companion/src/firmwares/rawsource.cpp | 2 +- companion/src/firmwares/rawswitch.cpp | 12 +- companion/src/modeledit/customfunctions.cpp | 51 +++- companion/src/modeledit/customfunctions.h | 2 + companion/src/modeledit/logicalswitches.cpp | 47 +++- companion/src/modeledit/logicalswitches.h | 7 +- companion/src/modelprinter.cpp | 15 ++ .../src/simulation/radiooutputswidget.cpp | 8 +- radio/src/dataconstants.h | 3 + radio/src/datastructs.h | 30 +-- radio/src/datastructs_private.h | 2 + .../mainview/view_logical_switches.cpp | 10 + .../colorlcd/model/model_logical_switches.cpp | 21 +- .../gui/colorlcd/model/special_functions.cpp | 10 +- radio/src/myeeprom.h | 1 + .../storage/yaml/yaml_datastructs_128x64.cpp | 9 +- .../src/storage/yaml/yaml_datastructs_f16.cpp | 9 +- .../storage/yaml/yaml_datastructs_funcs.cpp | 14 ++ .../storage/yaml/yaml_datastructs_nv14.cpp | 9 +- .../storage/yaml/yaml_datastructs_pl18.cpp | 9 +- .../src/storage/yaml/yaml_datastructs_t15.cpp | 9 +- .../src/storage/yaml/yaml_datastructs_t20.cpp | 9 +- .../storage/yaml/yaml_datastructs_tpro.cpp | 9 +- .../src/storage/yaml/yaml_datastructs_x10.cpp | 9 +- .../src/storage/yaml/yaml_datastructs_x9d.cpp | 9 +- .../yaml/yaml_datastructs_x9dp2019.cpp | 9 +- .../src/storage/yaml/yaml_datastructs_x9e.cpp | 9 +- .../storage/yaml/yaml_datastructs_xlite.cpp | 9 +- .../storage/yaml/yaml_datastructs_xlites.cpp | 9 +- radio/src/switches.cpp | 228 ++++++++++-------- radio/src/switches.h | 1 + radio/src/translations.cpp | 2 + radio/src/translations.h | 2 + radio/src/translations/cn.h | 1 + radio/src/translations/cz.h | 2 + radio/src/translations/da.h | 4 +- radio/src/translations/de.h | 4 +- radio/src/translations/en.h | 6 +- radio/src/translations/es.h | 4 +- radio/src/translations/fi.h | 4 +- radio/src/translations/fr.h | 4 +- radio/src/translations/it.h | 8 +- radio/src/translations/jp.h | 4 +- radio/src/translations/nl.h | 4 +- radio/src/translations/pl.h | 4 +- radio/src/translations/pt.h | 4 +- radio/src/translations/se.h | 4 +- radio/src/translations/tw.h | 4 +- 55 files changed, 500 insertions(+), 207 deletions(-) diff --git a/companion/src/firmwares/customfunctiondata.h b/companion/src/firmwares/customfunctiondata.h index d4f824e8898..11ab8cb23ff 100644 --- a/companion/src/firmwares/customfunctiondata.h +++ b/companion/src/firmwares/customfunctiondata.h @@ -28,6 +28,8 @@ #include #include +#define CF_CUSTNAME_LEN 10 + class Firmware; class ModelData; class GeneralSettings; @@ -109,6 +111,7 @@ class CustomFunctionData { unsigned int enabled; // TODO perhaps not any more the right name unsigned int adjustMode; int repeatParam; + char custName[CF_CUSTNAME_LEN + 1]; void convert(RadioDataConversionState & cstate); diff --git a/companion/src/firmwares/edgetx/yaml_customfunctiondata.cpp b/companion/src/firmwares/edgetx/yaml_customfunctiondata.cpp index f902e13bb5a..02be227efa1 100644 --- a/companion/src/firmwares/edgetx/yaml_customfunctiondata.cpp +++ b/companion/src/firmwares/edgetx/yaml_customfunctiondata.cpp @@ -257,6 +257,8 @@ Node convert::encode(const CustomFunctionData& rhs) node["def"] = def; } + node["custName"] = rhs.custName; + return node; } @@ -265,6 +267,8 @@ bool convert::decode(const Node& node, { node["swtch"] >> rhs.swtch; + node["custName"] >> rhs.custName; + int func = 0; node["func"] >> customFnLut >> func; rhs.func = (AssignFunc)func; diff --git a/companion/src/firmwares/edgetx/yaml_logicalswitchdata.cpp b/companion/src/firmwares/edgetx/yaml_logicalswitchdata.cpp index b3f5eff5f31..bea44ef4de9 100644 --- a/companion/src/firmwares/edgetx/yaml_logicalswitchdata.cpp +++ b/companion/src/firmwares/edgetx/yaml_logicalswitchdata.cpp @@ -42,6 +42,7 @@ static const YamlLookupTable funcLut = { {LS_FN_DAPOS, "FUNC_ADIFFEGREATER"}, {LS_FN_TIMER, "FUNC_TIMER"}, {LS_FN_STICKY, "FUNC_STICKY"}, + {LS_FN_SAFE, "FUNC_SAFE"}, }; static int timerValue2lsw(uint32_t t) @@ -80,6 +81,12 @@ Node convert::encode(const LogicalSwitchData& rhs) def += YamlRawSwitchEncode(RawSwitch(rhs.val2)); } break; + case LS_FAMILY_SAFE: { + def += YamlRawSwitchEncode(RawSwitch(rhs.val1)); + def += ","; + def += YamlRawSwitchEncode(RawSwitch(rhs.val2)); + } break; + case LS_FAMILY_EDGE: { def += YamlRawSwitchEncode(RawSwitch(rhs.val1)); def += ","; @@ -119,7 +126,7 @@ Node convert::encode(const LogicalSwitchData& rhs) node["andsw"] = YamlRawSwitchEncode(RawSwitch(rhs.andsw)); node["lsPersist"] = (int)rhs.lsPersist; node["lsState"] = (int)rhs.lsState; - + node["custName"] = rhs.custName; return node; } @@ -127,6 +134,7 @@ bool convert::decode(const Node& node, LogicalSwitchData& rhs) { node["func"] >> funcLut >> rhs.func; + node["custName"] >> rhs.custName; std::string def_str; node["def"] >> def_str; @@ -142,6 +150,14 @@ bool convert::decode(const Node& node, rhs.val2 = YamlRawSwitchDecode(sw_str).toValue(); } break; +case LS_FAMILY_SAFE: { + std::string sw_str; + getline(def, sw_str, ','); + rhs.val1 = YamlRawSwitchDecode(sw_str).toValue(); + getline(def, sw_str); + rhs.val2 = YamlRawSwitchDecode(sw_str).toValue(); + } break; + case LS_FAMILY_EDGE: { std::string sw_str; getline(def, sw_str, ','); diff --git a/companion/src/firmwares/logicalswitchdata.cpp b/companion/src/firmwares/logicalswitchdata.cpp index 527b475f7f4..e5e26ee0527 100644 --- a/companion/src/firmwares/logicalswitchdata.cpp +++ b/companion/src/firmwares/logicalswitchdata.cpp @@ -28,7 +28,7 @@ bool LogicalSwitchData::isEmpty() const { - return (func == 0); + return (func == LS_FN_OFF); } CSFunctionFamily LogicalSwitchData::getFunctionFamily() const @@ -39,6 +39,8 @@ CSFunctionFamily LogicalSwitchData::getFunctionFamily() const return LS_FAMILY_TIMER; else if (func == LS_FN_STICKY) return LS_FAMILY_STICKY; + else if (func == LS_FN_SAFE) + return LS_FAMILY_SAFE; else if (func < LS_FN_AND || func > LS_FN_ELESS) return LS_FAMILY_VOFS; else if (func < LS_FN_EQUAL) @@ -103,6 +105,8 @@ QString LogicalSwitchData::funcToString() const return tr("Timer"); case LS_FN_STICKY: return tr("Sticky"); + case LS_FN_SAFE: + return tr("Safe"); case LS_FN_EDGE: return tr("Edge"); default: @@ -112,7 +116,7 @@ QString LogicalSwitchData::funcToString() const QString LogicalSwitchData::nameToString(int index) const { - return RadioData::getElementName(tr("L"), index + 1, NULL, true); + return RadioData::getElementName(tr("L"), index + 1, custName, true); } void LogicalSwitchData::convert(RadioDataConversionState & cstate) @@ -125,6 +129,10 @@ void LogicalSwitchData::convert(RadioDataConversionState & cstate) val1 = RawSource(val1).convert(cstate.withComponentField("V1")).toValue(); break; case LS_FAMILY_STICKY: + case LS_FAMILY_SAFE: + val1 = RawSwitch(val1).convert(cstate.withComponentField("V1")).toValue(); + val2 = RawSwitch(val2).convert(cstate.withComponentField("V2")).toValue(); + break; case LS_FAMILY_VBOOL: val1 = RawSwitch(val1).convert(cstate.withComponentField("V1")).toValue(); val2 = RawSwitch(val2).convert(cstate.withComponentField("V2")).toValue(); diff --git a/companion/src/firmwares/logicalswitchdata.h b/companion/src/firmwares/logicalswitchdata.h index f915d4ee179..181362efb33 100644 --- a/companion/src/firmwares/logicalswitchdata.h +++ b/companion/src/firmwares/logicalswitchdata.h @@ -19,11 +19,12 @@ * GNU General Public License for more details. */ -#ifndef LOGICALSWITCHDATA_H -#define LOGICALSWITCHDATA_H +#pragma once #include +#define LS_CUSTNAME_LEN 10 + class RadioDataConversionState; enum CSFunction { @@ -48,8 +49,10 @@ enum CSFunction { LS_FN_TIMER, LS_FN_STICKY, LS_FN_EDGE, + LS_FN_SAFE, // later ... LS_FN_RANGE, - LS_FN_MAX + LS_FN_MAX, + }; enum CSFunctionFamily { @@ -59,6 +62,7 @@ enum CSFunctionFamily { LS_FAMILY_TIMER, LS_FAMILY_STICKY, LS_FAMILY_EDGE, + LS_FAMILY_SAFE, }; class LogicalSwitchData { @@ -79,6 +83,7 @@ class LogicalSwitchData { int andsw; bool lsState; bool lsPersist; + char custName[LS_CUSTNAME_LEN + 1]; void clear() { memset(this, 0, sizeof(LogicalSwitchData)); } bool isEmpty() const; @@ -88,5 +93,3 @@ class LogicalSwitchData { QString nameToString(int index) const; void convert(RadioDataConversionState & cstate); }; - -#endif // LOGICALSWITCHDATA_H diff --git a/companion/src/firmwares/modeldata.cpp b/companion/src/firmwares/modeldata.cpp index 85dae1b7b03..9b17227b68d 100644 --- a/companion/src/firmwares/modeldata.cpp +++ b/companion/src/firmwares/modeldata.cpp @@ -719,6 +719,12 @@ int ModelData::updateReference() } break; case LS_FAMILY_STICKY: + case LS_FAMILY_SAFE: + if (lsd->val1 != 0) + updateSwitchIntRef(lsd->val1); + if (lsd->val2 != 0) + updateSwitchIntRef(lsd->val2); + break; case LS_FAMILY_VBOOL: oldval1 = lsd->val1; oldval2 = lsd->val2; diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 6c3193012e8..1ca42ccc69c 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -1515,6 +1515,7 @@ class LogicalSwitchesFunctionsTable: public ConversionTable { addConversion(LS_FN_DAPOS, val++); addConversion(LS_FN_TIMER, val++); addConversion(LS_FN_STICKY, val++); + addConversion(LS_FN_SAFE, val++); } }; @@ -1570,7 +1571,7 @@ class LogicalSwitchField: public TransformedField { v2 = csw.val2; v3 = csw.val3; } - else if ((csw.func >= LS_FN_AND && csw.func <= LS_FN_XOR) || csw.func == LS_FN_STICKY) { + else if ((csw.func >= LS_FN_AND && csw.func <= LS_FN_XOR) || csw.func == LS_FN_STICKY || csw.func == LS_FN_SAFE) { switchesConversionTable->exportValue(csw.val1, v1); switchesConversionTable->exportValue(csw.val2, v2); } @@ -1595,7 +1596,7 @@ class LogicalSwitchField: public TransformedField { csw.val2 = v2; csw.val3 = v3; } - else if ((csw.func >= LS_FN_AND && csw.func <= LS_FN_XOR) || csw.func == LS_FN_STICKY) { + else if ((csw.func >= LS_FN_AND && csw.func <= LS_FN_XOR) || csw.func == LS_FN_STICKY || csw.func == LS_FN_SAFE) { switchesConversionTable->importValue(v1, csw.val1); switchesConversionTable->importValue(v2, csw.val2); } diff --git a/companion/src/firmwares/rawsource.cpp b/companion/src/firmwares/rawsource.cpp index 14979d446c3..1a36d32db3a 100644 --- a/companion/src/firmwares/rawsource.cpp +++ b/companion/src/firmwares/rawsource.cpp @@ -215,7 +215,7 @@ QString RawSource::toString(const ModelData * model, const GeneralSettings * con return DataHelpers::getCompositeName(dfltName, custName, prefixCustomName); case SOURCE_TYPE_CUSTOM_SWITCH: - return RawSwitch(SWITCH_TYPE_VIRTUAL, index).toString(); // RawSwitch uses 1 based index + return RawSwitch(SWITCH_TYPE_VIRTUAL, index + 1) .toString(board, generalSettings, model); // RawSwitch uses 1 based index case SOURCE_TYPE_CYC: return tr("CYC%1").arg(index); diff --git a/companion/src/firmwares/rawswitch.cpp b/companion/src/firmwares/rawswitch.cpp index 70da6be2fd5..dd2b2d6471c 100644 --- a/companion/src/firmwares/rawswitch.cpp +++ b/companion/src/firmwares/rawswitch.cpp @@ -110,10 +110,20 @@ QString RawSwitch::toString(Board::Type board, const GeneralSettings * const gen case SWITCH_TYPE_VIRTUAL: if (modelData) - return modelData->logicalSw[index].nameToString(index - 1); + return modelData->logicalSw[index - 1].nameToString(index - 1); else return LogicalSwitchData().nameToString(index - 1); + case SWITCH_TYPE_FUNCTIONSWITCH: + if (!Boards::getCapability(board, Board::FunctionSwitches)) + return CPN_STR_UNKNOWN_ITEM; + qr = div(index - 1, 3); + if (modelData) + swName = QString(modelData->functionSwitchNames[qr.quot]).trimmed(); + if (swName.isEmpty()) + swName = tr("SW%1").arg(qr.quot + 1); + return swName + directionIndicators.at(qr.rem > -1 && qr.rem < directionIndicators.size() ? qr.rem : 1); + case SWITCH_TYPE_MULTIPOS_POT: if (!Boards::getCapability(board, Board::MultiposPotsPositions)) return CPN_STR_UNKNOWN_ITEM; diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index 1d27330ce6e..c3837b6bd95 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -114,7 +114,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, playIcon.addImage("stop.png", QIcon::Normal, QIcon::On); QStringList headerLabels; - headerLabels << "#" << tr("Switch") << tr("Action") << tr("Parameters") << tr("Repeat") << tr("Enable"); + headerLabels << "#" << tr("Name") << tr("Switch") << tr("Action") << tr("Parameters") << tr("Repeat") << tr("Enable"); TableLayout * tableLayout = new TableLayout(this, fswCapability, headerLabels); for (int i = 0; i < fswCapability; i++) { @@ -132,6 +132,16 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint))); tableLayout->addWidget(i, 0, label); + // The Custom Name + name[i] = new QLineEdit(this); + name[i]->setProperty("index", i); + name[i]->setMaxLength(CF_CUSTNAME_LEN); + QRegExp rx(CHAR_FOR_NAMES_REGEX); + name[i]->setValidator(new QRegExpValidator(rx, this)); + name[i]->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); + connect(name[i], SIGNAL(editingFinished()), this, SLOT(onNameEdited())); + tableLayout->addWidget(i, 1, name[i]); + // The switch fswtchSwtch[i] = new QComboBox(this); fswtchSwtch[i]->setProperty("index", i); @@ -141,7 +151,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, fswtchSwtch[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); fswtchSwtch[i]->setMaxVisibleItems(10); connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); - tableLayout->addWidget(i, 1, fswtchSwtch[i]); + tableLayout->addWidget(i, 2, fswtchSwtch[i]); // The function fswtchFunc[i] = new QComboBox(this); @@ -150,11 +160,11 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, fswtchFunc[i]->setCurrentIndex(fswtchFunc[i]->findData(functions[i].func)); fswtchFunc[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(functionEdited())); - tableLayout->addWidget(i, 2, fswtchFunc[i]); + tableLayout->addWidget(i, 3, fswtchFunc[i]); // The parameters QHBoxLayout * paramLayout = new QHBoxLayout(); - tableLayout->addLayout(i, 3, paramLayout); + tableLayout->addLayout(i, 4, paramLayout); fswtchGVmode[i] = new QComboBox(this); fswtchGVmode[i]->setProperty("index", i); @@ -205,7 +215,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, connect(playBT[i], &QToolButton::clicked, this, &CustomFunctionsPanel::toggleSound); QHBoxLayout * repeatLayout = new QHBoxLayout(); - tableLayout->addLayout(i, 4, repeatLayout); + tableLayout->addLayout(i, 5, repeatLayout); fswtchRepeat[i] = new QComboBox(this); fswtchRepeat[i]->setProperty("index", i); if (functions[i].func == FuncPlayScript || functions[i].func == FuncRGBLed) @@ -214,7 +224,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, fswtchRepeat[i]->setModel(tabModelFactory->getItemModel(repeatSetScreenId)); else fswtchRepeat[i]->setModel(tabModelFactory->getItemModel(repeatId)); - fswtchRepeat[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); + fswtchRepeat[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding); fswtchRepeat[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); repeatLayout->addWidget(fswtchRepeat[i], i + 1); connect(fswtchRepeat[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); @@ -230,7 +240,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, disableMouseScrolling(); tableLayout->resizeColumnsToContents(); - tableLayout->setColumnWidth(3, 300); + tableLayout->setColumnWidth(5, 300); tableLayout->pushRowsUp(fswCapability + 1); update(); @@ -353,30 +363,51 @@ void CustomFunctionsPanel::functionEdited() lock = true; int index = sender()->property("index").toInt(); RawSwitch swtch = functions[index].swtch; + int paramTemp =functions[index].param; + functions[index].clear(); functions[index].swtch = swtch; functions[index].func = (AssignFunc)fswtchFunc[index]->currentData().toInt(); functions[index].enabled = true; if (functions[index].func == FuncLogs) functions[index].param = 10; // 1 sec + functions[index].param = paramTemp; + strcpy(functions[index].custName, name[index]->text().toLatin1()); + refreshCustomFunction(index); emit modified(); lock = false; } } +void CustomFunctionsPanel::onNameEdited() +{ + QLineEdit *le = qobject_cast(sender()); + int index = le->property("index").toInt(); + CustomFunctionData & cfn = functions[index]; + if (cfn.custName != le->text()) { + strcpy(cfn.custName, le->text().toLatin1()); + emit modified(); + } +} + void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) { CustomFunctionData & cfn = functions[i]; AssignFunc func = (AssignFunc)fswtchFunc[i]->currentData().toInt(); + + unsigned int widgetsMask = 0; if (modified) { + cfn.swtch = RawSwitch(fswtchSwtch[i]->currentData().toInt()); cfn.func = func; cfn.enabled = fswtchEnable[i]->isChecked(); + } else { + name[i]->setText(cfn.custName); fswtchSwtch[i]->setCurrentIndex(fswtchSwtch[i]->findData(cfn.swtch.toValue())); fswtchFunc[i]->setCurrentIndex(fswtchFunc[i]->findData(cfn.func)); fswtchEnable[i]->setChecked(cfn.enabled); @@ -385,6 +416,8 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) if (!cfn.isEmpty()) { widgetsMask |= CUSTOM_FUNCTION_SHOW_FUNC | CUSTOM_FUNCTION_ENABLE; + name[i]->setText(cfn.custName); + if (func >= FuncOverrideCH1 && func <= FuncOverrideCHLast) { if (model) { int channelsMax = model->getChannelsMax(true); @@ -392,8 +425,11 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) fswtchParam[i]->setSingleStep(1); fswtchParam[i]->setMinimum(-channelsMax); fswtchParam[i]->setMaximum(channelsMax); + name[i]->setText(cfn.custName); + if (modified) { cfn.param = fswtchParam[i]->value(); + strcpy(cfn.custName, name[i]->text().toLatin1()); } fswtchParam[i]->setValue(cfn.param); widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM; @@ -801,6 +837,7 @@ void CustomFunctionsPanel::swapData(int idx1, int idx2) void CustomFunctionsPanel::resetCBsAndRefresh(int idx) { lock = true; + name[idx]->clear(); fswtchSwtch[idx]->setCurrentIndex(fswtchSwtch[idx]->findData(functions[idx].swtch.toValue())); fswtchFunc[idx]->setCurrentIndex(fswtchFunc[idx]->findData(functions[idx].func)); fswtchGVmode[idx]->setCurrentIndex(functions[idx].adjustMode); diff --git a/companion/src/modeledit/customfunctions.h b/companion/src/modeledit/customfunctions.h index c64ef860cf6..dbc76a1a7b5 100644 --- a/companion/src/modeledit/customfunctions.h +++ b/companion/src/modeledit/customfunctions.h @@ -47,6 +47,7 @@ class CustomFunctionsPanel : public GenericPanel private slots: void customFunctionEdited(); + void onNameEdited(); void functionEdited(); void onCustomContextMenuRequested(QPoint pos); void refreshCustomFunction(int index, bool modified=false); @@ -95,6 +96,7 @@ class CustomFunctionsPanel : public GenericPanel QSet tracksSet; QSet scriptsSet; int mediaPlayerCurrent; + QLineEdit * name[CPN_MAX_SPECIAL_FUNCTIONS]; QComboBox * fswtchSwtch[CPN_MAX_SPECIAL_FUNCTIONS]; QComboBox * fswtchFunc[CPN_MAX_SPECIAL_FUNCTIONS]; QCheckBox * fswtchParamGV[CPN_MAX_SPECIAL_FUNCTIONS]; diff --git a/companion/src/modeledit/logicalswitches.cpp b/companion/src/modeledit/logicalswitches.cpp index b628fcd0d1a..ab0571698b1 100644 --- a/companion/src/modeledit/logicalswitches.cpp +++ b/companion/src/modeledit/logicalswitches.cpp @@ -44,7 +44,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, lsCapabilityExt = firmware->getCapability(LogicalSwitchesExt); QStringList headerLabels; - headerLabels << "#" << tr("Function") << tr("V1") << tr("V2") << tr("AND Switch"); + headerLabels << "#" << tr("Name") << tr("Function") << tr("V1") << tr("V2") << tr("AND Switch"); if (lsCapabilityExt) { headerLabels << tr("Duration") << tr("Delay"); } @@ -65,12 +65,22 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint))); tableLayout->addWidget(i, 0, label); + // The Custom Name + name[i] = new QLineEdit(this); + name[i]->setProperty("index", i); + name[i]->setMaxLength(LS_CUSTNAME_LEN); + QRegExp rx(CHAR_FOR_NAMES_REGEX); + name[i]->setValidator(new QRegExpValidator(rx, this)); + name[i]->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); + connect(name[i], SIGNAL(editingFinished()), this, SLOT(onNameEdited())); + tableLayout->addWidget(i, 1, name[i]); + // The function cbFunction[i] = new QComboBox(this); cbFunction[i]->setProperty("index", i); populateFunctionCB(cbFunction[i]); connect(cbFunction[i], SIGNAL(currentIndexChanged(int)), this, SLOT(onFunctionChanged())); - tableLayout->addWidget(i, 1, cbFunction[i]); + tableLayout->addWidget(i, 2, cbFunction[i]); // V1 QHBoxLayout *v1Layout = new QHBoxLayout(); @@ -88,7 +98,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, connect(dsbValue[i], SIGNAL(editingFinished()), this, SLOT(onOffsetChanged())); v1Layout->addWidget(dsbValue[i]); dsbValue[i]->setVisible(false); - tableLayout->addLayout(i, 2, v1Layout); + tableLayout->addLayout(i, 3, v1Layout); // V2 QHBoxLayout *v2Layout = new QHBoxLayout(); @@ -121,7 +131,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, connect(teOffset[i],SIGNAL(editingFinished()),this,SLOT(onOffsetChanged())); v2Layout->addWidget(teOffset[i]); teOffset[i]->setVisible(false); - tableLayout->addLayout(i, 3, v2Layout); + tableLayout->addLayout(i, 4, v2Layout); // AND cbAndSwitch[i] = new QComboBox(this); @@ -129,7 +139,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, cbAndSwitch[i]->setModel(rawSwitchFilteredModel); cbAndSwitch[i]->setVisible(true); connect(cbAndSwitch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(onAndSwitchChanged(int))); - tableLayout->addWidget(i, 4, cbAndSwitch[i]); + tableLayout->addWidget(i, 5, cbAndSwitch[i]); if (lsCapabilityExt) { // Duration @@ -141,7 +151,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, dsbDuration[i]->setAccelerated(true); dsbDuration[i]->setDecimals(1); connect(dsbDuration[i], SIGNAL(valueChanged(double)), this, SLOT(onDurationChanged(double))); - tableLayout->addWidget(i, 5, dsbDuration[i]); + tableLayout->addWidget(i, 6, dsbDuration[i]); // Delay dsbDelay[i] = new QDoubleSpinBox(this); @@ -152,7 +162,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, dsbDelay[i]->setAccelerated(true); dsbDelay[i]->setDecimals(1); connect(dsbDelay[i], SIGNAL(valueChanged(double)), this, SLOT(onDelayChanged(double))); - tableLayout->addWidget(i, 6, dsbDelay[i]); + tableLayout->addWidget(i, 7, dsbDelay[i]); } cbPersist[i] = new QCheckBox(this); @@ -165,7 +175,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, disableMouseScrolling(); tableLayout->resizeColumnsToContents(); - tableLayout->pushRowsUp(lsCapability+1); + tableLayout->pushRowsUp(lsCapability + 1); } LogicalSwitchesPanel::~LogicalSwitchesPanel() @@ -174,6 +184,19 @@ LogicalSwitchesPanel::~LogicalSwitchesPanel() delete rawSwitchFilteredModel; } +void LogicalSwitchesPanel::onNameEdited() +{ + QLineEdit *le = qobject_cast(sender()); + int index = le->property("index").toInt(); + + if (model->logicalSw[index].custName != le->text()) { + strcpy(model->logicalSw[index].custName, le->text().toLatin1()); + if (model->logicalSw[index].func != LS_FN_OFF) + updateItemModels(); + emit modified(); + } +} + void LogicalSwitchesPanel::onFunctionChanged() { if (!lock) { @@ -377,6 +400,8 @@ void LogicalSwitchesPanel::updateLine(int i) if (!model->logicalSw[i].isEmpty()) { mask = LINE_ENABLED | DELAY_ENABLED | DURATION_ENABLED; + name[i]->setText(model->logicalSw[i].custName); + switch (model->logicalSw[i].getFunctionFamily()) { case LS_FAMILY_VOFS: @@ -412,6 +437,7 @@ void LogicalSwitchesPanel::updateLine(int i) case LS_FAMILY_STICKY: // no break mask |= PERSIST_ENABLED; cbPersist[i]->setChecked(model->logicalSw[i].lsPersist); + case LS_FAMILY_SAFE: // no break case LS_FAMILY_VBOOL: mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE; cbSource1[i]->setModel(rawSwitchFilteredModel); @@ -490,7 +516,8 @@ void LogicalSwitchesPanel::populateFunctionCB(QComboBox *b) LS_FN_DPOS, LS_FN_DAPOS, LS_FN_TIMER, - LS_FN_STICKY + LS_FN_STICKY, + LS_FN_SAFE, }; b->clear(); @@ -620,6 +647,7 @@ void LogicalSwitchesPanel::cmClear(bool prompt) model->logicalSw[selectedIndex].clear(); model->updateAllReferences(ModelData::REF_UPD_TYPE_LOGICAL_SWITCH, ModelData::REF_UPD_ACT_CLEAR, selectedIndex); + name[selectedIndex]->clear(); updateLine(selectedIndex); updateItemModels(); emit modified(); @@ -632,6 +660,7 @@ void LogicalSwitchesPanel::cmClearAll() for (int i = 0; i < lsCapability; i++) { model->logicalSw[i].clear(); + name[i]->clear(); model->updateAllReferences(ModelData::REF_UPD_TYPE_LOGICAL_SWITCH, ModelData::REF_UPD_ACT_CLEAR, i); } update(); diff --git a/companion/src/modeledit/logicalswitches.h b/companion/src/modeledit/logicalswitches.h index 3b0fb4a9ac6..88d5a3bd414 100644 --- a/companion/src/modeledit/logicalswitches.h +++ b/companion/src/modeledit/logicalswitches.h @@ -19,8 +19,7 @@ * GNU General Public License for more details. */ -#ifndef _LOGICALSWITCHES_H_ -#define _LOGICALSWITCHES_H_ +#pragma once #include "modeledit.h" #include "radiodata.h" @@ -43,6 +42,7 @@ class LogicalSwitchesPanel : public ModelPanel private slots: void onFunctionChanged(); + void onNameEdited(); void onV1Changed(int value); void onV2Changed(int value); void onAndSwitchChanged(int value); @@ -66,6 +66,7 @@ class LogicalSwitchesPanel : public ModelPanel void onItemModelUpdateComplete(); private: + QLineEdit *name[CPN_MAX_LOGICAL_SWITCHES]; QComboBox * cbFunction[CPN_MAX_LOGICAL_SWITCHES]; QDoubleSpinBox * dsbValue[CPN_MAX_LOGICAL_SWITCHES]; QDoubleSpinBox * dsbOffset[CPN_MAX_LOGICAL_SWITCHES]; @@ -94,5 +95,3 @@ class LogicalSwitchesPanel : public ModelPanel void updateItemModels(); void connectItemModelEvents(const FilteredItemModel * itemModel); }; - -#endif // _LOGICALSWITCHES_H_ diff --git a/companion/src/modelprinter.cpp b/companion/src/modelprinter.cpp index f17d09d4947..ae41406b2ee 100644 --- a/companion/src/modelprinter.cpp +++ b/companion/src/modelprinter.cpp @@ -399,6 +399,18 @@ QString ModelPrinter::printMixerLine(const MixData & mix, bool showMultiplex, in { QString str = " "; + if (firmware->getCapability(HasMixerNames) && mix.name[0]){ + std::string strMixName(mix.name); + str += QString(" [%1]").arg(mix.name).toHtmlEscaped(); + for (int i = 0; i < (6- strMixName.length()); i++) { + str += " "; + } + } + else { + str += "       "; + } + str += "     "; + if (showMultiplex) { switch(mix.mltpx) { case (1): str += "*="; break; @@ -538,6 +550,9 @@ QString ModelPrinter::printLogicalSwitchLine(int idx) if (ls.lsPersist) result += tr(" Persistent"); break; + case LS_FAMILY_SAFE: + result += tr("Safe") + QString("(%1, %2)").arg(sw1Name).arg(sw2Name); + break; case LS_FAMILY_TIMER: result += tr("Timer") + QString("(%1, %2)").arg(ValToTim(ls.val1)).arg(ValToTim(ls.val2)); break; diff --git a/companion/src/simulation/radiooutputswidget.cpp b/companion/src/simulation/radiooutputswidget.cpp index 1a4b2977168..834cfab94c8 100644 --- a/companion/src/simulation/radiooutputswidget.cpp +++ b/companion/src/simulation/radiooutputswidget.cpp @@ -284,6 +284,11 @@ void RadioOutputsWidget::setupLsDisplay() QWidget * RadioOutputsWidget::createLogicalSwitch(QWidget * parent, int switchNo) { + //TODO: place logicSwitch friendly name on radio output window. + //int modelindex = RadioData().generalSettings.currModelIndex; + //ModelData &model = RadioData().models[modelindex]; + //QString namestring = model.logicalSw[switchNo].custName; + QLabel * swtch = new QLabel(parent); swtch->setAutoFillBackground(true); swtch->setFrameStyle(QFrame::Panel | QFrame::Raised); @@ -299,7 +304,8 @@ QWidget * RadioOutputsWidget::createLogicalSwitch(QWidget * parent, int switchNo #endif font.setBold(false); swtch->setFont(font); - swtch->setText(QString("%1").arg(switchNo+1, 2, 10, QChar('0'))); + swtch->setText(QString("%1").arg(switchNo+1, 2, 10, QChar('0')) ); + //swtch->setText(QString("%1").arg(switchNo+1, 2, 10, QChar('0')) + ": " + namestring); swtch->setAlignment(Qt::AlignCenter); m_logicSwitchMap.insert(switchNo, swtch); return swtch; diff --git a/radio/src/dataconstants.h b/radio/src/dataconstants.h index 20057eeb9d7..fc57d94ee62 100644 --- a/radio/src/dataconstants.h +++ b/radio/src/dataconstants.h @@ -137,6 +137,9 @@ enum CurveType { #define MAX_CURVE_POINTS 512 #endif +#define LEN_SPEC_FN_NAME 10 +#define LEN_LOGICSW_NAME 10 + #define NUM_MODULES 2 #define XPOTS_MULTIPOS_COUNT 6 diff --git a/radio/src/datastructs.h b/radio/src/datastructs.h index f20d1f0318c..988f7444bdb 100644 --- a/radio/src/datastructs.h +++ b/radio/src/datastructs.h @@ -45,14 +45,14 @@ static inline void check_struct() CHKSIZE(ExpoData, 18); CHKSIZE(SwashRingData, 8); CHKSIZE(CurveHeader, 4); - CHKSIZE(LogicalSwitchData, 9); + CHKSIZE(LogicalSwitchData, 19); CHKSIZE(TelemetrySensor, 14); CHKSIZE(ModuleData, 29); CHKSIZE(GVarData, 7); CHKSIZE(RFAlarmData, 2); CHKSIZE(TrainerData, 16); CHKSIZE(FlightModeData, 22 + 2 * MAX_TRIMS + LEN_FLIGHT_MODE_NAME); - CHKSIZE(CustomFunctionData, 11); + CHKSIZE(CustomFunctionData, 21); #if defined(PCBX7) || defined(PCBXLITE) || defined(PCBX9LITE) CHKSIZE(LimitData, 11); @@ -83,33 +83,33 @@ static inline void check_struct() #endif #if defined(PCBXLITES) - CHKSIZE(RadioData, 872); + CHKSIZE(RadioData, 1512); #elif defined(COLORLCD) - CHKSIZE(RadioData, 966); + CHKSIZE(RadioData, 1606); #else - CHKSIZE(RadioData, 870); + CHKSIZE(RadioData, 1510); #endif #if defined(RADIO_TPRO) || defined(RADIO_TPROV2) || defined(RADIO_BUMBLEBEE) - CHKSIZE(ModelData, 6354); + CHKSIZE(ModelData, 7634); #elif defined(RADIO_T14) || defined(RADIO_T12MAX) - CHKSIZE(ModelData, 6329); + CHKSIZE(ModelData, 7609); #elif defined(RADIO_FAMILY_T20) - CHKSIZE(ModelData, 6390); + CHKSIZE(ModelData, 7670); #elif defined(PCBX9E) - CHKSIZE(ModelData, 6771); + CHKSIZE(ModelData, 8051); #elif defined(PCBX9D) || defined(PCBX9DP) - CHKSIZE(ModelData, 6770); + CHKSIZE(ModelData, 8050); #elif defined(PCBX7) || defined(PCBXLITE) || defined(PCBX9LITE) - CHKSIZE(ModelData, 6329); + CHKSIZE(ModelData, 7609); #elif defined(PCBNV14) - CHKSIZE(ModelData, 26463); + CHKSIZE(ModelData, 27743); #elif defined(PCBPL18) - CHKSIZE(ModelData, 26845); + CHKSIZE(ModelData, 28125); #elif defined(RADIO_T15) - CHKSIZE(ModelData, 26834); + CHKSIZE(ModelData, 28114); #elif defined(PCBHORUS) - CHKSIZE(ModelData, 26809); + CHKSIZE(ModelData, 28089); #else #error CHKSIZE not set up #endif diff --git a/radio/src/datastructs_private.h b/radio/src/datastructs_private.h index 717433d196e..df3905c6e80 100644 --- a/radio/src/datastructs_private.h +++ b/radio/src/datastructs_private.h @@ -159,6 +159,7 @@ PACK(struct LogicalSwitchData { int16_t v2 SKIP; uint8_t delay; uint8_t duration; + NOBACKUP(char custName[LEN_LOGICSW_NAME]); }); /* @@ -168,6 +169,7 @@ PACK(struct LogicalSwitchData { PACK(struct CustomFunctionData { int16_t swtch:10 CUST(r_swtchSrc,w_swtchSrc); uint16_t func:6 ENUM(Functions); // TODO: 6 bits for Functions? + NOBACKUP(char custName[LEN_SPEC_FN_NAME]); CUST_ATTR(def,r_customFn,w_customFn); PACK(union { NOBACKUP(PACK(struct { diff --git a/radio/src/gui/colorlcd/mainview/view_logical_switches.cpp b/radio/src/gui/colorlcd/mainview/view_logical_switches.cpp index 9c94cac0053..99251e644f7 100644 --- a/radio/src/gui/colorlcd/mainview/view_logical_switches.cpp +++ b/radio/src/gui/colorlcd/mainview/view_logical_switches.cpp @@ -111,6 +111,14 @@ class LogicalSwitchDisplayFooter : public Window char s[20]; + //LS friendly name + /*const char* chrs = cs->custName; + if (strlen(chrs) > 0) { + dc->drawText(15, 1, cs->custName, textColor); + } else { + dc->drawTextAtIndex(5, 1, STR_VCSWFUNC, cs->func, textColor); + }*/ + lv_label_set_text(lsFunc, STR_VCSWFUNC[ls->func]); // CSW params - V1 @@ -118,6 +126,7 @@ class LogicalSwitchDisplayFooter : public Window case LS_FAMILY_BOOL: case LS_FAMILY_STICKY: case LS_FAMILY_EDGE: + case LS_FAMILY_SAFE: lv_label_set_text(lsV1, getSwitchPositionName(ls->v1)); break; case LS_FAMILY_TIMER: @@ -135,6 +144,7 @@ class LogicalSwitchDisplayFooter : public Window switch (lsFamily) { case LS_FAMILY_BOOL: case LS_FAMILY_STICKY: + case LS_FAMILY_SAFE: lv_label_set_text(lsV2, getSwitchPositionName(ls->v2)); break; case LS_FAMILY_EDGE: diff --git a/radio/src/gui/colorlcd/model/model_logical_switches.cpp b/radio/src/gui/colorlcd/model/model_logical_switches.cpp index 66a0f80cf7c..66c2e92aa04 100644 --- a/radio/src/gui/colorlcd/model/model_logical_switches.cpp +++ b/radio/src/gui/colorlcd/model/model_logical_switches.cpp @@ -108,6 +108,10 @@ class LogicalSwitchEditPage : public Page LogicalSwitchData* cs = lswAddress(index); uint8_t cstate = lswFamily(cs->func); + // new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_CUST_LOGICALSWITCH_LABEL, 0, COLOR_THEME_PRIMARY1); + // new ModelTextEdit(logicalSwitchOneWindow, grid.getFieldSlot(), cs->custName, LEN_LOGICSW_NAME); + // grid.nextLine(); + // V1 auto line = logicalSwitchOneWindow->newLine(grid); new StaticText(line, rect_t{}, STR_V1); @@ -115,6 +119,7 @@ class LogicalSwitchEditPage : public Page case LS_FAMILY_BOOL: case LS_FAMILY_STICKY: case LS_FAMILY_EDGE: + case LS_FUNC_SAFE: choice = new SwitchChoice( line, rect_t{}, SWSRC_FIRST_IN_LOGICAL_SWITCHES, SWSRC_LAST_IN_LOGICAL_SWITCHES, GET_SET_DEFAULT(cs->v1)); @@ -216,11 +221,13 @@ class LogicalSwitchEditPage : public Page } // AND switch - line = logicalSwitchOneWindow->newLine(grid); - new StaticText(line, rect_t{}, STR_AND_SWITCH); - choice = new SwitchChoice(line, rect_t{}, -MAX_LS_ANDSW, MAX_LS_ANDSW, - GET_SET_DEFAULT(cs->andsw)); - choice->setAvailableHandler(isSwitchAvailableInLogicalSwitches); + if (cs->func != LS_FUNC_SAFE) { + line = logicalSwitchOneWindow->newLine(grid); + new StaticText(line, rect_t{}, STR_AND_SWITCH); + choice = new SwitchChoice(line, rect_t{}, -MAX_LS_ANDSW, MAX_LS_ANDSW, + GET_SET_DEFAULT(cs->andsw)); + choice->setAvailableHandler(isSwitchAvailableInLogicalSwitches); + } // Duration line = logicalSwitchOneWindow->newLine(grid); @@ -426,11 +433,14 @@ class LogicalSwitchButton : public ListLineButton lsName, getSwitchPositionName(SWSRC_FIRST_LOGICAL_SWITCH + index)); lv_label_set_text(lsFunc, STR_VCSWFUNC[ls->func]); + //dc->drawText(col1, line1, ls->custName, COLOR_THEME_SECONDARY1); + // CSW params - V1 switch (lsFamily) { case LS_FAMILY_BOOL: case LS_FAMILY_STICKY: case LS_FAMILY_EDGE: + case LS_FUNC_SAFE: lv_label_set_text(lsV1, getSwitchPositionName(ls->v1)); break; case LS_FAMILY_TIMER: @@ -453,6 +463,7 @@ class LogicalSwitchButton : public ListLineButton switch (lsFamily) { case LS_FAMILY_BOOL: case LS_FAMILY_STICKY: + case LS_FUNC_SAFE: lv_label_set_text(lsV2, getSwitchPositionName(ls->v2)); break; case LS_FAMILY_EDGE: diff --git a/radio/src/gui/colorlcd/model/special_functions.cpp b/radio/src/gui/colorlcd/model/special_functions.cpp index 9d956dca8bc..733f40a2e2b 100644 --- a/radio/src/gui/colorlcd/model/special_functions.cpp +++ b/radio/src/gui/colorlcd/model/special_functions.cpp @@ -145,6 +145,9 @@ void FunctionLineButton::refresh() lv_label_set_text(sfName, (prefix + std::to_string(index + 1)).c_str()); lv_label_set_text(sfSwitch, getSwitchPositionName(CFN_SWITCH(cfn))); + //paint special function custom name + //dc->drawText(col3, line1, cfn->custName, COLOR_THEME_SECONDARY1); + strcpy(s, funcGetLabel(func)); strcat(s, " - "); @@ -656,9 +659,14 @@ void FunctionEditPage::buildBody(Window *form) FlexGridLayout grid(col_dsc, row_dsc, PAD_TINY); CustomFunctionData *cfn = customFunctionData(); + auto line = form->newLine(grid); + + // Custom label + new StaticText(line, rect_t{}, STR_CUST_FUNC_CUST_LABEL); + new ModelTextEdit(line, rect_t{}, cfn->custName, LEN_SPEC_FN_NAME); + line = form->newLine(grid); // Switch - auto line = form->newLine(grid); new StaticText(line, rect_t{}, STR_SF_SWITCH); auto switchChoice = new SwitchChoice(line, rect_t{}, SWSRC_FIRST, SWSRC_LAST, GET_SET_DEFAULT(CFN_SWITCH(cfn))); diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index 3100f48136d..4246cbddaed 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -201,6 +201,7 @@ enum LogicalSwitchesFunctions { LS_FUNC_ADIFFEGREATER, LS_FUNC_TIMER, LS_FUNC_STICKY, + LS_FUNC_SAFE, LS_FUNC_COUNT SKIP, LS_FUNC_MAX SKIP = LS_FUNC_COUNT-1 }; diff --git a/radio/src/storage/yaml/yaml_datastructs_128x64.cpp b/radio/src/storage/yaml/yaml_datastructs_128x64.cpp index f98c7c6617f..faabdfeefff 100644 --- a/radio/src/storage/yaml/yaml_datastructs_128x64.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_128x64.cpp @@ -131,6 +131,7 @@ const struct YamlIdStr enum_LogicalSwitchesFunctions[] = { { LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" }, { LS_FUNC_TIMER, "FUNC_TIMER" }, { LS_FUNC_STICKY, "FUNC_STICKY" }, + { LS_FUNC_SAFE, "FUNC_SAFE" }, { 0, NULL } }; const struct YamlIdStr enum_SwashType[] = { @@ -256,6 +257,7 @@ static const struct YamlNode struct_CustomFunctionData[] = { YAML_IDX, YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), YAML_ENUM("func", 6, enum_Functions), + YAML_STRING("custName", 10), YAML_CUSTOM("def",r_customFn,w_customFn), YAML_PADDING( 64 ), YAML_PADDING( 1 ), @@ -332,7 +334,7 @@ static const struct YamlNode struct_RadioData[] = { 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_ARRAY("customFn", 168, 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), @@ -471,6 +473,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = { YAML_PADDING( 16 ), YAML_UNSIGNED( "delay", 8 ), YAML_UNSIGNED( "duration", 8 ), + YAML_STRING("custName", 10), YAML_END }; static const struct YamlNode struct_SwashRingData[] = { @@ -805,8 +808,8 @@ static const struct YamlNode struct_ModelData[] = { 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_ARRAY("logicalSw", 152, 64, struct_LogicalSwitchData, NULL), + YAML_ARRAY("customFn", 168, 64, struct_CustomFunctionData, cfn_is_active), YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active), YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active), YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ), diff --git a/radio/src/storage/yaml/yaml_datastructs_f16.cpp b/radio/src/storage/yaml/yaml_datastructs_f16.cpp index ddb86cc3755..01acabd206e 100644 --- a/radio/src/storage/yaml/yaml_datastructs_f16.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_f16.cpp @@ -141,6 +141,7 @@ const struct YamlIdStr enum_LogicalSwitchesFunctions[] = { { LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" }, { LS_FUNC_TIMER, "FUNC_TIMER" }, { LS_FUNC_STICKY, "FUNC_STICKY" }, + { LS_FUNC_SAFE, "FUNC_SAFE" }, { 0, NULL } }; const struct YamlIdStr enum_SwashType[] = { @@ -275,6 +276,7 @@ static const struct YamlNode struct_CustomFunctionData[] = { YAML_IDX, YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), YAML_ENUM("func", 6, enum_Functions), + YAML_STRING("custName", 10), YAML_CUSTOM("def",r_customFn,w_customFn), YAML_PADDING( 64 ), YAML_PADDING( 1 ), @@ -349,7 +351,7 @@ static const struct YamlNode struct_RadioData[] = { 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_ARRAY("customFn", 168, 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), @@ -499,6 +501,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = { YAML_PADDING( 16 ), YAML_UNSIGNED( "delay", 8 ), YAML_UNSIGNED( "duration", 8 ), + YAML_STRING("custName", 10), YAML_END }; static const struct YamlNode struct_SwashRingData[] = { @@ -840,8 +843,8 @@ static const struct YamlNode struct_ModelData[] = { 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_ARRAY("logicalSw", 152, 64, struct_LogicalSwitchData, NULL), + YAML_ARRAY("customFn", 168, 64, struct_CustomFunctionData, cfn_is_active), YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active), YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active), YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ), diff --git a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp index 6e62f7d6f40..9f4e5d8d13e 100644 --- a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp @@ -1940,6 +1940,14 @@ static void r_logicSw(void* user, uint8_t* data, uint32_t bitoffs, ls->v2 = r_swtchSrc(nullptr, val, val_len); break; + case LS_FAMILY_SAFE: + ls->v1 = r_swtchSrc(nullptr, val, l_sep); + val += l_sep; val_len -= l_sep; + if (!val_len || val[0] != ',') return; + val++; val_len--; + ls->v2 = r_swtchSrc(nullptr, val, val_len); + break; + case LS_FAMILY_EDGE: ls->v1 = r_swtchSrc(nullptr, val, l_sep); val += l_sep; val_len -= l_sep; @@ -2007,6 +2015,12 @@ static bool w_logicSw(void* user, uint8_t* data, uint32_t bitoffs, if (!w_swtchSrc_unquoted(&_ls_node_v2, ls->v2, wf, opaque)) return false; break; + case LS_FAMILY_SAFE: + if (!w_swtchSrc_unquoted(&_ls_node_v1, ls->v1, wf, opaque)) return false; + if (!wf(opaque,",",1)) return false; + if (!w_swtchSrc_unquoted(&_ls_node_v2, ls->v2, wf, opaque)) return false; + break; + case LS_FAMILY_EDGE: if (!w_swtchSrc_unquoted(&_ls_node_v1, ls->v1, wf, opaque)) return false; if (!wf(opaque,",",1)) return false; diff --git a/radio/src/storage/yaml/yaml_datastructs_nv14.cpp b/radio/src/storage/yaml/yaml_datastructs_nv14.cpp index ec06a121a3e..6c7ffb80db7 100644 --- a/radio/src/storage/yaml/yaml_datastructs_nv14.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_nv14.cpp @@ -139,6 +139,7 @@ const struct YamlIdStr enum_LogicalSwitchesFunctions[] = { { LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" }, { LS_FUNC_TIMER, "FUNC_TIMER" }, { LS_FUNC_STICKY, "FUNC_STICKY" }, + { LS_FUNC_SAFE, "FUNC_SAFE" }, { 0, NULL } }; const struct YamlIdStr enum_SwashType[] = { @@ -273,6 +274,7 @@ static const struct YamlNode struct_CustomFunctionData[] = { YAML_IDX, YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), YAML_ENUM("func", 6, enum_Functions), + YAML_STRING("custName", 10), YAML_CUSTOM("def",r_customFn,w_customFn), YAML_PADDING( 64 ), YAML_PADDING( 1 ), @@ -349,7 +351,7 @@ static const struct YamlNode struct_RadioData[] = { 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_ARRAY("customFn", 168, 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), @@ -496,6 +498,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = { YAML_PADDING( 16 ), YAML_UNSIGNED( "delay", 8 ), YAML_UNSIGNED( "duration", 8 ), + YAML_STRING("custName", 10), YAML_END }; static const struct YamlNode struct_SwashRingData[] = { @@ -838,8 +841,8 @@ static const struct YamlNode struct_ModelData[] = { 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_ARRAY("logicalSw", 152, 64, struct_LogicalSwitchData, NULL), + YAML_ARRAY("customFn", 168, 64, struct_CustomFunctionData, cfn_is_active), YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active), YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active), YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ), diff --git a/radio/src/storage/yaml/yaml_datastructs_pl18.cpp b/radio/src/storage/yaml/yaml_datastructs_pl18.cpp index 95f127ea3a6..a37f56031d6 100644 --- a/radio/src/storage/yaml/yaml_datastructs_pl18.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_pl18.cpp @@ -139,6 +139,7 @@ const struct YamlIdStr enum_LogicalSwitchesFunctions[] = { { LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" }, { LS_FUNC_TIMER, "FUNC_TIMER" }, { LS_FUNC_STICKY, "FUNC_STICKY" }, + { LS_FUNC_SAFE, "FUNC_SAFE" }, { 0, NULL } }; const struct YamlIdStr enum_SwashType[] = { @@ -273,6 +274,7 @@ static const struct YamlNode struct_CustomFunctionData[] = { YAML_IDX, YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), YAML_ENUM("func", 6, enum_Functions), + YAML_STRING("custName", 10), YAML_CUSTOM("def",r_customFn,w_customFn), YAML_PADDING( 64 ), YAML_PADDING( 1 ), @@ -349,7 +351,7 @@ static const struct YamlNode struct_RadioData[] = { 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_ARRAY("customFn", 168, 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), @@ -496,6 +498,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = { YAML_PADDING( 16 ), YAML_UNSIGNED( "delay", 8 ), YAML_UNSIGNED( "duration", 8 ), + YAML_STRING("custName", 10), YAML_END }; static const struct YamlNode struct_SwashRingData[] = { @@ -838,8 +841,8 @@ static const struct YamlNode struct_ModelData[] = { 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_ARRAY("logicalSw", 152, 64, struct_LogicalSwitchData, NULL), + YAML_ARRAY("customFn", 168, 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 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_t15.cpp b/radio/src/storage/yaml/yaml_datastructs_t15.cpp index b14aa266643..64fa26380fd 100644 --- a/radio/src/storage/yaml/yaml_datastructs_t15.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_t15.cpp @@ -141,6 +141,7 @@ const struct YamlIdStr enum_LogicalSwitchesFunctions[] = { { LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" }, { LS_FUNC_TIMER, "FUNC_TIMER" }, { LS_FUNC_STICKY, "FUNC_STICKY" }, + { LS_FUNC_SAFE, "FUNC_SAFE" }, { 0, NULL } }; const struct YamlIdStr enum_SwashType[] = { @@ -275,6 +276,7 @@ static const struct YamlNode struct_CustomFunctionData[] = { YAML_IDX, YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), YAML_ENUM("func", 6, enum_Functions), + YAML_STRING("custName", 10), YAML_CUSTOM("def",r_customFn,w_customFn), YAML_PADDING( 64 ), YAML_PADDING( 1 ), @@ -349,7 +351,7 @@ static const struct YamlNode struct_RadioData[] = { 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_ARRAY("customFn", 168, 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), @@ -499,6 +501,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = { YAML_PADDING( 16 ), YAML_UNSIGNED( "delay", 8 ), YAML_UNSIGNED( "duration", 8 ), + YAML_STRING("custName", 10), YAML_END }; static const struct YamlNode struct_SwashRingData[] = { @@ -845,8 +848,8 @@ static const struct YamlNode struct_ModelData[] = { 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_ARRAY("logicalSw", 152, 64, struct_LogicalSwitchData, NULL), + YAML_ARRAY("customFn", 168, 64, struct_CustomFunctionData, cfn_is_active), YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active), YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active), YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ), diff --git a/radio/src/storage/yaml/yaml_datastructs_t20.cpp b/radio/src/storage/yaml/yaml_datastructs_t20.cpp index faf052cf19b..6554b250eff 100644 --- a/radio/src/storage/yaml/yaml_datastructs_t20.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_t20.cpp @@ -132,6 +132,7 @@ const struct YamlIdStr enum_LogicalSwitchesFunctions[] = { { LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" }, { LS_FUNC_TIMER, "FUNC_TIMER" }, { LS_FUNC_STICKY, "FUNC_STICKY" }, + { LS_FUNC_SAFE, "FUNC_SAFE" }, { 0, NULL } }; const struct YamlIdStr enum_SwashType[] = { @@ -257,6 +258,7 @@ static const struct YamlNode struct_CustomFunctionData[] = { YAML_IDX, YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), YAML_ENUM("func", 6, enum_Functions), + YAML_STRING("custName", 10), YAML_CUSTOM("def",r_customFn,w_customFn), YAML_PADDING( 64 ), YAML_PADDING( 1 ), @@ -333,7 +335,7 @@ static const struct YamlNode struct_RadioData[] = { 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_ARRAY("customFn", 168, 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), @@ -472,6 +474,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = { YAML_PADDING( 16 ), YAML_UNSIGNED( "delay", 8 ), YAML_UNSIGNED( "duration", 8 ), + YAML_STRING("custName", 10), YAML_END }; static const struct YamlNode struct_SwashRingData[] = { @@ -806,8 +809,8 @@ static const struct YamlNode struct_ModelData[] = { 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_ARRAY("logicalSw", 152, 64, struct_LogicalSwitchData, NULL), + YAML_ARRAY("customFn", 168, 64, struct_CustomFunctionData, cfn_is_active), YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active), YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active), YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ), diff --git a/radio/src/storage/yaml/yaml_datastructs_tpro.cpp b/radio/src/storage/yaml/yaml_datastructs_tpro.cpp index 97eedc1dcda..c18a17be27b 100644 --- a/radio/src/storage/yaml/yaml_datastructs_tpro.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_tpro.cpp @@ -132,6 +132,7 @@ const struct YamlIdStr enum_LogicalSwitchesFunctions[] = { { LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" }, { LS_FUNC_TIMER, "FUNC_TIMER" }, { LS_FUNC_STICKY, "FUNC_STICKY" }, + { LS_FUNC_SAFE, "FUNC_SAFE" }, { 0, NULL } }; const struct YamlIdStr enum_SwashType[] = { @@ -257,6 +258,7 @@ static const struct YamlNode struct_CustomFunctionData[] = { YAML_IDX, YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), YAML_ENUM("func", 6, enum_Functions), + YAML_STRING("custName", 10), YAML_CUSTOM("def",r_customFn,w_customFn), YAML_PADDING( 64 ), YAML_PADDING( 1 ), @@ -333,7 +335,7 @@ static const struct YamlNode struct_RadioData[] = { 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_ARRAY("customFn", 168, 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), @@ -472,6 +474,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = { YAML_PADDING( 16 ), YAML_UNSIGNED( "delay", 8 ), YAML_UNSIGNED( "duration", 8 ), + YAML_STRING("custName", 10), YAML_END }; static const struct YamlNode struct_SwashRingData[] = { @@ -806,8 +809,8 @@ static const struct YamlNode struct_ModelData[] = { 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_ARRAY("logicalSw", 152, 64, struct_LogicalSwitchData, NULL), + YAML_ARRAY("customFn", 168, 64, struct_CustomFunctionData, cfn_is_active), YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active), YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active), YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ), diff --git a/radio/src/storage/yaml/yaml_datastructs_x10.cpp b/radio/src/storage/yaml/yaml_datastructs_x10.cpp index cf6dab7dc16..c1f33b808c7 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x10.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x10.cpp @@ -140,6 +140,7 @@ const struct YamlIdStr enum_LogicalSwitchesFunctions[] = { { LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" }, { LS_FUNC_TIMER, "FUNC_TIMER" }, { LS_FUNC_STICKY, "FUNC_STICKY" }, + { LS_FUNC_SAFE, "FUNC_SAFE" }, { 0, NULL } }; const struct YamlIdStr enum_SwashType[] = { @@ -274,6 +275,7 @@ static const struct YamlNode struct_CustomFunctionData[] = { YAML_IDX, YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), YAML_ENUM("func", 6, enum_Functions), + YAML_STRING("custName", 10), YAML_CUSTOM("def",r_customFn,w_customFn), YAML_PADDING( 64 ), YAML_PADDING( 1 ), @@ -348,7 +350,7 @@ static const struct YamlNode struct_RadioData[] = { 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_ARRAY("customFn", 168, 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), @@ -498,6 +500,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = { YAML_PADDING( 16 ), YAML_UNSIGNED( "delay", 8 ), YAML_UNSIGNED( "duration", 8 ), + YAML_STRING("custName", 10), YAML_END }; static const struct YamlNode struct_SwashRingData[] = { @@ -839,8 +842,8 @@ static const struct YamlNode struct_ModelData[] = { 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_ARRAY("logicalSw", 152, 64, struct_LogicalSwitchData, NULL), + YAML_ARRAY("customFn", 168, 64, struct_CustomFunctionData, cfn_is_active), YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active), YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active), YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ), diff --git a/radio/src/storage/yaml/yaml_datastructs_x9d.cpp b/radio/src/storage/yaml/yaml_datastructs_x9d.cpp index 36af8afae04..4025d33b93a 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x9d.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x9d.cpp @@ -131,6 +131,7 @@ const struct YamlIdStr enum_LogicalSwitchesFunctions[] = { { LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" }, { LS_FUNC_TIMER, "FUNC_TIMER" }, { LS_FUNC_STICKY, "FUNC_STICKY" }, + { LS_FUNC_SAFE, "FUNC_SAFE" }, { 0, NULL } }; const struct YamlIdStr enum_SwashType[] = { @@ -256,6 +257,7 @@ static const struct YamlNode struct_CustomFunctionData[] = { YAML_IDX, YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), YAML_ENUM("func", 6, enum_Functions), + YAML_STRING("custName", 10), YAML_CUSTOM("def",r_customFn,w_customFn), YAML_PADDING( 64 ), YAML_PADDING( 1 ), @@ -332,7 +334,7 @@ static const struct YamlNode struct_RadioData[] = { 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_ARRAY("customFn", 168, 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), @@ -470,6 +472,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = { YAML_PADDING( 16 ), YAML_UNSIGNED( "delay", 8 ), YAML_UNSIGNED( "duration", 8 ), + YAML_STRING("custName", 10), YAML_END }; static const struct YamlNode struct_SwashRingData[] = { @@ -804,8 +807,8 @@ static const struct YamlNode struct_ModelData[] = { 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_ARRAY("logicalSw", 152, 64, struct_LogicalSwitchData, NULL), + YAML_ARRAY("customFn", 168, 64, struct_CustomFunctionData, cfn_is_active), YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active), YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active), YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ), diff --git a/radio/src/storage/yaml/yaml_datastructs_x9dp2019.cpp b/radio/src/storage/yaml/yaml_datastructs_x9dp2019.cpp index 9cc689ff730..cc5a991b6b9 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x9dp2019.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x9dp2019.cpp @@ -131,6 +131,7 @@ const struct YamlIdStr enum_LogicalSwitchesFunctions[] = { { LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" }, { LS_FUNC_TIMER, "FUNC_TIMER" }, { LS_FUNC_STICKY, "FUNC_STICKY" }, + { LS_FUNC_SAFE, "FUNC_SAFE" }, { 0, NULL } }; const struct YamlIdStr enum_SwashType[] = { @@ -256,6 +257,7 @@ static const struct YamlNode struct_CustomFunctionData[] = { YAML_IDX, YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), YAML_ENUM("func", 6, enum_Functions), + YAML_STRING("custName", 10), YAML_CUSTOM("def",r_customFn,w_customFn), YAML_PADDING( 64 ), YAML_PADDING( 1 ), @@ -332,7 +334,7 @@ static const struct YamlNode struct_RadioData[] = { 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_ARRAY("customFn", 168, 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), @@ -471,6 +473,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = { YAML_PADDING( 16 ), YAML_UNSIGNED( "delay", 8 ), YAML_UNSIGNED( "duration", 8 ), + YAML_STRING("custName", 10), YAML_END }; static const struct YamlNode struct_SwashRingData[] = { @@ -805,8 +808,8 @@ static const struct YamlNode struct_ModelData[] = { 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_ARRAY("logicalSw", 152, 64, struct_LogicalSwitchData, NULL), + YAML_ARRAY("customFn", 168, 64, struct_CustomFunctionData, cfn_is_active), YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active), YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active), YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ), diff --git a/radio/src/storage/yaml/yaml_datastructs_x9e.cpp b/radio/src/storage/yaml/yaml_datastructs_x9e.cpp index ee42c348763..efb424446b8 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x9e.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x9e.cpp @@ -131,6 +131,7 @@ const struct YamlIdStr enum_LogicalSwitchesFunctions[] = { { LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" }, { LS_FUNC_TIMER, "FUNC_TIMER" }, { LS_FUNC_STICKY, "FUNC_STICKY" }, + { LS_FUNC_SAFE, "FUNC_SAFE" }, { 0, NULL } }; const struct YamlIdStr enum_SwashType[] = { @@ -256,6 +257,7 @@ static const struct YamlNode struct_CustomFunctionData[] = { YAML_IDX, YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), YAML_ENUM("func", 6, enum_Functions), + YAML_STRING("custName", 10), YAML_CUSTOM("def",r_customFn,w_customFn), YAML_PADDING( 64 ), YAML_PADDING( 1 ), @@ -332,7 +334,7 @@ static const struct YamlNode struct_RadioData[] = { 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_ARRAY("customFn", 168, 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), @@ -471,6 +473,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = { YAML_PADDING( 16 ), YAML_UNSIGNED( "delay", 8 ), YAML_UNSIGNED( "duration", 8 ), + YAML_STRING("custName", 10), YAML_END }; static const struct YamlNode struct_SwashRingData[] = { @@ -805,8 +808,8 @@ static const struct YamlNode struct_ModelData[] = { 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_ARRAY("logicalSw", 152, 64, struct_LogicalSwitchData, NULL), + YAML_ARRAY("customFn", 168, 64, struct_CustomFunctionData, cfn_is_active), YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active), YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active), YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ), diff --git a/radio/src/storage/yaml/yaml_datastructs_xlite.cpp b/radio/src/storage/yaml/yaml_datastructs_xlite.cpp index 6a0d2eb13ba..8a37e998555 100644 --- a/radio/src/storage/yaml/yaml_datastructs_xlite.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_xlite.cpp @@ -131,6 +131,7 @@ const struct YamlIdStr enum_LogicalSwitchesFunctions[] = { { LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" }, { LS_FUNC_TIMER, "FUNC_TIMER" }, { LS_FUNC_STICKY, "FUNC_STICKY" }, + { LS_FUNC_SAFE, "FUNC_SAFE" }, { 0, NULL } }; const struct YamlIdStr enum_SwashType[] = { @@ -256,6 +257,7 @@ static const struct YamlNode struct_CustomFunctionData[] = { YAML_IDX, YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), YAML_ENUM("func", 6, enum_Functions), + YAML_STRING("custName", 10), YAML_CUSTOM("def",r_customFn,w_customFn), YAML_PADDING( 64 ), YAML_PADDING( 1 ), @@ -332,7 +334,7 @@ static const struct YamlNode struct_RadioData[] = { 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_ARRAY("customFn", 168, 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), @@ -470,6 +472,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = { YAML_PADDING( 16 ), YAML_UNSIGNED( "delay", 8 ), YAML_UNSIGNED( "duration", 8 ), + YAML_STRING("custName", 10), YAML_END }; static const struct YamlNode struct_SwashRingData[] = { @@ -804,8 +807,8 @@ static const struct YamlNode struct_ModelData[] = { 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_ARRAY("logicalSw", 152, 64, struct_LogicalSwitchData, NULL), + YAML_ARRAY("customFn", 168, 64, struct_CustomFunctionData, cfn_is_active), YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active), YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active), YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ), diff --git a/radio/src/storage/yaml/yaml_datastructs_xlites.cpp b/radio/src/storage/yaml/yaml_datastructs_xlites.cpp index 03516dab30a..271042583c5 100644 --- a/radio/src/storage/yaml/yaml_datastructs_xlites.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_xlites.cpp @@ -133,6 +133,7 @@ const struct YamlIdStr enum_LogicalSwitchesFunctions[] = { { LS_FUNC_ADIFFEGREATER, "FUNC_ADIFFEGREATER" }, { LS_FUNC_TIMER, "FUNC_TIMER" }, { LS_FUNC_STICKY, "FUNC_STICKY" }, + { LS_FUNC_SAFE, "FUNC_SAFE" }, { 0, NULL } }; const struct YamlIdStr enum_SwashType[] = { @@ -258,6 +259,7 @@ static const struct YamlNode struct_CustomFunctionData[] = { YAML_IDX, YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ), YAML_ENUM("func", 6, enum_Functions), + YAML_STRING("custName", 10), YAML_CUSTOM("def",r_customFn,w_customFn), YAML_PADDING( 64 ), YAML_PADDING( 1 ), @@ -334,7 +336,7 @@ static const struct YamlNode struct_RadioData[] = { 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_ARRAY("customFn", 168, 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), @@ -474,6 +476,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = { YAML_PADDING( 16 ), YAML_UNSIGNED( "delay", 8 ), YAML_UNSIGNED( "duration", 8 ), + YAML_STRING("custName", 10), YAML_END }; static const struct YamlNode struct_SwashRingData[] = { @@ -808,8 +811,8 @@ static const struct YamlNode struct_ModelData[] = { 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_ARRAY("logicalSw", 152, 64, struct_LogicalSwitchData, NULL), + YAML_ARRAY("customFn", 168, 64, struct_CustomFunctionData, cfn_is_active), YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active), YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active), YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ), diff --git a/radio/src/switches.cpp b/radio/src/switches.cpp index 10a2eee0279..f3c9052abb3 100644 --- a/radio/src/switches.cpp +++ b/radio/src/switches.cpp @@ -518,77 +518,79 @@ bool getLogicalSwitch(uint8_t idx) LogicalSwitchContext &context = lswFm[mixerCurrentFlightMode].lsw[idx]; bool result; - swsrc_t s = ls->andsw; + if (ls->func == LS_FAMILY_SAFE) { + result = lswFm[mixerCurrentFlightMode].lsw[idx].state; + } else { + swsrc_t s = ls->andsw; - if (ls->func == LS_FUNC_NONE || (s && !getSwitch(s))) { - if (ls->func != LS_FUNC_STICKY && ls->func != LS_FUNC_EDGE ) { - // AND switch must not affect STICKY and EDGE processing - context.lastValue = CS_LAST_VALUE_INIT; - } - result = false; - } - else if ((s=lswFamily(ls->func)) == LS_FAMILY_BOOL) { - bool res1 = getSwitch(ls->v1); - bool res2 = getSwitch(ls->v2); - switch (ls->func) { - case LS_FUNC_AND: - result = (res1 && res2); - break; - case LS_FUNC_OR: - result = (res1 || res2); - break; - // case LS_FUNC_XOR: - default: - result = (res1 ^ res2); - break; + if (ls->func == LS_FUNC_NONE || (s && !getSwitch(s))) { + if (ls->func != LS_FUNC_STICKY && ls->func != LS_FUNC_EDGE ) { + // AND switch must not affect STICKY and EDGE processing + LS_LAST_VALUE(mixerCurrentFlightMode, idx) = CS_LAST_VALUE_INIT; + } + result = false; } - } - else if (s == LS_FAMILY_TIMER) { - result = (context.lastValue <= 0); - } - else if (s == LS_FAMILY_STICKY) { - result = (context.lastValue & (1<<0)); - } - else if (s == LS_FAMILY_EDGE) { - result = (context.lastValue & (1<<0)); - } - else { - getvalue_t x = getValueForLogicalSwitch(ls->v1); - getvalue_t y; - if (s == LS_FAMILY_COMP) { - y = getValueForLogicalSwitch(ls->v2); - + else if ((s=lswFamily(ls->func)) == LS_FAMILY_BOOL) { + bool res1 = getSwitch(ls->v1); + bool res2 = getSwitch(ls->v2); switch (ls->func) { - case LS_FUNC_EQUAL: - result = (x==y); + case LS_FUNC_AND: + result = (res1 && res2); break; - case LS_FUNC_GREATER: - result = (x>y); + case LS_FUNC_OR: + result = (res1 || res2); break; + // case LS_FUNC_XOR: default: - result = (xv1; - // Telemetry - if (v1 >= MIXSRC_FIRST_TELEM) { - if (!TELEMETRY_STREAMING() || IS_FAI_FORBIDDEN(v1-1)) { - result = false; - goto DurationAndDelayProcessing; - } + getvalue_t x = getValueForLogicalSwitch(ls->v1); + getvalue_t y; + if (s == LS_FAMILY_COMP) { + y = getValueForLogicalSwitch(ls->v2); + + switch (ls->func) { + case LS_FUNC_EQUAL: + result = (x == y); + break; + case LS_FUNC_GREATER: + result = (x > y); + break; + default: + result = (x < y); + break; + } + } else { + mixsrc_t v1 = ls->v1; + // Telemetry + if (v1 >= MIXSRC_FIRST_TELEM) { + if (!TELEMETRY_STREAMING() || IS_FAI_FORBIDDEN(v1 - 1)) { + result = false; + goto DurationAndDelayProcessing; + } - y = convertLswTelemValue(ls); + y = convertLswTelemValue(ls); - } - else if (v1 >= MIXSRC_FIRST_GVAR) { - y = ls->v2; - } - else { - y = calc100toRESX(ls->v2); - } + } + else if (v1 >= MIXSRC_FIRST_GVAR) { + y = ls->v2; + } + else { + y = calc100toRESX(ls->v2); + } switch (ls->func) { case LS_FUNC_VEQUAL: @@ -652,44 +654,43 @@ bool getLogicalSwitch(uint8_t idx) } } -DurationAndDelayProcessing: - - if (ls->delay || ls->duration) { - if (result) { - if (context.timerState == SWITCH_START) { - // set delay timer - context.timerState = SWITCH_DELAY; - context.timer = (ls->func == LS_FUNC_EDGE ? 0 : ls->delay); - } + DurationAndDelayProcessing: - if (context.timerState == SWITCH_DELAY) { - if (context.timer) { - result = false; // return false while delay timer running + if (ls->delay || ls->duration) { + if (result) { + if (context.timerState == SWITCH_START) { + // set delay timer + context.timerState = SWITCH_DELAY; + context.timer = (ls->func == LS_FUNC_EDGE ? 0 : ls->delay); } - else { - // set duration timer - context.timerState = SWITCH_ENABLE; - context.timer = ls->duration; + + if (context.timerState == SWITCH_DELAY) { + if (context.timer) { + result = false; // return false while delay timer running + } else { + // set duration timer + context.timerState = SWITCH_ENABLE; + context.timer = ls->duration; + } } - } - if (context.timerState == SWITCH_ENABLE) { - result = (ls->duration==0 || context.timer>0); // return false after duration timer runs out - if (!result && ls->func == LS_FUNC_STICKY) { - ls_sticky_struct & lastValue = (ls_sticky_struct &)context.lastValue; - lastValue.state = 0; + if (context.timerState == SWITCH_ENABLE) { + result = (ls->duration == 0 || context.timer > 0); // return false after duration timer runs out + if (!result && ls->func == LS_FUNC_STICKY) { + ls_sticky_struct &lastValue = (ls_sticky_struct &)context.lastValue; + lastValue.state = 0; + } } + } else if (context.timerState == SWITCH_ENABLE && ls->duration > 0 && + context.timer > 0) { + result = true; + } else { + context.timerState = SWITCH_START; + context.timer = 0; } } - else if (context.timerState == SWITCH_ENABLE && ls->duration > 0 && context.timer > 0) { - result = true; - } - else { - context.timerState = SWITCH_START; - context.timer = 0; - } } - + } return result; } @@ -782,28 +783,53 @@ uint8_t getXPotPosition(uint8_t idx) return potsPos[idx] & 0x0F; } +void evalLogicalSwitch_FUNC_SAFE(LogicalSwitchData *ls, + LogicalSwitchContext &context) +{ + if (ls->v1 != SWSRC_NONE) { + if (getSwitch(ls->v2)) { + // ON + if (getSwitch(ls->v1)) { + context.state = 1; + } + // OFF + if (!getSwitch(ls->v1)) { + context.state = 0; + } + } + } else { // no source set therfore switch is off + context.state = 0; + } +} /** @brief Calculates new state of logical switches for mixerCurrentFlightMode */ void evalLogicalSwitches(bool isCurrentFlightmode) { + for (unsigned int idx=0; idxfunc == LS_FUNC_SAFE) { + evalLogicalSwitch_FUNC_SAFE(ls, context); + } else { + bool result = getLogicalSwitch(idx); + if (isCurrentFlightmode) { + if (result) { + if (!context.state) PLAY_LOGICAL_SWITCH_ON(idx); + } + else { + if (context.state) PLAY_LOGICAL_SWITCH_OFF(idx); + } } - else { - if (context.state) PLAY_LOGICAL_SWITCH_OFF(idx); + context.state = result; + if ((g_model.logicalSw[idx].func == LS_FUNC_STICKY) && (g_model.logicalSw[idx].lsState != result)) { + g_model.logicalSw[idx].lsState = result; + storageDirty(EE_MODEL); } } - context.state = result; - if ((g_model.logicalSw[idx].func == LS_FUNC_STICKY) && (g_model.logicalSw[idx].lsState != result)) { - g_model.logicalSw[idx].lsState = result; - storageDirty(EE_MODEL); - } } } @@ -1083,6 +1109,7 @@ void logicalSwitchesTimerTick() for (uint8_t fm=0; fmfunc == LS_FUNC_TIMER) { int16_t *lastValue = &LS_LAST_VALUE(fm, i); if (*lastValue == 0 || *lastValue == CS_LAST_VALUE_INIT) { @@ -1117,6 +1144,9 @@ void logicalSwitchesTimerTick() } } } + } else if (ls->func == LS_FUNC_SAFE) { + LogicalSwitchContext &context = lswFm[mixerCurrentFlightMode].lsw[i]; + evalLogicalSwitch_FUNC_SAFE(ls, context); } else if (ls->func == LS_FUNC_EDGE) { ls_stay_struct & lastValue = (ls_stay_struct &)LS_LAST_VALUE(fm, i); // if this ls was reset by the logicalSwitchesReset() the lastValue will be set to CS_LAST_VALUE_INIT(0x8000) diff --git a/radio/src/switches.h b/radio/src/switches.h index 59020d4fc14..b80cff522b9 100644 --- a/radio/src/switches.h +++ b/radio/src/switches.h @@ -32,6 +32,7 @@ enum LogicalSwitchFamilies { LS_FAMILY_DIFF, LS_FAMILY_TIMER, LS_FAMILY_STICKY, + LS_FAMILY_SAFE, LS_FAMILY_RANGE, LS_FAMILY_EDGE }; diff --git a/radio/src/translations.cpp b/radio/src/translations.cpp index c398a53a6b3..0ae4df780db 100644 --- a/radio/src/translations.cpp +++ b/radio/src/translations.cpp @@ -341,7 +341,9 @@ const char STR_MENUCURVES[] = TR_MENUCURVES; const char STR_MENUCURVE[] = TR_MENUCURVE; const char STR_MENULOGICALSWITCH[] = TR_MENULOGICALSWITCH; const char STR_MENULOGICALSWITCHES[] = TR_MENULOGICALSWITCHES; +const char STR_CUST_LOGICALSWITCH_LABEL[] = TR_CUST_LOGICALSWITCH_LABEL; const char STR_MENUCUSTOMFUNC[] = TR_MENUCUSTOMFUNC; +const char STR_CUST_FUNC_CUST_LABEL[] = TR_CUST_FUNC_CUST_LABEL; const char STR_SPLASHSCREEN[] = TR_SPLASHSCREEN; const char STR_PLAY_HELLO[] = TR_PLAY_HELLO; const char STR_PWR_ON_DELAY[] = TR_PWR_ON_DELAY; diff --git a/radio/src/translations.h b/radio/src/translations.h index f0c0722720c..f02a82d682d 100644 --- a/radio/src/translations.h +++ b/radio/src/translations.h @@ -528,7 +528,9 @@ extern const char STR_MENUCURVES[]; extern const char STR_MENUCURVE[]; extern const char STR_MENULOGICALSWITCH[]; extern const char STR_MENULOGICALSWITCHES[]; +extern const char STR_CUST_LOGICALSWITCH_LABEL[]; extern const char STR_MENUCUSTOMFUNC[]; +extern const char STR_CUST_FUNC_CUST_LABEL[]; extern const char STR_MENUCUSTOMSCRIPTS[]; extern const char STR_MENUTELEMETRY[]; extern const char STR_MENUSTAT[]; diff --git a/radio/src/translations/cn.h b/radio/src/translations/cn.h index 8b843f5aefa..5fef6341c11 100644 --- a/radio/src/translations/cn.h +++ b/radio/src/translations/cn.h @@ -76,6 +76,7 @@ #define TR_CSWTIMER "定时" #define TR_CSWSTICKY "粘滞" #define TR_CSWSTAY "边沿" +#define TR_CSWSAFE "Safe" #define TR_CSWEQUAL "a=x" #define TR_VCSWFUNC "---",TR_CSWEQUAL,"a" STR_CHAR_TILDE "x","a>x","ax","|a|b","a= 212 #define TR_CSWTIMER "Stopky" + #define TR_CSWSAFE "Safe" #define TR_CSWSTICKY "Sticky" #define TR_CSWSTAY "Edge" #else #define TR_CSWTIMER "Tim" + #define TR_CSWSAFE "Safe" #define TR_CSWSTICKY "Stky" #define TR_CSWSTAY "Edge" #endif diff --git a/radio/src/translations/da.h b/radio/src/translations/da.h index 387b8a28d66..a4ae66147d3 100644 --- a/radio/src/translations/da.h +++ b/radio/src/translations/da.h @@ -82,15 +82,17 @@ #if LCD_W >= 212 #define TR_CSWTIMER "Tid" #define TR_CSWSTICKY "Sej" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Edge" #else #define TR_CSWTIMER "Tid" #define TR_CSWSTICKY "Sej" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Edge" #endif #define TR_CSWEQUAL "a=x" -#define TR_VCSWFUNC "---",TR_CSWEQUAL,"a" STR_CHAR_TILDE "x","a>x","ax","|a|b","ax","ax","|a|b","a= 212 #define TR_CSWTIMER "Takt" // TIM = Takt = Taktgenerator #define TR_CSWSTICKY "SRFF" // Sticky = RS-Flip-Flop + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Puls" // Edge = einstellbarer Impuls #else #define TR_CSWTIMER "Takt" // TIM = Takt = Taktgenerator #define TR_CSWSTICKY "SRFF" // Sticky = RS-Flip-Flop + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Puls" // Edge = einstellbarer Impuls #endif #define TR_CSWEQUAL "a=x" -#define TR_VCSWFUNC "---",TR_CSWEQUAL,"a" STR_CHAR_TILDE "x","a>x","ax","|a|b","ax","ax","|a|b","a= 212 #define TR_CSWTIMER "Timer" #define TR_CSWSTICKY "Stcky" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Edge" #else #define TR_CSWTIMER "Tim" #define TR_CSWSTICKY "Stky" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Edge" #endif #define TR_CSWEQUAL "a=x" -#define TR_VCSWFUNC "---",TR_CSWEQUAL,"a" STR_CHAR_TILDE "x","a>x","ax","|a|b","ax","ax","|a|b","a= 212 #define TR_CSWTIMER "Timer" #define TR_CSWSTICKY "Pega" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Borde" #else #define TR_CSWTIMER "Tim" #define TR_CSWSTICKY "Pega" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Bord" #endif #define TR_CSWEQUAL "a=x" -#define TR_VCSWFUNC "---",TR_CSWEQUAL,"a" STR_CHAR_TILDE "x","a>x","ax","|a|b","ax","ax","|a|b","ax","ax","|a|b","ax","ax","|a|b","a= 212 #define TR_CSWTIMER "Chrono" #define TR_CSWSTICKY "Bistb" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Edge" #else #define TR_CSWTIMER "Chrono" #define TR_CSWSTICKY "Bist" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Edge" #endif #define TR_CSWEQUAL "a=x" -#define TR_VCSWFUNC "---",TR_CSWEQUAL,"a" STR_CHAR_TILDE "x","a>x","ax","|a|b","ax","ax","|a|b","ax","ax","|a|b","ax","ax","|a|b","a= 212 #define TR_CSWTIMER "Timer" #define TR_CSWSTICKY "Stcky" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Edge" #else #define TR_CSWTIMER "Tim" #define TR_CSWSTICKY "Stky" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Edge" #endif #define TR_CSWEQUAL "a=x" -#define TR_VCSWFUNC "---",TR_CSWEQUAL,"a" STR_CHAR_TILDE "x","a>x","ax","|a|b","ax","ax","|a|b","a= 212 #define TR_CSWTIMER "Timer" #define TR_CSWSTICKY "Stcky" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Edge" #else #define TR_CSWTIMER "Tim" #define TR_CSWSTICKY "Glue" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Edge" #endif #define TR_CSWEQUAL "a=x" -#define TR_VCSWFUNC "---",TR_CSWEQUAL,"a" STR_CHAR_TILDE "x","a>x","ax","|a|b","ax","ax","|a|b","a= 212 #define TR_CSWTIMER "Timer" #define TR_CSWSTICKY "Stały" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Brzeg" #else #define TR_CSWTIMER "Tim" #define TR_CSWSTICKY "Stały" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Brzeg" #endif #define TR_CSWEQUAL "a=x" -#define TR_VCSWFUNC "---",TR_CSWEQUAL,"a" STR_CHAR_TILDE "x","a>x","ax","|a|b","ax","ax","|a|b","a= 212 #define TR_CSWTIMER "Timer" #define TR_CSWSTICKY "Stcky" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Edge" #else #define TR_CSWTIMER "Tim" #define TR_CSWSTICKY "Stky" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Edge" #endif #define TR_CSWEQUAL "a=x" -#define TR_VCSWFUNC "---",TR_CSWEQUAL,"a" STR_CHAR_TILDE "x","a>x","ax","|a|b","ax","ax","|a|b","a= 212 #define TR_CSWTIMER "Timer" #define TR_CSWSTICKY "Seg" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Kant" #else #define TR_CSWTIMER "Tim" #define TR_CSWSTICKY "Seg" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Kant" #endif #define TR_CSWEQUAL "a=x" -#define TR_VCSWFUNC "---",TR_CSWEQUAL,"a" STR_CHAR_TILDE "x","a>x","ax","|a|b","ax","ax","|a|b","a= 212 #define TR_CSWTIMER "定時" #define TR_CSWSTICKY "粘滯" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "邊沿" #else #define TR_CSWTIMER "定時" #define TR_CSWSTICKY "粘滯" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "邊沿" #endif #define TR_CSWEQUAL "a=x" -#define TR_VCSWFUNC "---",TR_CSWEQUAL,"a" STR_CHAR_TILDE "x","a>x","ax","|a|b","ax","ax","|a|b","a Date: Wed, 7 Aug 2024 01:58:43 +0000 Subject: [PATCH 2/6] chore(cpn): remove change noise --- companion/src/firmwares/logicalswitchdata.h | 10 ++++++---- companion/src/modeledit/customfunctions.cpp | 6 +----- companion/src/modeledit/logicalswitches.cpp | 2 +- companion/src/modeledit/logicalswitches.h | 5 ++++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/companion/src/firmwares/logicalswitchdata.h b/companion/src/firmwares/logicalswitchdata.h index 181362efb33..830d7e7bd2e 100644 --- a/companion/src/firmwares/logicalswitchdata.h +++ b/companion/src/firmwares/logicalswitchdata.h @@ -19,7 +19,8 @@ * GNU General Public License for more details. */ -#pragma once +#ifndef LOGICALSWITCHDATA_H +#define LOGICALSWITCHDATA_H #include @@ -49,9 +50,8 @@ enum CSFunction { LS_FN_TIMER, LS_FN_STICKY, LS_FN_EDGE, - LS_FN_SAFE, + LS_FN_SAFE // later ... LS_FN_RANGE, - LS_FN_MAX, }; @@ -62,7 +62,7 @@ enum CSFunctionFamily { LS_FAMILY_TIMER, LS_FAMILY_STICKY, LS_FAMILY_EDGE, - LS_FAMILY_SAFE, + LS_FAMILY_SAFE }; class LogicalSwitchData { @@ -93,3 +93,5 @@ class LogicalSwitchData { QString nameToString(int index) const; void convert(RadioDataConversionState & cstate); }; + +#endif // LOGICALSWITCHDATA_H diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index c3837b6bd95..ea11a995030 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -224,7 +224,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, fswtchRepeat[i]->setModel(tabModelFactory->getItemModel(repeatSetScreenId)); else fswtchRepeat[i]->setModel(tabModelFactory->getItemModel(repeatId)); - fswtchRepeat[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding); + fswtchRepeat[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); fswtchRepeat[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); repeatLayout->addWidget(fswtchRepeat[i], i + 1); connect(fswtchRepeat[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); @@ -396,15 +396,11 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) CustomFunctionData & cfn = functions[i]; AssignFunc func = (AssignFunc)fswtchFunc[i]->currentData().toInt(); - - unsigned int widgetsMask = 0; if (modified) { - cfn.swtch = RawSwitch(fswtchSwtch[i]->currentData().toInt()); cfn.func = func; cfn.enabled = fswtchEnable[i]->isChecked(); - } else { name[i]->setText(cfn.custName); diff --git a/companion/src/modeledit/logicalswitches.cpp b/companion/src/modeledit/logicalswitches.cpp index ab0571698b1..743cec8f891 100644 --- a/companion/src/modeledit/logicalswitches.cpp +++ b/companion/src/modeledit/logicalswitches.cpp @@ -517,7 +517,7 @@ void LogicalSwitchesPanel::populateFunctionCB(QComboBox *b) LS_FN_DAPOS, LS_FN_TIMER, LS_FN_STICKY, - LS_FN_SAFE, + LS_FN_SAFE }; b->clear(); diff --git a/companion/src/modeledit/logicalswitches.h b/companion/src/modeledit/logicalswitches.h index 88d5a3bd414..33ac8f341a4 100644 --- a/companion/src/modeledit/logicalswitches.h +++ b/companion/src/modeledit/logicalswitches.h @@ -19,7 +19,8 @@ * GNU General Public License for more details. */ -#pragma once +#ifndef _LOGICALSWITCHES_H_ +#define _LOGICALSWITCHES_H_ #include "modeledit.h" #include "radiodata.h" @@ -95,3 +96,5 @@ class LogicalSwitchesPanel : public ModelPanel void updateItemModels(); void connectItemModelEvents(const FilteredItemModel * itemModel); }; + +#endif // _LOGICALSWITCHES_H_ From 85f4af8fbbe3899b782a1dee9b91ddd1e511fb67 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Wed, 7 Aug 2024 03:03:04 +0000 Subject: [PATCH 3/6] fix(radio): remove change noise, fix extra brace --- radio/src/switches.cpp | 107 +++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 53 deletions(-) diff --git a/radio/src/switches.cpp b/radio/src/switches.cpp index f3c9052abb3..a8c3e8b1bef 100644 --- a/radio/src/switches.cpp +++ b/radio/src/switches.cpp @@ -526,7 +526,7 @@ bool getLogicalSwitch(uint8_t idx) if (ls->func == LS_FUNC_NONE || (s && !getSwitch(s))) { if (ls->func != LS_FUNC_STICKY && ls->func != LS_FUNC_EDGE ) { // AND switch must not affect STICKY and EDGE processing - LS_LAST_VALUE(mixerCurrentFlightMode, idx) = CS_LAST_VALUE_INIT; + context.lastValue = CS_LAST_VALUE_INIT; } result = false; } @@ -547,13 +547,13 @@ bool getLogicalSwitch(uint8_t idx) } } else if (s == LS_FAMILY_TIMER) { - result = (LS_LAST_VALUE(mixerCurrentFlightMode, idx) <= 0); + result = (context.lastValue <= 0); } else if (s == LS_FAMILY_STICKY) { - result = (LS_LAST_VALUE(mixerCurrentFlightMode, idx) & (1<<0)); + result = (context.lastValue & (1<<0)); } else if (s == LS_FAMILY_EDGE) { - result = (LS_LAST_VALUE(mixerCurrentFlightMode, idx) & (1<<0)); + result = (context.lastValue& (1<<0)); } else { getvalue_t x = getValueForLogicalSwitch(ls->v1); @@ -561,27 +561,28 @@ bool getLogicalSwitch(uint8_t idx) if (s == LS_FAMILY_COMP) { y = getValueForLogicalSwitch(ls->v2); - switch (ls->func) { - case LS_FUNC_EQUAL: - result = (x == y); - break; - case LS_FUNC_GREATER: - result = (x > y); - break; - default: - result = (x < y); - break; + switch (ls->func) { + case LS_FUNC_EQUAL: + result = (x==y); + break; + case LS_FUNC_GREATER: + result = (x>y); + break; + default: + result = (xv1; + // Telemetry + if (v1 >= MIXSRC_FIRST_TELEM) { + if (!TELEMETRY_STREAMING() || IS_FAI_FORBIDDEN(v1 - 1)) { + result = false; + goto DurationAndDelayProcessing; } - } else { - mixsrc_t v1 = ls->v1; - // Telemetry - if (v1 >= MIXSRC_FIRST_TELEM) { - if (!TELEMETRY_STREAMING() || IS_FAI_FORBIDDEN(v1 - 1)) { - result = false; - goto DurationAndDelayProcessing; - } - y = convertLswTelemValue(ls); + y = convertLswTelemValue(ls); } @@ -654,41 +655,42 @@ bool getLogicalSwitch(uint8_t idx) } } - DurationAndDelayProcessing: +DurationAndDelayProcessing: - if (ls->delay || ls->duration) { - if (result) { - if (context.timerState == SWITCH_START) { - // set delay timer - context.timerState = SWITCH_DELAY; - context.timer = (ls->func == LS_FUNC_EDGE ? 0 : ls->delay); - } + if (ls->delay || ls->duration) { + if (result) { + if (context.timerState == SWITCH_START) { + // set delay timer + context.timerState = SWITCH_DELAY; + context.timer = (ls->func == LS_FUNC_EDGE ? 0 : ls->delay); + } - if (context.timerState == SWITCH_DELAY) { - if (context.timer) { - result = false; // return false while delay timer running - } else { - // set duration timer - context.timerState = SWITCH_ENABLE; - context.timer = ls->duration; - } + if (context.timerState == SWITCH_DELAY) { + if (context.timer) { + result = false; // return false while delay timer running } + else { + // set duration timer + context.timerState = SWITCH_ENABLE; + context.timer = ls->duration; + } + } - if (context.timerState == SWITCH_ENABLE) { - result = (ls->duration == 0 || context.timer > 0); // return false after duration timer runs out - if (!result && ls->func == LS_FUNC_STICKY) { - ls_sticky_struct &lastValue = (ls_sticky_struct &)context.lastValue; - lastValue.state = 0; - } + if (context.timerState == SWITCH_ENABLE) { + result = (ls->duration==0 || context.timer>0); // return false after duration timer runs out + if (!result && ls->func == LS_FUNC_STICKY) { + ls_sticky_struct & lastValue = (ls_sticky_struct &)context.lastValue; + lastValue.state = 0; } - } else if (context.timerState == SWITCH_ENABLE && ls->duration > 0 && - context.timer > 0) { - result = true; - } else { - context.timerState = SWITCH_START; - context.timer = 0; } } + else if (context.timerState == SWITCH_ENABLE && ls->duration > 0 && context.timer > 0) { + result = true; + } + else { + context.timerState = SWITCH_START; + context.timer = 0; + } } } return result; @@ -807,8 +809,7 @@ void evalLogicalSwitch_FUNC_SAFE(LogicalSwitchData *ls, */ void evalLogicalSwitches(bool isCurrentFlightmode) { - - for (unsigned int idx=0; idx Date: Wed, 7 Aug 2024 08:15:39 +0000 Subject: [PATCH 4/6] fix(cpn): #4670 name validation related changes --- companion/src/firmwares/logicalswitchdata.h | 4 ++-- companion/src/modeledit/customfunctions.cpp | 9 +++++---- companion/src/modeledit/logicalswitches.cpp | 5 +++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/companion/src/firmwares/logicalswitchdata.h b/companion/src/firmwares/logicalswitchdata.h index 830d7e7bd2e..cd01adc0b56 100644 --- a/companion/src/firmwares/logicalswitchdata.h +++ b/companion/src/firmwares/logicalswitchdata.h @@ -50,9 +50,9 @@ enum CSFunction { LS_FN_TIMER, LS_FN_STICKY, LS_FN_EDGE, - LS_FN_SAFE + LS_FN_SAFE, // later ... LS_FN_RANGE, - + LS_FN_MAX }; enum CSFunctionFamily { diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index ea11a995030..9bca8ff8d52 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -22,6 +22,7 @@ #include "customfunctions.h" #include "helpers.h" #include "appdata.h" +#include "namevalidator.h" #include @@ -33,6 +34,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, mediaPlayer(nullptr), modelsUpdateCnt(0) { + Board::Type board = firmware->getBoard(); lock = true; fswCapability = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions); @@ -86,7 +88,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, } } - if (IS_STM32(firmware->getBoard())) { + if (IS_STM32(board)) { scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/FUNCTIONS", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength)); for (int i = 0; i < fswCapability; i++) { if (functions[i].func == FuncPlayScript) { @@ -98,7 +100,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, } } - if (IS_STM32(firmware->getBoard())) { + if (IS_STM32(board)) { scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/RGBLED", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength)); for (int i = 0; i < fswCapability; i++) { if (functions[i].func == FuncRGBLed) { @@ -136,8 +138,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, name[i] = new QLineEdit(this); name[i]->setProperty("index", i); name[i]->setMaxLength(CF_CUSTNAME_LEN); - QRegExp rx(CHAR_FOR_NAMES_REGEX); - name[i]->setValidator(new QRegExpValidator(rx, this)); + name[i]->setValidator(new NameValidator(board, this)); name[i]->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); connect(name[i], SIGNAL(editingFinished()), this, SLOT(onNameEdited())); tableLayout->addWidget(i, 1, name[i]); diff --git a/companion/src/modeledit/logicalswitches.cpp b/companion/src/modeledit/logicalswitches.cpp index 743cec8f891..d4b1c44a7de 100644 --- a/companion/src/modeledit/logicalswitches.cpp +++ b/companion/src/modeledit/logicalswitches.cpp @@ -22,6 +22,7 @@ #include "logicalswitches.h" #include "filtereditemmodels.h" #include "helpers.h" +#include "namevalidator.h" #include @@ -32,6 +33,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, selectedIndex(0), modelsUpdateCnt(0) { + Board::Type board = firmware->getBoard(); rawSwitchFilteredModel = new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSwitch), RawSwitch::LogicalSwitchesContext); connectItemModelEvents(rawSwitchFilteredModel); @@ -69,8 +71,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, name[i] = new QLineEdit(this); name[i]->setProperty("index", i); name[i]->setMaxLength(LS_CUSTNAME_LEN); - QRegExp rx(CHAR_FOR_NAMES_REGEX); - name[i]->setValidator(new QRegExpValidator(rx, this)); + name[i]->setValidator(new NameValidator(board, this)); name[i]->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); connect(name[i], SIGNAL(editingFinished()), this, SLOT(onNameEdited())); tableLayout->addWidget(i, 1, name[i]); From e677cc7aacb0ea14473ca52eb18745461a213f37 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Wed, 7 Aug 2024 08:31:52 +0000 Subject: [PATCH 5/6] chore: remove more change noise --- companion/src/modeledit/logicalswitches.cpp | 4 ++-- companion/src/simulation/radiooutputswidget.cpp | 2 +- radio/src/switches.cpp | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/companion/src/modeledit/logicalswitches.cpp b/companion/src/modeledit/logicalswitches.cpp index d4b1c44a7de..afb6d44e23d 100644 --- a/companion/src/modeledit/logicalswitches.cpp +++ b/companion/src/modeledit/logicalswitches.cpp @@ -46,7 +46,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, lsCapabilityExt = firmware->getCapability(LogicalSwitchesExt); QStringList headerLabels; - headerLabels << "#" << tr("Name") << tr("Function") << tr("V1") << tr("V2") << tr("AND Switch"); + headerLabels << "#" << tr("Name") << tr("Function") << tr("V1") << tr("V2") << tr("AND Switch"); if (lsCapabilityExt) { headerLabels << tr("Duration") << tr("Delay"); } @@ -176,7 +176,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, disableMouseScrolling(); tableLayout->resizeColumnsToContents(); - tableLayout->pushRowsUp(lsCapability + 1); + tableLayout->pushRowsUp(lsCapability+1); } LogicalSwitchesPanel::~LogicalSwitchesPanel() diff --git a/companion/src/simulation/radiooutputswidget.cpp b/companion/src/simulation/radiooutputswidget.cpp index 834cfab94c8..f0974fe591c 100644 --- a/companion/src/simulation/radiooutputswidget.cpp +++ b/companion/src/simulation/radiooutputswidget.cpp @@ -304,7 +304,7 @@ QWidget * RadioOutputsWidget::createLogicalSwitch(QWidget * parent, int switchNo #endif font.setBold(false); swtch->setFont(font); - swtch->setText(QString("%1").arg(switchNo+1, 2, 10, QChar('0')) ); + swtch->setText(QString("%1").arg(switchNo+1, 2, 10, QChar('0'))); //swtch->setText(QString("%1").arg(switchNo+1, 2, 10, QChar('0')) + ": " + namestring); swtch->setAlignment(Qt::AlignCenter); m_logicSwitchMap.insert(switchNo, swtch); diff --git a/radio/src/switches.cpp b/radio/src/switches.cpp index a8c3e8b1bef..50e0f1f585c 100644 --- a/radio/src/switches.cpp +++ b/radio/src/switches.cpp @@ -809,7 +809,7 @@ void evalLogicalSwitch_FUNC_SAFE(LogicalSwitchData *ls, */ void evalLogicalSwitches(bool isCurrentFlightmode) { - for (unsigned int idx=0; idxfunc == LS_FUNC_TIMER) { int16_t *lastValue = &LS_LAST_VALUE(fm, i); if (*lastValue == 0 || *lastValue == CS_LAST_VALUE_INIT) { From 51e58f3920605b886c579000ef51acdc391da4d9 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Wed, 7 Aug 2024 08:53:16 +0000 Subject: [PATCH 6/6] chore: add missing translation string, limit some to colorlcd Use `TR_PHASES_HEADERS_NAME` as source text for missing language defines --- radio/src/translations.cpp | 4 ++-- radio/src/translations.h | 4 ++-- radio/src/translations/cn.h | 4 ++++ radio/src/translations/cz.h | 4 ++++ radio/src/translations/da.h | 4 ++++ radio/src/translations/de.h | 4 ++++ radio/src/translations/en.h | 6 ++++-- radio/src/translations/es.h | 4 ++++ radio/src/translations/fi.h | 4 ++++ radio/src/translations/fr.h | 4 ++++ radio/src/translations/he.h | 8 +++++++- radio/src/translations/it.h | 4 ++++ radio/src/translations/jp.h | 4 ++++ radio/src/translations/nl.h | 4 ++++ radio/src/translations/pl.h | 4 ++++ radio/src/translations/pt.h | 4 ++++ radio/src/translations/ru.h | 8 +++++++- radio/src/translations/se.h | 4 ++++ radio/src/translations/tw.h | 4 ++++ radio/src/translations/ua.h | 8 +++++++- 20 files changed, 85 insertions(+), 9 deletions(-) diff --git a/radio/src/translations.cpp b/radio/src/translations.cpp index 0ae4df780db..06c50aec59b 100644 --- a/radio/src/translations.cpp +++ b/radio/src/translations.cpp @@ -341,9 +341,7 @@ const char STR_MENUCURVES[] = TR_MENUCURVES; const char STR_MENUCURVE[] = TR_MENUCURVE; const char STR_MENULOGICALSWITCH[] = TR_MENULOGICALSWITCH; const char STR_MENULOGICALSWITCHES[] = TR_MENULOGICALSWITCHES; -const char STR_CUST_LOGICALSWITCH_LABEL[] = TR_CUST_LOGICALSWITCH_LABEL; const char STR_MENUCUSTOMFUNC[] = TR_MENUCUSTOMFUNC; -const char STR_CUST_FUNC_CUST_LABEL[] = TR_CUST_FUNC_CUST_LABEL; const char STR_SPLASHSCREEN[] = TR_SPLASHSCREEN; const char STR_PLAY_HELLO[] = TR_PLAY_HELLO; const char STR_PWR_ON_DELAY[] = TR_PWR_ON_DELAY; @@ -808,6 +806,8 @@ const char STR_BACKLIGHT_TIMER[] = TR_BACKLIGHT_TIMER; const char STR_LABELS_SELECT[] = TR_LABELS_SELECT; const char STR_LABELS_MATCH[] = TR_LABELS_MATCH; const char STR_FAV_MATCH[] = TR_FAV_MATCH; +const char STR_CUST_LOGICALSWITCH_LABEL[] = TR_CUST_LOGICALSWITCH_LABEL; +const char STR_CUST_FUNC_CUST_LABEL[] = TR_CUST_FUNC_CUST_LABEL; ISTR(LABELS_SELECT_MODE); ISTR(LABELS_MATCH_MODE); ISTR(FAV_MATCH_MODE); diff --git a/radio/src/translations.h b/radio/src/translations.h index f02a82d682d..4e0672b5f0c 100644 --- a/radio/src/translations.h +++ b/radio/src/translations.h @@ -528,9 +528,7 @@ extern const char STR_MENUCURVES[]; extern const char STR_MENUCURVE[]; extern const char STR_MENULOGICALSWITCH[]; extern const char STR_MENULOGICALSWITCHES[]; -extern const char STR_CUST_LOGICALSWITCH_LABEL[]; extern const char STR_MENUCUSTOMFUNC[]; -extern const char STR_CUST_FUNC_CUST_LABEL[]; extern const char STR_MENUCUSTOMSCRIPTS[]; extern const char STR_MENUTELEMETRY[]; extern const char STR_MENUSTAT[]; @@ -813,6 +811,8 @@ extern const char STR_FAV_MATCH[]; extern const char* const STR_LABELS_SELECT_MODE[]; extern const char* const STR_LABELS_MATCH_MODE[]; extern const char* const STR_FAV_MATCH_MODE[]; +extern const char STR_CUST_LOGICALSWITCH_LABEL[]; +extern const char STR_CUST_FUNC_CUST_LABEL[]; #endif extern const char STR_EXECUTE_FILE[]; extern const char STR_DELETE_FILE[]; diff --git a/radio/src/translations/cn.h b/radio/src/translations/cn.h index 5fef6341c11..2d703d00cb0 100644 --- a/radio/src/translations/cn.h +++ b/radio/src/translations/cn.h @@ -515,6 +515,10 @@ #define TR_MENULIMITS "输出设置" #define TR_MENUCURVES "曲线设置" #define TR_MENUCURVE "曲线" +#if defined(COLORLCD) +#define TR_CUST_LOGICALSWITCH_LABEL "名称" +#define TR_CUST_FUNC_CUST_LABEL "名称" +#endif #define TR_MENULOGICALSWITCH "逻辑开关" #define TR_MENULOGICALSWITCHES "逻辑开关设置" #define TR_MENUCUSTOMFUNC "特殊功能设置" diff --git a/radio/src/translations/cz.h b/radio/src/translations/cz.h index b2c10999a61..85227b664b2 100644 --- a/radio/src/translations/cz.h +++ b/radio/src/translations/cz.h @@ -533,6 +533,10 @@ #define TR_MENUCURVES "KŘIVKY" #define TR_MENUCURVE "\002K" +#if defined(COLORLCD) +#define TR_CUST_LOGICALSWITCH_LABEL "Název" +#define TR_CUST_FUNC_CUST_LABEL "Název" +#endif #define TR_MENULOGICALSWITCH "LOG. SPÍNAČ" #define TR_MENULOGICALSWITCHES "LOGICKÉ SPÍNAČE" #define TR_MENUCUSTOMFUNC "SPECIÁLNÍ FUNKCE" diff --git a/radio/src/translations/da.h b/radio/src/translations/da.h index a4ae66147d3..1e564ceb62b 100644 --- a/radio/src/translations/da.h +++ b/radio/src/translations/da.h @@ -520,6 +520,10 @@ #define TR_MENULIMITS "UDGANGE" #define TR_MENUCURVES "KURVER" #define TR_MENUCURVE "KURVE" +#if defined(COLORLCD) +#define TR_CUST_LOGICALSWITCH_LABEL "Navn" +#define TR_CUST_FUNC_CUST_LABEL "Navn" +#endif #define TR_MENULOGICALSWITCH "LOGISK FUNKTION" #define TR_MENULOGICALSWITCHES "LOGISKE FUNKTIONER" #define TR_MENUCUSTOMFUNC "SPECIALFUNKTIONER" diff --git a/radio/src/translations/de.h b/radio/src/translations/de.h index 3832c1c2dfe..09426227199 100644 --- a/radio/src/translations/de.h +++ b/radio/src/translations/de.h @@ -521,6 +521,10 @@ #define TR_MENULIMITS "SERVOS" //"AUSGABEN" oder "Servos" #define TR_MENUCURVES "KURVEN" #define TR_MENUCURVE "KURVE" +#if defined(COLORLCD) +#define TR_CUST_LOGICALSWITCH_LABEL "Name" +#define TR_CUST_FUNC_CUST_LABEL "Name" +#endif #define TR_MENULOGICALSWITCH "LOGIKSCHALTER" #define TR_MENULOGICALSWITCHES "LOGIKSCHALTER" #define TR_MENUCUSTOMFUNC TR("SPEZ.-FUNKTIONEN", "SPEZIAL-FUNKTIONEN") diff --git a/radio/src/translations/en.h b/radio/src/translations/en.h index ccf4641312a..58a4d70bcc3 100644 --- a/radio/src/translations/en.h +++ b/radio/src/translations/en.h @@ -518,11 +518,13 @@ #define TR_MENULIMITS "OUTPUTS" #define TR_MENUCURVES "CURVES" #define TR_MENUCURVE "CURVE" +#if defined(COLORLCD) +#define TR_CUST_LOGICALSWITCH_LABEL "Name" +#define TR_CUST_FUNC_CUST_LABEL "Name" +#endif #define TR_MENULOGICALSWITCH "LOGICAL SWITCH" #define TR_MENULOGICALSWITCHES "LOGICAL SWITCHES" -#define TR_CUST_LOGICALSWITCH_LABEL "Name" #define TR_MENUCUSTOMFUNC "SPECIAL FUNCTIONS" -#define TR_CUST_FUNC_CUST_LABEL "Name" #define TR_MENUCUSTOMSCRIPTS "CUSTOM SCRIPTS" #define TR_MENUTELEMETRY "TELEMETRY" #define TR_MENUSTAT "STATS" diff --git a/radio/src/translations/es.h b/radio/src/translations/es.h index 9d677bbc1f1..01cf356ec35 100644 --- a/radio/src/translations/es.h +++ b/radio/src/translations/es.h @@ -516,6 +516,10 @@ #define TR_MENUCURVES "CURVAS" #define TR_MENUCURVE "CURVA" +#if defined(COLORLCD) +#define TR_CUST_LOGICALSWITCH_LABEL "Nombre" +#define TR_CUST_FUNC_CUST_LABEL "Nombre" +#endif #define TR_MENULOGICALSWITCH "INTERRUP.LÓGICO" #define TR_MENULOGICALSWITCHES TR3("INTERRUP. LÓGICOS", "INTERRUP. LÓGICOS", "INTERRUPTORES LÓGICOS") #define TR_MENUCUSTOMFUNC TR("FUNCIONES", "FUNCIONES ESPECIALES") diff --git a/radio/src/translations/fi.h b/radio/src/translations/fi.h index 2ab758ffddc..098be87ec88 100644 --- a/radio/src/translations/fi.h +++ b/radio/src/translations/fi.h @@ -530,6 +530,10 @@ #define TR_MENUCURVES "CURVES" #define TR_MENUCURVE "CURVE" +#if defined(COLORLCD) +#define TR_CUST_LOGICALSWITCH_LABEL "Name" +#define TR_CUST_FUNC_CUST_LABEL "Name" +#endif #define TR_MENULOGICALSWITCH "CUSTOM SWITCH" #define TR_MENULOGICALSWITCHES "CUSTOM SWITCHES" #define TR_MENUCUSTOMFUNC "CUSTOM FUNCTIONS" diff --git a/radio/src/translations/fr.h b/radio/src/translations/fr.h index b3d41120618..4c2608fd5e3 100644 --- a/radio/src/translations/fr.h +++ b/radio/src/translations/fr.h @@ -522,6 +522,10 @@ #define TR_MENUCURVES "COURBES" #define TR_MENUCURVE "COURBE" +#if defined(COLORLCD) +#define TR_CUST_LOGICALSWITCH_LABEL "Nom" +#define TR_CUST_FUNC_CUST_LABEL "Nom" +#endif #define TR_MENULOGICALSWITCH "INTER LOG." #define TR_MENULOGICALSWITCHES TR("INTERS LOG.", "INTERS LOGIQUES") #define TR_MENUCUSTOMFUNC TR("FONCTIONS SPEC.", "FONCTIONS SPÉCIALES") diff --git a/radio/src/translations/he.h b/radio/src/translations/he.h index ba8c99f42cf..7237e2bc938 100644 --- a/radio/src/translations/he.h +++ b/radio/src/translations/he.h @@ -78,15 +78,17 @@ #if LCD_W >= 212 #define TR_CSWTIMER "שעון" #define TR_CSWSTICKY "Stcky" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Edge" #else #define TR_CSWTIMER "שעון" #define TR_CSWSTICKY "Stky" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Edge" #endif #define TR_CSWEQUAL "a=x" -#define TR_VCSWFUNC "---",TR_CSWEQUAL,"a" STR_CHAR_TILDE "x","a>x","ax","|a|b","ax","ax","|a|b","a= 212 #define TR_CSWTIMER "Таймер" #define TR_CSWSTICKY "Липучка" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Край" #else #define TR_CSWTIMER "Таймер" #define TR_CSWSTICKY "Липучка" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Кррай" #endif #define TR_CSWEQUAL "a=x" -#define TR_VCSWFUNC "---",TR_CSWEQUAL,"a" STR_CHAR_TILDE "x","a>x","ax","|a|b","ax","ax","|a|b","a= 212 #define TR_CSWTIMER "Таймер" #define TR_CSWSTICKY "Липучка" + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Край" #else #define TR_CSWTIMER "Тмр" #define TR_CSWSTICKY "Лип." + #define TR_CSWSAFE "Safe" #define TR_CSWSTAY "Край" #endif #define TR_CSWEQUAL "a=x" -#define TR_VCSWFUNC "---",TR_CSWEQUAL,"a" STR_CHAR_TILDE "x","a>x","ax","|a|b","ax","ax","|a|b","a