Fix YamlSwitchWarningState

This commit is contained in:
elecpower
2021-12-31 10:53:10 +01:00
committed by Raphael Coeffic
parent d3e619cec4
commit 3809c1d0ff
@@ -170,7 +170,7 @@ struct YamlSwitchWarningState {
const char *sw = tag.data();
if (tag.size() >= 2 && sw[0] == 'S') {
char val[2];
char val[3];
val[0] = sw[1];
uint64_t value = (i == 0 ? states & 0x3 : states & 0x1);
@@ -181,6 +181,7 @@ struct YamlSwitchWarningState {
val[1] = '-';
else
val[1] = 'd';
val[2] = '\0';
src_str.append(val);
}
@@ -202,9 +203,10 @@ struct YamlSwitchWarningState {
int shift = 0;
uint64_t mask;
char sw[2];
char sw[3];
sw[0] = 'S';
sw[1] = val[0];
sw[2] = '\0';
int index = getCurrentFirmware()->getSwitchesIndex(sw);