Skip to content

Commit

Permalink
Turn off light when exits rainbow mode
Browse files Browse the repository at this point in the history
  • Loading branch information
whowechina committed Jun 18, 2024
1 parent 31f981f commit 1a3306f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
Binary file modified Production/firmware/mai_pico.uf2
Binary file not shown.
23 changes: 20 additions & 3 deletions firmware/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@
#include "io.h"
#include "hid.h"

static void run_lights()
static void button_lights_clear()
{
if (io_is_active() || aime_is_active()) {
return;
for (int i = 0; i < 8; i++) {
rgb_set_button(i, 0, 0);
}
}

static void button_lights_rainbow()
{
static uint16_t loop = 0;
loop++;
uint16_t buttons = button_read();
Expand All @@ -58,6 +61,20 @@ static void run_lights()
}
}

static void run_lights()
{
static bool was_rainbow = true;
bool go_rainbow = !io_is_active() && !aime_is_active();

if (go_rainbow) {
button_lights_rainbow();
} else if (was_rainbow) {
button_lights_clear();
}

was_rainbow = go_rainbow;
}


const int aime_intf = 3;
static void cdc_aime_putc(uint8_t byte)
Expand Down

0 comments on commit 1a3306f

Please sign in to comment.