diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2021-05-23 01:26:43 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2021-05-23 01:26:43 +0300 |
commit | 867390d7f0779a507b91949c138861235a132b2b (patch) | |
tree | b264a09e6053a34c9b684083d679a3b7958c9315 /src | |
parent | 582b342a2ff9243b60ff8aeef7e1a46946d6d8bb (diff) |
p18: fix set-charging-thresholds
Diffstat (limited to 'src')
-rw-r--r-- | src/p18/commands.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/p18/commands.cc b/src/p18/commands.cc index 0d37566..1a8bc55 100644 --- a/src/p18/commands.cc +++ b/src/p18/commands.cc @@ -307,13 +307,13 @@ p18::CommandType validate_input(std::string& command, float cv = std::stof(arguments[0]); float dv = std::stof(arguments[1]); - if (index_of(p18::bat_ac_recharging_voltages_12v, cv) == -1 || - index_of(p18::bat_ac_recharging_voltages_24v, cv) == -1 || + if (index_of(p18::bat_ac_recharging_voltages_12v, cv) == -1 && + index_of(p18::bat_ac_recharging_voltages_24v, cv) == -1 && index_of(p18::bat_ac_recharging_voltages_48v, cv) == -1) throw std::invalid_argument("invalid CV"); - if (index_of(p18::bat_ac_redischarging_voltages_12v, dv) == -1 || - index_of(p18::bat_ac_redischarging_voltages_24v, dv) == -1 || + if (index_of(p18::bat_ac_redischarging_voltages_12v, dv) == -1 && + index_of(p18::bat_ac_redischarging_voltages_24v, dv) == -1 && index_of(p18::bat_ac_redischarging_voltages_48v, dv) == -1) throw std::invalid_argument("invalid DV"); |