allow modbus start/stop without reboot

This commit is contained in:
MichaelDvP
2026-03-15 16:12:50 +01:00
parent 5e94c2f636
commit 8c732f9f1e
4 changed files with 32 additions and 17 deletions

View File

@@ -84,7 +84,7 @@ uuid::log::Logger EMSESP::logger() {
RxService EMSESP::rxservice_; // incoming Telegram Rx handler
TxService EMSESP::txservice_; // outgoing Telegram Tx handler
Mqtt EMSESP::mqtt_; // mqtt handler
Modbus * EMSESP::modbus_; // modbus handler
Modbus * EMSESP::modbus_ = nullptr; // modbus handler
System EMSESP::system_; // core system services
TemperatureSensor EMSESP::temperaturesensor_; // Temperature sensors
AnalogSensor EMSESP::analogsensor_; // Analog sensors
@@ -1795,12 +1795,6 @@ void EMSESP::start() {
#endif
}
// start services
if (system_.modbus_enabled()) {
modbus_ = new Modbus;
modbus_->start(1, system_.modbus_port(), system_.modbus_max_clients(), system_.modbus_timeout() * 1000);
}
mqtt_.start(); // mqtt init
system_.start(); // starts commands, led, adc, button, network (sets hostname), syslog & uart
shower_.start(); // initialize shower timer and shower alert