minor cleanup

This commit is contained in:
proddy
2021-03-21 12:48:03 +01:00
parent f2dbc26491
commit 25b1957dbf
10 changed files with 29 additions and 137 deletions

View File

@@ -26,16 +26,8 @@ uuid::log::Logger Command::logger_{F_(command), uuid::log::Facility::DAEMON};
std::vector<Command::CmdFunction> Command::cmdfunctions_;
/*
static emsesp::array<Command::CmdFunction> cmdfunctions_(90, 255, 16); // reserve space for 90 commands
emsesp::array<Command::CmdFunction> * Command::commands() {
return &cmdfunctions_;
}
*/
// calls a command
// id may be used to represent a heating circuit for example
// id may be used to represent a heating circuit for example, it's optional
// returns false if error or not found
bool Command::call(const uint8_t device_type, const char * cmd, const char * value, const int8_t id) {
auto cf = find_command(device_type, cmd);
@@ -99,14 +91,6 @@ void Command::add(const uint8_t device_type, const __FlashStringHelper * cmd, cm
return;
}
/*
CmdFunction cf;
cf.cmd_ = cmd;
cf.device_type_ = device_type;
cf.cmdfunction_json_ = nullptr; // empty
cf.cmdfunction_ = cb;
cmdfunctions_.push(cf);
*/
cmdfunctions_.emplace_back(device_type, cmd, cb, nullptr);
// see if we need to subscribe
@@ -122,15 +106,6 @@ void Command::add_with_json(const uint8_t device_type, const __FlashStringHelper
return;
}
/*
CmdFunction cf;
cf.cmd_ = cmd;
cf.device_type_ = device_type;
cf.cmdfunction_json_ = cb;
cf.cmdfunction_ = nullptr; // empty
cmdfunctions_.push(cf);
*/
cmdfunctions_.emplace_back(device_type, cmd, nullptr, cb); // add command
}