mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-28 01:29:07 +03:00
Merge branch 'dev' into dev
This commit is contained in:
@@ -52,9 +52,6 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec
|
||||
return json_message(CommandRet::ERROR, "missing command in path", output);
|
||||
}
|
||||
|
||||
std::string cmd_s;
|
||||
int8_t id_n = -1; // default hc
|
||||
|
||||
// check for a device as first item in the path
|
||||
const char * device_s = nullptr;
|
||||
if (!num_paths) {
|
||||
@@ -79,16 +76,15 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec
|
||||
|
||||
// the next value on the path should be the command or entity name
|
||||
const char * command_p = nullptr;
|
||||
char command[COMMAND_MAX_LENGTH];
|
||||
if (num_paths == 2) {
|
||||
command_p = p.paths()[1].c_str();
|
||||
} else if (num_paths == 3) {
|
||||
// concatenate the path into one string as it could be in the format 'hc/XXX'
|
||||
char command[COMMAND_MAX_LENGTH];
|
||||
snprintf(command, sizeof(command), "%s/%s", p.paths()[1].c_str(), p.paths()[2].c_str());
|
||||
command_p = command;
|
||||
} else if (num_paths > 3) {
|
||||
// concatenate the path into one string as it could be in the format 'hc/XXX/attribute'
|
||||
char command[COMMAND_MAX_LENGTH];
|
||||
snprintf(command, sizeof(command), "%s/%s/%s", p.paths()[1].c_str(), p.paths()[2].c_str(), p.paths()[3].c_str());
|
||||
command_p = command;
|
||||
} else {
|
||||
@@ -100,6 +96,7 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec
|
||||
}
|
||||
}
|
||||
|
||||
int8_t id_n = -1; // default hc
|
||||
// some commands may be prefixed with hc. dhw. or hc/ or dhw/ so extract these if they exist
|
||||
// parse_command_string returns the extracted command
|
||||
if (device_type >= EMSdevice::DeviceType::BOILER) {
|
||||
|
||||
@@ -698,9 +698,9 @@ void EMSESP::publish_other_values() {
|
||||
publish_device_values(EMSdevice::DeviceType::EXTENSION);
|
||||
publish_device_values(EMSdevice::DeviceType::ALERT);
|
||||
publish_device_values(EMSdevice::DeviceType::POOL);
|
||||
publish_device_values(EMSdevice::DeviceType::CONNECT);
|
||||
// other EMS devices without values yet
|
||||
// publish_device_values(EMSdevice::DeviceType::GATEWAY);
|
||||
// publish_device_values(EMSdevice::DeviceType::CONNECT);
|
||||
// publish_device_values(EMSdevice::DeviceType::GENERIC);
|
||||
|
||||
webSchedulerService.publish();
|
||||
|
||||
@@ -455,12 +455,10 @@ int Modbus::getRegisterCount(const DeviceValue & dv) {
|
||||
uint32_t num_values = std::max(dv.max, (uint32_t)abs(dv.min));
|
||||
int num_registers = 0;
|
||||
|
||||
if (num_values <= (1L << 8))
|
||||
if (num_values < (1L << 16))
|
||||
num_registers = 1;
|
||||
else if (num_values <= (1L << 16))
|
||||
else if (num_values <= (0xFFFFFFFF))
|
||||
num_registers = 2;
|
||||
else if (num_values <= (1L << 32))
|
||||
num_registers = 4;
|
||||
else
|
||||
LOG_ERROR("num_registers is too big to be encoded with modbus registers");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user