mirror of
https://github.com/whowechina/mai_pico.git
synced 2025-01-19 01:34:03 +01:00
Turn off light when exits rainbow mode
This commit is contained in:
parent
31f981f421
commit
1a3306f8cb
Binary file not shown.
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user