diff options
author | git-CarryBK_Chen.compal.com <CarryBK_Chen@compal.com> | 2014-03-26 20:31:18 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-03-27 20:23:18 +0000 |
commit | aa9572aaedd685f3510620bed41495748078d6c6 (patch) | |
tree | d046ac887cd9a5c5b8090557c454d97000058aa3 | |
parent | d4078514b258c536541cd5f17a613d330ece0e91 (diff) | |
download | chrome-ec-aa9572aaedd685f3510620bed41495748078d6c6.tar.gz |
Clapper: fix battery led's behavior when 0% battery on charge
Condition : charge & 0% battery
Battery LED : 500ms off, 1 sec amber
BRANCH=clapper
BUG=none
TEST=Let battery in 0% and plug-in AC, the behavior of battery led is "500ms off, 1 sec amber"
Signed-off-by: Carry Chen <CarryBK_Chen@compal.com>
Change-Id: I5330baec7325c179f9b5e4c7ebac2e5b3527ed8a
Reviewed-on: https://chromium-review.googlesource.com/191665
Reviewed-by: Carry Chen <CarryBK_Chen@compal.com>
Tested-by: Carry Chen <CarryBK_Chen@compal.com>
Reviewed-by: Antonie Cheng <Antonie_Cheng@compal.com>
Commit-Queue: Antonie Cheng <Antonie_Cheng@compal.com>
Tested-by: Antonie Cheng <Antonie_Cheng@compal.com>
Reviewed-by: Dave Parker <dparker@chromium.org>
-rw-r--r-- | board/clapper/led.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/board/clapper/led.c b/board/clapper/led.c index db9f4bf3e3..31f955e053 100644 --- a/board/clapper/led.c +++ b/board/clapper/led.c @@ -126,12 +126,15 @@ static void battery_led_update(void) case PWR_STATE_CHARGE: case PWR_STATE_CHARGE_NEAR_FULL: /* with AC */ case PWR_STATE_IDLE: /* with AC */ - /* 1% ~ 4% */ - if (battery > 0 && battery < 5) { - /* 1000 ms on */ - if (timer%15 < 10) - set_color_battery(LED_AMBER); - /* 500 ms off */ + /* 80% ~ */ + if (battery >= 80) + set_color_battery(LED_WHITE); + /* 20% ~ 79% */ + else if (battery >= 20 && battery < 80) { + /* 5000 ms on */ + if (timer%51 < 50) + set_color_battery(LED_WHITE); + /* 100 ms off */ else set_color_battery(LED_OFF); } @@ -144,25 +147,28 @@ static void battery_led_update(void) else set_color_battery(LED_OFF); } - /* 20% ~ 79% */ - else if (battery >= 20 && battery < 80) { - /* 5000 ms on */ - if (timer%51 < 50) - set_color_battery(LED_WHITE); - /* 100 ms off */ + /* 0% ~ 4% */ + else { + /* 1000 ms on */ + if (timer%15 < 10) + set_color_battery(LED_AMBER); + /* 500 ms off */ else set_color_battery(LED_OFF); } - /* 80%i ~ 100% */ - else if (battery >= 80 && battery <= 100) - set_color_battery(LED_WHITE); break; case PWR_STATE_DISCHARGE: /* without AC */ /* not S0 */ if (!chipset_in_state(CHIPSET_STATE_ON)) set_color_battery(LED_OFF); + /* 20% ~ */ + else if (battery >= 20) + set_color_battery(LED_WHITE); + /* 5% ~ 19% */ + else if (battery >= 5 && battery < 20) + set_color_battery(LED_AMBER); /* 1% ~ 4% */ - else if (battery > 0 && battery < 5) { + else { /* 1000 ms on */ if (timer%15 < 10) set_color_battery(LED_AMBER); @@ -170,12 +176,6 @@ static void battery_led_update(void) else set_color_battery(LED_OFF); } - /* 5% ~ 19% */ - else if (battery >= 5 && battery < 20) - set_color_battery(LED_AMBER); - /* 20% ~ 100% */ - else if (battery >= 20 && battery <= 100) - set_color_battery(LED_WHITE); break; default: /* Other states don't alter LED behavior */ |