Skip to content

Commit

Permalink
a soothing blue in power save mode
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot committed May 23, 2019
1 parent a74f001 commit 96a7e31
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions board/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,14 +663,13 @@ int main() {
int div_mode = ((usb_power_mode == USB_POWER_DCP) ? 4 : 1);

// TODO: refactor this elsewhere
int led_choice = (power_save_status == POWER_SAVE_STATUS_DISABLED) ? LED_RED : LED_BLUE;
for (int div_mode_loop = 0; div_mode_loop < div_mode; div_mode_loop++) {
for (int fade = 0; fade < 1024; fade += 8) {
for (int i = 0; i < (128/div_mode); i++) {
if (power_save_status == POWER_SAVE_STATUS_DISABLED) {
set_led(LED_RED, 1);
}
set_led(led_choice, 1);
if (fade < 512) { delay(fade); } else { delay(1024-fade); }
set_led(LED_RED, 0);
set_led(led_choice, 0);
if (fade < 512) { delay(512-fade); } else { delay(fade-512); }
}
}
Expand Down

0 comments on commit 96a7e31

Please sign in to comment.