From 649d01e5c2162f152a9208c66fdcdff7483acafa Mon Sep 17 00:00:00 2001 From: Dobfek Date: Wed, 7 Sep 2011 23:25:33 +0200 Subject: [PATCH] Eco Display: Lower LCD freq at night(19h-08h), lowers current consumption by 30%. --- driver/display.c | 20 ++++++++++++++++++++ driver/display.h | 4 +++- driver/timer.c | 10 ++++++++++ ezchronos.c | 4 ++++ include/project.h | 3 +++ tools/config.py | 8 +++++++- 6 files changed, 47 insertions(+), 2 deletions(-) diff --git a/driver/display.c b/driver/display.c index 2c8c97b..79b0ec8 100644 --- a/driver/display.c +++ b/driver/display.c @@ -610,3 +610,23 @@ void display_all_off(void) lcdptr++; } } + +#ifdef ECO_DISPLAY +// ************************************************************************************************* +// @fn eco_display +// @brief Lowers the display frequency at night(19h-08h) +// @param none +// @return none +// ************************************************************************************************* +void eco_display(void) +{ + if((sTime.hour>8)&&(sTime.hour<19)) + { + LCDBCTL0 = (LCDDIV0 + LCDDIV1 + LCDDIV2) | (LCDPRE0 + LCDPRE1) | LCD4MUX | LCDON; //day mode 512Hz + } + else + { + LCDBCTL0 = (LCDDIV0 + LCDDIV1 + LCDDIV2 + LCDDIV3) | (LCDPRE0 + LCDPRE1) | LCD4MUX | LCDON; //night mode, freq. from the original ti frimware 256Hz + } +} +#endif \ No newline at end of file diff --git a/driver/display.h b/driver/display.h index 7326809..c48e320 100644 --- a/driver/display.h +++ b/driver/display.h @@ -370,5 +370,7 @@ extern u8 * itoa(u32 n, u8 digits, u8 blanks); extern u8 switch_seg(u8 line, u8 index1, u8 index2); void display_all_off(void); - +#ifdef ECO_DISPLAY +void eco_display(void); //ECO display +#endif #endif // __DISPLAY_ diff --git a/driver/timer.c b/driver/timer.c index bd59fe1..8250066 100644 --- a/driver/timer.c +++ b/driver/timer.c @@ -365,6 +365,16 @@ __interrupt void TIMER0_A0_ISR(void) return; } + // ------------------------------------------------------------------- + // Service modules that require 1/hour processing + if (sTime.drawFlag > 2) + { + #ifdef ECO_DISPLAY + request.flag.eco_display = 1; //ECO_display flag + #endif + } + + // ------------------------------------------------------------------- // Service modules that require 1/min processing if (sTime.drawFlag >= 2) diff --git a/ezchronos.c b/ezchronos.c index 5a2ab71..ff6e472 100644 --- a/ezchronos.c +++ b/ezchronos.c @@ -567,6 +567,10 @@ void wakeup_event(void) // ************************************************************************************************* void process_requests(void) { +#ifdef ECO_DISPLAY + // Change display freq when needed + if (request.flag.eco_display) eco_display(); +#endif // Do temperature measurement if (request.flag.temperature_measurement) temperature_measurement(FILTER_ON); diff --git a/include/project.h b/include/project.h index cb4f191..f4e08a3 100644 --- a/include/project.h +++ b/include/project.h @@ -127,6 +127,9 @@ typedef union #endif #ifdef CONFIG_STRENGTH u16 strength_buzzer : 1; // 1 = Output buzzer from strength_data +#endif +#ifdef ECO_DISPLAY + u16 eco_display : 1; // 1 = LCD refresh freq is lower at night #endif } flag; u16 all_flags; // Shortcut to all display flags (for reset) diff --git a/tools/config.py b/tools/config.py index ac86e38..24d0350 100755 --- a/tools/config.py +++ b/tools/config.py @@ -230,7 +230,13 @@ def rand_hw(): "name": "Use PPT", "depends": [], "default": True} - + + ###IMPLEMENTED by Dobfek 2011-09-04 +DATA["ECO_DISPLAY"] = { + "name": "Economical display. Lower display frequency and -30% current consumption at night.", + "depends": [], + "default": False} + DATA["CONFIG_USE_SYNC_TOSET_TIME"] = { "name": "Sync is the only way to set clocks data/time", "depends": [],