diff options
| author | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-05-25 03:36:01 +0100 |
|---|---|---|
| committer | Ethan Chen <intervigil@gmail.com> | 2015-08-26 12:11:32 -0700 |
| commit | 4101c66b95394b38c4957acc0d9ea7de21800290 (patch) | |
| tree | 49dbd1fdb09582f9641d18016fdb02928ea69d2f /liblight | |
| parent | 362b87b5afc7c01ea66777754e29f733a44b9fe5 (diff) | |
lights: Reprioritize events
attention > notification > battery
Change-Id: I0cac6ced4248990b7339223d6860106f94cf3693
Diffstat (limited to 'liblight')
| -rw-r--r-- | liblight/lights.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/liblight/lights.c b/liblight/lights.c index 615ddd8..e8fb9d5 100644 --- a/liblight/lights.c +++ b/liblight/lights.c @@ -138,6 +138,16 @@ set_speaker_light_locked(struct light_device_t* dev, return -1; } + if (state == NULL) { + write_int(RED_LED_FILE, 0); + write_int(GREEN_LED_FILE, 0); + write_int(BLUE_LED_FILE, 0); + write_int(RED_BLINK_FILE, 0); + write_int(GREEN_BLINK_FILE, 0); + write_int(BLUE_BLINK_FILE, 0); + return 0; + } + switch (state->flashMode) { case LIGHT_FLASH_TIMED: onMS = state->flashOnMS; @@ -192,10 +202,13 @@ set_speaker_light_locked(struct light_device_t* dev, static void handle_speaker_battery_locked(struct light_device_t* dev) { - if (is_lit(&g_battery)) { - set_speaker_light_locked(dev, &g_battery); - } else { + set_speaker_light_locked(dev, NULL); + if (is_lit(&g_attention)) { + set_speaker_light_locked(dev, &g_attention); + } else if (is_lit(&g_notification)) { set_speaker_light_locked(dev, &g_notification); + } else { + set_speaker_light_locked(dev, &g_battery); } } |
