Skip to content

Commit

Permalink
problem with time display in sleep mode
Browse files Browse the repository at this point in the history
  • Loading branch information
schreibfaul1 committed Sep 9, 2024
1 parent 86e7c1a commit 898ae06
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
10 changes: 9 additions & 1 deletion src/common.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// created: 10.Feb.2022
// updated: 03.Sep 2024
// updated: 09.Sep 2024

#pragma once
#pragma GCC optimize("Os") // optimize for code size
Expand Down Expand Up @@ -1677,7 +1677,15 @@ class imgClock{ // draw a clock in 12 or 24h format
}
void disable(){
m_enabled = false;
m_showAll = false;
}
bool isDisabled(){
return !m_enabled;
}
bool enable(){
return m_enabled = true;
}

void updateTime(uint16_t minuteOfTheDay, uint8_t weekday){
// minuteOfTheDay counts at 00:00, from 0...23*60+59
// weekDay So - 0, Mo - 1 ... Sa - 6
Expand Down
21 changes: 7 additions & 14 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
MiniWebRadio -- Webradio receiver for ESP32
first release on 03/2017 */String Version ="\
Version 3.4bc - Sep 03/2024 ";
Version 3.4bd - Sep 09/2024 ";

/* 2.8" color display (320x240px) with controller ILI9341 or HX8347D (SPI) or
3.5" color display (480x320px) with controller ILI9486 or ILI9488 (SPI)
Expand Down Expand Up @@ -1894,6 +1894,7 @@ void fall_asleep() {
setTFTbrightness(0);
}
else{
_clockSubMenue = 0;
changeState(CLOCK);
}
if(_f_BTpower) BTpowerChanged(false);
Expand Down Expand Up @@ -2240,7 +2241,7 @@ void changeState(int32_t state){
case DLNAITEMSLIST: lst_DLNA.disable();
break;
case CLOCK: btn_CL_Mute.disable(); btn_CL_alarm.disable(); btn_CL_radio.disable();
clk_CL_green.disable(); sdr_CL_volume.hide(); btn_CL_off.disable();
/* clk_CL_green.disable(); */ sdr_CL_volume.hide(); btn_CL_off.disable();
break;
case ALARM: clk_AL_red.disable(); btn_AL_left.disable(); btn_AL_right.disable(); btn_AL_up.disable(); btn_AL_down.disable();
btn_AL_ready.disable();
Expand All @@ -2258,10 +2259,8 @@ void changeState(int32_t state){
btn_BT_power.disable(); pic_BT_mode.disable(); txt_BT_volume.disable(); txt_BT_mode.disable();
}
_f_volBarVisible = false;
if(_timeCounter.timer){
setTimeCounter(0);
}

if(_timeCounter.timer){setTimeCounter(0);}
if(state != CLOCK) clk_CL_green.disable();
dispHeader.updateItem(_hl_item[state]);
switch(state) {
case RADIO:{
Expand Down Expand Up @@ -2358,19 +2357,13 @@ void changeState(int32_t state){
case CLOCK:{
if(_clockSubMenue == 0){
setTimeCounter(0);
if(_state != CLOCK){
clearWithOutHeaderFooter();
clk_CL_green.updateTime(rtc.getMinuteOfTheDay(), rtc.getweekday());
}
else{
btn_CL_Mute.hide(); btn_CL_alarm.hide(); btn_CL_radio.hide(); sdr_CL_volume.hide(); btn_CL_off.hide();
}
clk_CL_green.show();
btn_CL_Mute.hide(); btn_CL_alarm.hide(); btn_CL_radio.hide(); sdr_CL_volume.hide(); btn_CL_off.hide();
}
if(_clockSubMenue == 1){
btn_CL_Mute.show(); btn_CL_alarm.show(); btn_CL_radio.show(); sdr_CL_volume.show(); btn_CL_off.show();
setTimeCounter(2);
}
if(clk_CL_green.isDisabled()) {clearWithOutHeaderFooter(); clk_CL_green.show();}
break;
}
case ALARM:{
Expand Down

0 comments on commit 898ae06

Please sign in to comment.