Wake on certain events
EEPROM DIM and BRIGHT values swapped!!!
This commit is contained in:
parent
4943e17bda
commit
1e09f8c003
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
#ifdef LCD_BL_PIN
|
#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
|
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_HIGH = 0;
|
||||||
int16_t backlightLevel_LOW = 0;
|
int16_t backlightLevel_LOW = 0;
|
||||||
@ -33,6 +35,24 @@ void force_bl_on(bool section_start)
|
|||||||
backlight_update();
|
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.
|
void backlight_save() //saves all backlight data to eeprom.
|
||||||
{
|
{
|
||||||
eeprom_update_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_HIGH, (uint8_t)backlightLevel_HIGH);
|
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);
|
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;
|
if (!backlightSupport) return;
|
||||||
backlightTimer.start();
|
backlightTimer.start();
|
||||||
|
backlight_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void backlight_update()
|
void backlight_update()
|
||||||
@ -86,7 +107,6 @@ void backlight_init()
|
|||||||
|
|
||||||
SET_OUTPUT(LCD_BL_PIN);
|
SET_OUTPUT(LCD_BL_PIN);
|
||||||
backlightTimer_reset();
|
backlightTimer_reset();
|
||||||
backlight_update(); //sets brightness
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //LCD_BL_PIN
|
#endif //LCD_BL_PIN
|
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
enum Backlight_Mode
|
enum Backlight_Mode
|
||||||
{
|
{
|
||||||
BACKLIGHT_MODE_BRIGHT = 0,
|
BACKLIGHT_MODE_DIM = 0,
|
||||||
BACKLIGHT_MODE_DIM = 1,
|
BACKLIGHT_MODE_BRIGHT = 1,
|
||||||
BACKLIGHT_MODE_AUTO = 2,
|
BACKLIGHT_MODE_AUTO = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -27,6 +27,7 @@ extern void backlight_update();
|
|||||||
extern void backlight_init();
|
extern void backlight_init();
|
||||||
extern void backlightTimer_reset();
|
extern void backlightTimer_reset();
|
||||||
extern void backlight_save();
|
extern void backlight_save();
|
||||||
|
extern void backlight_wake(const uint8_t flashNo = 0);
|
||||||
|
|
||||||
|
|
||||||
#endif //_BACKLIGHT_H
|
#endif //_BACKLIGHT_H
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
//#include <inttypes.h>
|
//#include <inttypes.h>
|
||||||
//#include <avr/eeprom.h>
|
//#include <avr/eeprom.h>
|
||||||
//#include "eeprom.h"
|
//#include "eeprom.h"
|
||||||
|
#include "backlight.h"
|
||||||
|
|
||||||
|
|
||||||
//eSOUND_MODE eSoundMode=e_SOUND_MODE_LOUD;
|
//eSOUND_MODE eSoundMode=e_SOUND_MODE_LOUD;
|
||||||
@ -63,6 +64,7 @@ Sound_SaveMode();
|
|||||||
|
|
||||||
//if critical is true then silend and once mode is ignored
|
//if critical is true then silend and once mode is ignored
|
||||||
void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){
|
void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){
|
||||||
|
backlight_wake(1);
|
||||||
if (!critical){
|
if (!critical){
|
||||||
if (eSoundMode != e_SOUND_MODE_SILENT){
|
if (eSoundMode != e_SOUND_MODE_SILENT){
|
||||||
if(!tone_){
|
if(!tone_){
|
||||||
@ -135,6 +137,7 @@ switch(eSoundMode)
|
|||||||
|
|
||||||
static void Sound_DoSound_Blind_Alert(void)
|
static void Sound_DoSound_Blind_Alert(void)
|
||||||
{
|
{
|
||||||
|
backlight_wake(1);
|
||||||
uint8_t nI;
|
uint8_t nI;
|
||||||
|
|
||||||
for(nI=0; nI<20; 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)
|
static void Sound_DoSound_Encoder_Move(void)
|
||||||
{
|
{
|
||||||
|
backlight_wake();
|
||||||
uint8_t nI;
|
uint8_t nI;
|
||||||
|
|
||||||
for(nI=0;nI<5;nI++)
|
for(nI=0;nI<5;nI++)
|
||||||
@ -161,6 +165,7 @@ uint8_t nI;
|
|||||||
|
|
||||||
static void Sound_DoSound_Echo(void)
|
static void Sound_DoSound_Echo(void)
|
||||||
{
|
{
|
||||||
|
backlight_wake();
|
||||||
uint8_t nI;
|
uint8_t nI;
|
||||||
|
|
||||||
for(nI=0;nI<10;nI++)
|
for(nI=0;nI<10;nI++)
|
||||||
@ -174,6 +179,7 @@ for(nI=0;nI<10;nI++)
|
|||||||
|
|
||||||
static void Sound_DoSound_Prompt(void)
|
static void Sound_DoSound_Prompt(void)
|
||||||
{
|
{
|
||||||
|
backlight_wake(2);
|
||||||
WRITE(BEEPER,HIGH);
|
WRITE(BEEPER,HIGH);
|
||||||
_delay_ms(500);
|
_delay_ms(500);
|
||||||
WRITE(BEEPER,LOW);
|
WRITE(BEEPER,LOW);
|
||||||
@ -181,6 +187,7 @@ WRITE(BEEPER,LOW);
|
|||||||
|
|
||||||
static void Sound_DoSound_Alert(bool bOnce)
|
static void Sound_DoSound_Alert(bool bOnce)
|
||||||
{
|
{
|
||||||
|
backlight_wake();
|
||||||
uint8_t nI,nMax;
|
uint8_t nI,nMax;
|
||||||
|
|
||||||
nMax=bOnce?1:3;
|
nMax=bOnce?1:3;
|
||||||
|
@ -8868,6 +8868,7 @@ void menu_lcd_lcdupdate_func(void)
|
|||||||
lcd_draw_update = 2;
|
lcd_draw_update = 2;
|
||||||
lcd_oldcardstatus = IS_SD_INSERTED;
|
lcd_oldcardstatus = IS_SD_INSERTED;
|
||||||
lcd_refresh(); // to maybe revive the LCD if static electricity killed it.
|
lcd_refresh(); // to maybe revive the LCD if static electricity killed it.
|
||||||
|
backlight_wake();
|
||||||
if (lcd_oldcardstatus)
|
if (lcd_oldcardstatus)
|
||||||
{
|
{
|
||||||
card.initsd();
|
card.initsd();
|
||||||
|
Loading…
Reference in New Issue
Block a user