Skip to content

Commit

Permalink
simplify main for vedirect
Browse files Browse the repository at this point in the history
  • Loading branch information
helgeerbe committed Feb 13, 2023
1 parent f89ccdd commit 17e564a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
3 changes: 3 additions & 0 deletions src/MqttHandlVedirectHass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ void MqttHandleVedirectHassClass::init()

void MqttHandleVedirectHassClass::loop()
{
if (!Configuration.get().Vedirect_Enabled) {
return;
}
if (_updateForced) {
publishConfig();
_updateForced = false;
Expand Down
17 changes: 7 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,24 +182,21 @@ void loop()
yield();
Hoymiles.loop();
yield();
// Vedirect_Enabled is unknown to lib. Therefor check has to be done here
if (Configuration.get().Vedirect_Enabled) {
VeDirect.loop();
VeDirect.loop();
yield();
}
}
MqttHandleDtu.loop();
yield();
MqttHandleInverter.loop();
yield();
if (Configuration.get().Vedirect_Enabled) {
MqttHandleVedirect.loop();
yield();
}
MqttHandleVedirect.loop();
yield();
MqttHandleHass.loop();
yield();
if (Configuration.get().Vedirect_Enabled) {
MqttHandleVedirectHass.loop();
yield();
}
MqttHandleVedirectHass.loop();
yield();
WebApi.loop();
yield();
Display.loop();
Expand Down

0 comments on commit 17e564a

Please sign in to comment.