@@ -102,7 +102,7 @@ RawSwitch YamlRawSwitchDecode(const std::string& sw_str)
|
|||||||
if (val_len >= 2 && val[0] == 'L' && (val[1] >= '0' && val[1] <= '9')) {
|
if (val_len >= 2 && val[0] == 'L' && (val[1] >= '0' && val[1] <= '9')) {
|
||||||
|
|
||||||
int sw_idx = std::stoi(sw_str_tmp.substr(1, val_len - 1));
|
int sw_idx = std::stoi(sw_str_tmp.substr(1, val_len - 1));
|
||||||
if (sw_idx < CPN_MAX_LOGICAL_SWITCHES) {
|
if (sw_idx <= CPN_MAX_LOGICAL_SWITCHES) {
|
||||||
rhs = RawSwitch(SWITCH_TYPE_VIRTUAL, sw_idx);
|
rhs = RawSwitch(SWITCH_TYPE_VIRTUAL, sw_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ RawSwitch YamlRawSwitchDecode(const std::string& sw_str)
|
|||||||
|
|
||||||
// starts at T1
|
// starts at T1
|
||||||
int sensor_idx = std::stoi(sw_str_tmp.substr(1, val_len - 1));
|
int sensor_idx = std::stoi(sw_str_tmp.substr(1, val_len - 1));
|
||||||
if ((sensor_idx > 0) && (sensor_idx < CPN_MAX_SENSORS)) {
|
if ((sensor_idx > 0) && (sensor_idx <= CPN_MAX_SENSORS)) {
|
||||||
rhs = RawSwitch(SWITCH_TYPE_SENSOR, sensor_idx - 1);
|
rhs = RawSwitch(SWITCH_TYPE_SENSOR, sensor_idx - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user