Skip to content

Commit

Permalink
BugFix #110 (reinit on effect change)
Browse files Browse the repository at this point in the history
  • Loading branch information
aly-fly committed Jan 20, 2025
1 parent 7e347ec commit 1f617fe
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions EleksTubeHAX_pio/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,16 @@ void loop()
MqttCommandPowerReceived = false;
if (MqttCommandPower)
{
if (!tfts.isEnabled()) // perform reinit, enable, redraw only if displays are actually off. HA sends ON command together with clock face change which causes flickering.
{
#ifdef HARDWARE_Elekstube_CLOCK // original EleksTube hardware and direct clones need a reinit to wake up the displays properly
tfts.reinit();
tfts.reinit();
#else
tfts.enableAllDisplays(); // for all other clocks, just enable the displays
tfts.enableAllDisplays(); // for all other clocks, just enable the displays
#endif
updateClockDisplay(TFTs::force); // redraw all the clock digits -> needed because the displays was blanked before turning off
backlights.PowerOn();
updateClockDisplay(TFTs::force); // redraw all the clock digits -> needed because the displays was blanked before turning off
backlights.PowerOn();
}
}
else
{
Expand All @@ -248,12 +251,15 @@ void loop()
MqttCommandMainPowerReceived = false;
if (MqttCommandMainPower)
{
if (!tfts.isEnabled()) // perform reinit, enable, redraw only if displays are actually off. HA sends ON command together with clock face change which causes flickering.
{
#ifdef HARDWARE_Elekstube_CLOCK // original EleksTube hardware and direct clones need a reinit to wake up the displays properly
tfts.reinit();
tfts.reinit();
#else
tfts.enableAllDisplays(); // for all other clocks, just enable the displays
tfts.enableAllDisplays(); // for all other clocks, just enable the displays
#endif
updateClockDisplay(TFTs::force); // redraw all the clock digits -> needed because the displays was blanked before turning off
updateClockDisplay(TFTs::force); // redraw all the clock digits -> needed because the displays was blanked before turning off
}
}
else
{
Expand Down

0 comments on commit 1f617fe

Please sign in to comment.