correcting init false start

This commit is contained in:
ponsin_h committed 2026-08-20 10:42:01 +02:00
1 parent c613e83420
commit a9fe68d1b4
1 file changed
+4 -2
+4 -2
View File
@@ -56,6 +56,8 @@ TMFeResult powerSwitch::HandleInit(const std::vector<std::string> &args) {
midas::odb to_watch(this->equipmentPath + SLASH + VARIABLES_DIR + SLASH +
COMMAND_VARNAME);
updateOutletNumber();
to_watch.watch(
[&](midas::odb &arg) { this->sendCommand(arg.get_last_index()); });
return TMFeOk();
@@ -118,10 +120,10 @@ void powerSwitch::updateOutletNumber() {
}
void powerSwitch::sendCommand(int index) {
if (index < 0 || index >= (int)outlets.size()) {
if (index < 0 || index >= static_cast<int>(outlets.size())) {
fMfe->Msg(MERROR, __FUNCTION__,
"Command received for outlet %d but only %d outlet(s) ready",
index, (int)outlets.size());
index, static_cast<int>(outlets.size()));
return;
}
midas::odb o(this->equipmentPath);