Skip to content

Commit

Permalink
Fix TR shift in yaml reader
Browse files Browse the repository at this point in the history
  • Loading branch information
3djc committed Jun 26, 2023
1 parent 77e5925 commit 0743b33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions radio/src/storage/yaml/yaml_datastructs_funcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ static uint32_t r_swtchSrc(const YamlNode* node, const char* val, uint8_t val_le
&& val[0] == 'T' && val[1] == 'R'
&& val[2] >= '1' && val[2] <= '9') {

ival = SWSRC_FIRST_TRIM + yaml_str2int(val + 2, val_len - 3) * 2;
ival = SWSRC_FIRST_TRIM + (yaml_str2int(val + 2, val_len - 3)- 1) * 2;
if (val[val_len - 1] == '+') ival++;

}
Expand Down Expand Up @@ -911,7 +911,7 @@ static bool w_swtchSrc_unquoted(const YamlNode* node, uint32_t val,
auto trim = (sval - SWSRC_FIRST_TRIM) / 2;
str = yaml_unsigned2str(trim + 1);
wf(opaque, str, strlen(str));
return wf(opaque, sval & 1 ? "+" : "-", 1);
return wf(opaque, sval & 1 ? "-" : "+", 1);

} else if (sval <= SWSRC_LAST_LOGICAL_SWITCH) {

Expand Down

0 comments on commit 0743b33

Please sign in to comment.