summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Lu <Devin.Lu@quantatw.com>2022-02-25 09:23:38 +0800
committerCommit Bot <commit-bot@chromium.org>2022-02-25 04:00:45 +0000
commit60314954ccb7f95eba0d6e0d505df09b257e88a8 (patch)
tree83744d80b57985b5dbd1e866b6039f693ed7fa65
parentf330df0ef9a6db31f5eeb3119e85e71ece7b5e1b (diff)
downloadchrome-ec-60314954ccb7f95eba0d6e0d505df09b257e88a8.tar.gz
vell: Update charging LEDs behavior
This patch updates the LEDs behavior. Change as below: 1. battery error: Original - Blinking white quickly. (0.5 sec ON, 0.5 sec OFF) New - Blinking amber quickly. (0.5 sec ON, 0.5 sec OFF) 2. battery low: Original - Blinking white slowly on right side led. (1 sec ON, 1 sec OFF) New - Blinking amber slowly on both side leds. (1 sec ON, 1 sec OFF) BUG=b:203158255 BRANCH=none TEST=On Vell, Verify LEDs worked indeed. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: I9c091c6e7b17e1741c2c88dca98b1389a4eea8b8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3489110 Reviewed-by: caveh jalali <caveh@chromium.org>
-rw-r--r--board/vell/led.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/board/vell/led.c b/board/vell/led.c
index 48555f8de7..2440ec29df 100644
--- a/board/vell/led.c
+++ b/board/vell/led.c
@@ -20,6 +20,8 @@
#define BAT_LED_ON 0
#define BAT_LED_OFF 1
+#define BATT_LOW_BCT 10
+
#define LED_TICK_INTERVAL_MS (500 * MSEC)
#define LED_CYCLE_TIME_MS (2000 * MSEC)
#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / LED_TICK_INTERVAL_MS)
@@ -151,21 +153,38 @@ static void led_set_battery(void)
set_active_port_color(LED_AMBER);
break;
case PWR_STATE_DISCHARGE:
+ /*
+ * Blinking amber LEDs slowly if battery is lower 10
+ * percentage.
+ */
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
- if (charge_get_percent() < 10)
+ if (charge_get_percent() < BATT_LOW_BCT)
led_set_color_battery(RIGHT_PORT,
(battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_WHITE : LED_OFF);
+ < LED_ON_TICKS) ? LED_AMBER : LED_OFF);
else
led_set_color_battery(RIGHT_PORT, LED_OFF);
}
- if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
- led_set_color_battery(LEFT_PORT, LED_OFF);
+ if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) {
+ if (charge_get_percent() < BATT_LOW_BCT)
+ led_set_color_battery(LEFT_PORT,
+ (battery_ticks % LED_TICKS_PER_CYCLE
+ < LED_ON_TICKS) ? LED_AMBER : LED_OFF);
+ else
+ led_set_color_battery(LEFT_PORT, LED_OFF);
+ }
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x1) ?
- LED_WHITE : LED_OFF);
+ if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
+ led_set_color_battery(RIGHT_PORT, (battery_ticks & 0x1)
+ ? LED_AMBER : LED_OFF);
+ }
+
+ if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) {
+ led_set_color_battery(LEFT_PORT, (battery_ticks & 0x1)
+ ? LED_AMBER : LED_OFF);
+ }
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);