mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
fix call commands from console
This commit is contained in:
@@ -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,8 +75,12 @@ bool Command::call(const uint8_t device_type, const char * cmd, const char * val
|
||||
return false;
|
||||
}
|
||||
|
||||
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
|
||||
void Command::add(const uint8_t device_type, const uint8_t device_id, const __FlashStringHelper * cmd, cmdfunction_p cb) {
|
||||
|
||||
Reference in New Issue
Block a user