mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +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
|
#endif
|
||||||
|
|
||||||
auto cf = find_command(device_type, cmd);
|
auto cf = find_command(device_type, cmd);
|
||||||
if ((cf == nullptr) || (!cf->cmdfunction_json_)) {
|
if (cf == nullptr) {
|
||||||
return false; // command not found or not json
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!cf->cmdfunction_json_) {
|
||||||
|
return ((cf->cmdfunction_)(value, id));
|
||||||
|
} else {
|
||||||
return ((cf->cmdfunction_json_)(value, id, json));
|
return ((cf->cmdfunction_json_)(value, id, json));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add a command to the list, which does not return 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) {
|
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