Skip to content

Commit

Permalink
Fix parsing LS refs to LUA script output (#4589)
Browse files Browse the repository at this point in the history
  • Loading branch information
elecpower committed Jan 31, 2024
1 parent be2ab3d commit b21a841
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion companion/src/firmwares/edgetx/yaml_logicalswitchdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Node convert<LogicalSwitchData>::encode(const LogicalSwitchData& rhs)
node["delay"] = rhs.delay;
node["duration"] = rhs.duration;
node["andsw"] = YamlRawSwitchEncode(RawSwitch(rhs.andsw));

return node;
}

Expand Down Expand Up @@ -161,6 +161,11 @@ bool convert<LogicalSwitchData>::decode(const Node& node,
case LS_FAMILY_VCOMP: {
std::string src_str;
getline(def, src_str, ',');
if (def_str.size() >= 4 && def_str.substr(0, 4) == "lua(") {
std::string tmp_str;
getline(def, tmp_str, ',');
src_str += ("," + tmp_str);
}
rhs.val1 = YamlRawSourceDecode(src_str).toValue();
getline(def, src_str);
rhs.val2 = YamlRawSourceDecode(src_str).toValue();
Expand All @@ -178,6 +183,11 @@ bool convert<LogicalSwitchData>::decode(const Node& node,
default: {
std::string src_str;
getline(def, src_str, ',');
if (def_str.size() >= 4 && def_str.substr(0, 4) == "lua(") {
std::string tmp_str;
getline(def, tmp_str, ',');
src_str += ("," + tmp_str);
}
rhs.val1 = YamlRawSourceDecode(src_str).toValue();
def >> rhs.val2;
} break;
Expand Down

0 comments on commit b21a841

Please sign in to comment.