From 484e72ae73057dce1530daa692bcc7fd3c8436c9 Mon Sep 17 00:00:00 2001 From: dedici <79668905+dedici@users.noreply.github.com> Date: Sat, 16 Apr 2022 21:52:25 +0200 Subject: [PATCH] Added exception handling set_cmd with > 3 arguments used to throw "wrong format" exception with keystate = 0. Changed the exception message to a more helpful one. --- ED4scan/ED4scan_CLI.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ED4scan/ED4scan_CLI.ino b/ED4scan/ED4scan_CLI.ino index e3aa54c..0c06f13 100644 --- a/ED4scan/ED4scan_CLI.ino +++ b/ED4scan/ED4scan_CLI.ino @@ -390,11 +390,13 @@ void set_cmd(uint8_t arg_cnt, char **args) { } else{ cmdOK = 0; } + } else if (BMS.KeyState != 0) { + cmdOK = -2; } } if (cmdOK == 0) Serial.println(F("CMD: failed")); - if (cmdOK < 0) Serial.println(F("CMD: wrong format")); - + if (cmdOK == -1) Serial.println(F("CMD: wrong format")); + if (cmdOK == -2) Serial.println(F("CMD: Ignition key in wrong position")); } void init_cmd_prompt() {