mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 16:41:55 +00:00
Falco, Peppy: Set LED to indicate battery charged when near full
Also moves low-battery condition check to discharge state for Falco. BUG=chrome-os-partner:20649 BRANCH=falco,peppy TEST=Use ec 'battfake' comamnd to verify charger LED shows the battery is charged when it hits 97%. On Falco, verify the charger LED flashes while while not on AC power when the battery is under 10% charged. Change-Id: I58e1312775a2780945643d47c9364ca0959553ed Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60704 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
@@ -76,21 +76,20 @@ static void led_tick(void)
|
||||
bat_led_set_color(extpower_is_present() ? LED_WHITE : LED_OFF);
|
||||
|
||||
switch (charge_get_state()) {
|
||||
case PWR_STATE_IDLE:
|
||||
if (chflags & CHARGE_FLAG_FORCE_IDLE)
|
||||
bat_led_set_color((ticks & 0x4) ? LED_AMBER : LED_OFF);
|
||||
else if (charge_get_percent() <= BATTERY_LEVEL_LOW)
|
||||
bat_led_set_color((ticks & 0x4) ? LED_WHITE : LED_OFF);
|
||||
else
|
||||
bat_led_set_color(LED_WHITE);
|
||||
break;
|
||||
case PWR_STATE_CHARGE:
|
||||
case PWR_STATE_CHARGE_NEAR_FULL:
|
||||
bat_led_set_color(LED_AMBER);
|
||||
break;
|
||||
case PWR_STATE_DISCHARGE:
|
||||
if (charge_get_percent() <= BATTERY_LEVEL_LOW)
|
||||
bat_led_set_color((ticks & 0x4) ? LED_WHITE : LED_OFF);
|
||||
break;
|
||||
case PWR_STATE_ERROR:
|
||||
bat_led_set_color((ticks & 0x2) ? LED_WHITE : LED_OFF);
|
||||
break;
|
||||
case PWR_STATE_IDLE:
|
||||
if (chflags & CHARGE_FLAG_FORCE_IDLE)
|
||||
bat_led_set_color((ticks & 0x4) ? LED_AMBER : LED_OFF);
|
||||
break;
|
||||
default:
|
||||
/* Other states don't alter LED behavior */
|
||||
break;
|
||||
|
||||
@@ -73,9 +73,11 @@ static void led_tick(void)
|
||||
|
||||
switch (charge_get_state()) {
|
||||
case PWR_STATE_CHARGE:
|
||||
case PWR_STATE_CHARGE_NEAR_FULL:
|
||||
bat_led_set_color(LED_AMBER);
|
||||
break;
|
||||
case PWR_STATE_CHARGE_NEAR_FULL:
|
||||
bat_led_set_color(LED_BLUE);
|
||||
break;
|
||||
case PWR_STATE_DISCHARGE:
|
||||
bat_led_set_color(LED_OFF);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user