Skip to content

Commit

Permalink
change yaml special source TIMERx to Tmrx
Browse files Browse the repository at this point in the history
  • Loading branch information
elecpower committed Aug 21, 2023
1 parent afe9f17 commit 0478fef
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
18 changes: 17 additions & 1 deletion companion/src/firmwares/edgetx/yaml_rawsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,23 @@ RawSource YamlRawSourceDecode(const std::string& src_str)
rhs.index = cyc_idx;
}

int sp_idx = getCurrentFirmware()->getRawSourceSpecialTypesIndex(src_str.c_str());
std::string special_str;
node >> special_str;

// 2.10 conversion of TIMERx to Tmrx
if (special_str.size() == 6) {
if (special_str.substr(0, 6) == "TIMER1") {
special_str = "Tmr1";
}
else if (special_str.substr(0, 6) == "TIMER2") {
special_str = "Tmr2";
}
else if (special_str.substr(0, 6) == "TIMER3") {
special_str = "Tmr3";
}
}

int sp_idx = getCurrentFirmware()->getRawSourceSpecialTypesIndex(special_str.c_str());
if (sp_idx >= 0) {
rhs.type = SOURCE_TYPE_SPECIAL;
rhs.index = sp_idx;
Expand Down
6 changes: 3 additions & 3 deletions companion/src/firmwares/rawsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,9 @@ tbl.insert(tbl.end(), {
{std::to_string(SOURCE_TYPE_SPECIAL_RESERVED2), "RESERVED2"},
{std::to_string(SOURCE_TYPE_SPECIAL_RESERVED3), "RESERVED3"},
{std::to_string(SOURCE_TYPE_SPECIAL_RESERVED4), "RESERVED4"},
{std::to_string(SOURCE_TYPE_SPECIAL_TIMER1), "TIMER1"},
{std::to_string(SOURCE_TYPE_SPECIAL_TIMER2), "TIMER2"},
{std::to_string(SOURCE_TYPE_SPECIAL_TIMER3), "TIMER3"},
{std::to_string(SOURCE_TYPE_SPECIAL_TIMER1), "Tmr1"},
{std::to_string(SOURCE_TYPE_SPECIAL_TIMER2), "Tmr2"},
{std::to_string(SOURCE_TYPE_SPECIAL_TIMER3), "Tmr3"},
});

return tbl;
Expand Down

0 comments on commit 0478fef

Please sign in to comment.