diff --git a/companion/src/firmwares/edgetx/yaml_rawswitch.cpp b/companion/src/firmwares/edgetx/yaml_rawswitch.cpp index 46d3d15ca..d1e7e6a3f 100644 --- a/companion/src/firmwares/edgetx/yaml_rawswitch.cpp +++ b/companion/src/firmwares/edgetx/yaml_rawswitch.cpp @@ -102,7 +102,7 @@ RawSwitch YamlRawSwitchDecode(const std::string& sw_str) 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)); - if (sw_idx < CPN_MAX_LOGICAL_SWITCHES) { + if (sw_idx <= CPN_MAX_LOGICAL_SWITCHES) { rhs = RawSwitch(SWITCH_TYPE_VIRTUAL, sw_idx); } @@ -123,7 +123,7 @@ RawSwitch YamlRawSwitchDecode(const std::string& sw_str) // starts at T1 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); }