Skip to content

Commit

Permalink
Fade to black on timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
speedypotato committed Feb 16, 2025
1 parent 26e4da9 commit 510c4ba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Binary file modified build_uf2/Pico_Game_Controller.uf2
Binary file not shown.
6 changes: 5 additions & 1 deletion src/rgb/color_cycle_v5.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ void ws2812b_color_cycle_v5(uint32_t counter) {
for (int i = 1; i < SW_GPIO_SIZE; i++)
if (latest_switch_ts < sw_timestamp[i]) latest_switch_ts = sw_timestamp[i];
if (time_us_64() > latest_switch_ts + timeout_us) { // timed out
for (int i = 0; i < WS2812B_LED_SIZE; i++) ws2812b_data[i] = COLOR_BLACK;
for (int i = 0; i < WS2812B_LED_SIZE; i++) {
ws2812b_data[i].r *= 0.9;
ws2812b_data[i].g *= 0.9;
ws2812b_data[i].b *= 0.9;
}
} else {
RGB_t base_color = color_wheel_rgbt(counter);
base_color.r *= WS2812B_BRIGHTNESS;
Expand Down
6 changes: 5 additions & 1 deletion src/rgb/turbocharger.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ void turbocharger_color_cycle(uint32_t unused) {
for (int i = 1; i < SW_GPIO_SIZE; i++)
if (latest_switch_ts < sw_timestamp[i]) latest_switch_ts = sw_timestamp[i];
if (time_us_64() > latest_switch_ts + timeout_us) { // timed out
for (int i = 0; i < WS2812B_LED_SIZE; i++) ws2812b_data[i] = COLOR_BLACK;
for (int i = 0; i < WS2812B_LED_SIZE; i++) {
ws2812b_data[i].r *= 0.9;
ws2812b_data[i].g *= 0.9;
ws2812b_data[i].b *= 0.9;
}
} else {
/* Switches */
for (int i = 0; i < SW_GPIO_SIZE - 3; i++) {
Expand Down

0 comments on commit 510c4ba

Please sign in to comment.