Turn off light when exits rainbow mode

This commit is contained in:
whowechina 2024-06-18 12:09:29 +08:00
parent 31f981f421
commit 1a3306f8cb
2 changed files with 20 additions and 3 deletions

Binary file not shown.

View File

@ -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();
@ -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)