From 4dba8c6ce7a060384cf1a9af82c2272e7b8bcba9 Mon Sep 17 00:00:00 2001 From: Phil Mitchell Date: Tue, 27 Jun 2023 17:43:55 +1000 Subject: [PATCH] Restore reading of new trim names from YAML files. --- radio/src/storage/yaml/yaml_datastructs_funcs.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp index 2a753514c..35b47e53f 100644 --- a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp @@ -223,6 +223,12 @@ static uint32_t r_mixSrcRaw(const YamlNode* node, const char* val, uint8_t val_l val[3] <= '3') { return MIXSRC_FIRST_HELI + (val[3] - '1'); + + } else if (val_len > 1 && + val[0] == 'T' && + val[1] >= '1' && + val[1] <= '9') { + return yaml_str2uint(val + 1, val_len - 1) + MIXSRC_FIRST_TRIM - 1; } auto idx = analogLookupCanonicalIdx(ADC_INPUT_MAIN, val, val_len); @@ -834,6 +840,13 @@ static uint32_t r_swtchSrc(const YamlNode* node, const char* val, uint8_t val_le ival = (val[2] - '0') * XPOTS_MULTIPOS_COUNT + (val[3] - '0') + SWSRC_FIRST_MULTIPOS_SWITCH; } + else if (val_len > 3 + && val[0] == 'T' && val[1] == 'R' + && val[2] >= '1' && val[2] <= '9') { + + ival = SWSRC_FIRST_TRIM + (yaml_str2int(val + 2, val_len - 3) - 1) * 2; + if (val[val_len - 1] == '+') ival++; + } else if (val_len > 4 && (strncmp(val, trimSwitchNames[0], 4) == 0)) { for (int i = 0; i < sizeof(trimSwitchNames)/sizeof(const char*); i += 1) {