diff --git a/Firmware/backlight.cpp b/Firmware/backlight.cpp index 054c510f..c57995cc 100644 --- a/Firmware/backlight.cpp +++ b/Firmware/backlight.cpp @@ -11,6 +11,8 @@ #ifdef LCD_BL_PIN +#define BL_FLASH_DELAY_MS 25 + bool backlightSupport = 0; //only if it's true will any of the settings be visible to the user int16_t backlightLevel_HIGH = 0; int16_t backlightLevel_LOW = 0; @@ -33,6 +35,24 @@ void force_bl_on(bool section_start) backlight_update(); } +void backlight_wake(const uint8_t flashNo) +{ + if (!backlightSupport) return; + + if (flashNo) + { + uint8_t backlightMode_bck = backlightMode; + for (uint8_t i = 0; i < (((backlightMode_bck == BACKLIGHT_MODE_AUTO) && !backlightTimer.running()) + (flashNo * 2)); i++) + { + backlightMode = !backlightMode; //toggles between BACKLIGHT_MODE_BRIGHT and BACKLIGHT_MODE_DIM + backlight_update(); + _delay(BL_FLASH_DELAY_MS); + } + backlightMode = backlightMode_bck; + } + backlightTimer_reset(); +} + void backlight_save() //saves all backlight data to eeprom. { eeprom_update_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_HIGH, (uint8_t)backlightLevel_HIGH); @@ -41,10 +61,11 @@ void backlight_save() //saves all backlight data to eeprom. eeprom_update_word((uint16_t *)EEPROM_BACKLIGHT_TIMEOUT, backlightTimer_period); } -void backlightTimer_reset() //used for resetting the timer and waking the display. Triggered on events such as knob click, rotate and on full screen notifications. +void backlightTimer_reset() //used for resetting the timer and waking the display. Triggered on user interactions. { if (!backlightSupport) return; backlightTimer.start(); + backlight_update(); } void backlight_update() @@ -86,7 +107,6 @@ void backlight_init() SET_OUTPUT(LCD_BL_PIN); backlightTimer_reset(); - backlight_update(); //sets brightness } #endif //LCD_BL_PIN \ No newline at end of file diff --git a/Firmware/backlight.h b/Firmware/backlight.h index ef005adf..fce908a3 100644 --- a/Firmware/backlight.h +++ b/Firmware/backlight.h @@ -8,8 +8,8 @@ enum Backlight_Mode { - BACKLIGHT_MODE_BRIGHT = 0, - BACKLIGHT_MODE_DIM = 1, + BACKLIGHT_MODE_DIM = 0, + BACKLIGHT_MODE_BRIGHT = 1, BACKLIGHT_MODE_AUTO = 2, }; @@ -27,6 +27,7 @@ extern void backlight_update(); extern void backlight_init(); extern void backlightTimer_reset(); extern void backlight_save(); +extern void backlight_wake(const uint8_t flashNo = 0); #endif //_BACKLIGHT_H diff --git a/Firmware/sound.cpp b/Firmware/sound.cpp index 52d880a0..39d513de 100644 --- a/Firmware/sound.cpp +++ b/Firmware/sound.cpp @@ -5,6 +5,7 @@ //#include //#include //#include "eeprom.h" +#include "backlight.h" //eSOUND_MODE eSoundMode=e_SOUND_MODE_LOUD; @@ -63,6 +64,7 @@ Sound_SaveMode(); //if critical is true then silend and once mode is ignored void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){ + backlight_wake(1); if (!critical){ if (eSoundMode != e_SOUND_MODE_SILENT){ if(!tone_){ @@ -135,6 +137,7 @@ switch(eSoundMode) static void Sound_DoSound_Blind_Alert(void) { + backlight_wake(1); uint8_t nI; for(nI=0; nI<20; nI++) @@ -148,6 +151,7 @@ static void Sound_DoSound_Blind_Alert(void) static void Sound_DoSound_Encoder_Move(void) { + backlight_wake(); uint8_t nI; for(nI=0;nI<5;nI++) @@ -161,6 +165,7 @@ uint8_t nI; static void Sound_DoSound_Echo(void) { + backlight_wake(); uint8_t nI; for(nI=0;nI<10;nI++) @@ -174,6 +179,7 @@ for(nI=0;nI<10;nI++) static void Sound_DoSound_Prompt(void) { + backlight_wake(2); WRITE(BEEPER,HIGH); _delay_ms(500); WRITE(BEEPER,LOW); @@ -181,6 +187,7 @@ WRITE(BEEPER,LOW); static void Sound_DoSound_Alert(bool bOnce) { + backlight_wake(); uint8_t nI,nMax; nMax=bOnce?1:3; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f89cac58..0cf8667f 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -8868,6 +8868,7 @@ void menu_lcd_lcdupdate_func(void) lcd_draw_update = 2; lcd_oldcardstatus = IS_SD_INSERTED; lcd_refresh(); // to maybe revive the LCD if static electricity killed it. + backlight_wake(); if (lcd_oldcardstatus) { card.initsd();