From ec06442b85292f8a52b32c8af3e482ff70055468 Mon Sep 17 00:00:00 2001 From: MichaelDvP <59284019+MichaelDvP@users.noreply.github.com> Date: Tue, 24 Nov 2020 14:37:19 +0100 Subject: [PATCH] fix call commands from console --- src/command.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/command.cpp b/src/command.cpp index 880a479a8..dcf8328ac 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -65,7 +65,7 @@ bool Command::call(const uint8_t device_type, const char * cmd, const char * val #endif auto cf = find_command(device_type, cmd); - if ((cf == nullptr) || (!cf->cmdfunction_json_)) { + if (cf == nullptr) { return false; // command not found or not json } @@ -75,7 +75,11 @@ bool Command::call(const uint8_t device_type, const char * cmd, const char * val return false; } - return ((cf->cmdfunction_json_)(value, id, json)); + if (!cf->cmdfunction_json_) { + return ((cf->cmdfunction_)(value, id)); + } else { + return ((cf->cmdfunction_json_)(value, id, json)); + } } // add a command to the list, which does not return json @@ -197,4 +201,4 @@ void Command::show_all(uuid::console::Shell & shell) { } } -} // namespace emsesp \ No newline at end of file +} // namespace emsesp