From 867390d7f0779a507b91949c138861235a132b2b Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sun, 23 May 2021 01:26:43 +0300 Subject: p18: fix set-charging-thresholds --- src/p18/commands.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') 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"); -- cgit v1.2.3