summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/gnawty/board.h3
-rw-r--r--board/gnawty/led.c11
2 files changed, 10 insertions, 4 deletions
diff --git a/board/gnawty/board.h b/board/gnawty/board.h
index 16a1b603a3..ba7c75f01b 100644
--- a/board/gnawty/board.h
+++ b/board/gnawty/board.h
@@ -11,6 +11,9 @@
/* Optional features */
#define CONFIG_AP_HANG_DETECT
#define CONFIG_BACKLIGHT_LID
+#define CONFIG_BATTERY_LEVEL_CRITICAL 7
+#define CONFIG_BATTERY_LEVEL_LOW 13
+#define CONFIG_BATTERY_LEVEL_NEAR_FULL 95
#define CONFIG_BATTERY_SMART
#define CONFIG_BOARD_VERSION
#define CONFIG_CHARGER
diff --git a/board/gnawty/led.c b/board/gnawty/led.c
index e83cea319a..aefdeb9f95 100644
--- a/board/gnawty/led.c
+++ b/board/gnawty/led.c
@@ -12,6 +12,7 @@
#include "led_common.h"
#include "pwm.h"
#include "util.h"
+#include "extpower.h"
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED , EC_LED_ID_POWER_LED};
@@ -146,16 +147,18 @@ static void battery_led(void)
/* If Battery critical Low, blink orange, 50% duty cycle,
* 2 sec period.
*/
- if (batt.state_of_charge <= BATTERY_LEVEL_CRITICAL) {
+ if (!extpower_is_present() && chipset_in_state(CHIPSET_STATE_ON) &&
+ (batt.state_of_charge <= CONFIG_BATTERY_LEVEL_CRITICAL)) {
set_color_battery_led((battery_ticks & 0x4) ?
- LED_ORANGE : LED_OFF);
+ LED_ORANGE : LED_OFF);
return;
}
/* If Battery Low, blink orange, 25% duty cycle, 4 sec period */
- if (batt.state_of_charge <= BATTERY_LEVEL_LOW) {
+ if (!extpower_is_present() && chipset_in_state(CHIPSET_STATE_ON) &&
+ (batt.state_of_charge <= CONFIG_BATTERY_LEVEL_LOW)) {
set_color_battery_led((battery_ticks % 16) < 4 ?
- LED_ORANGE : LED_OFF);
+ LED_ORANGE : LED_OFF);
return;
}