This commit is contained in:
2025-08-27 08:13:20 -04:00
parent 7367171767
commit dc961ce480
6 changed files with 7 additions and 29 deletions
+1 -17
View File
@@ -29,7 +29,6 @@ static void send_color(uint8_t dev_addr);
static void send_initial(uint8_t dev_addr);
static struct key * find_key(char * name);
static void set_color(char * name, uint8_t red, uint8_t green, uint8_t blue, uint8_t mode);
static void set_color_all(uint8_t red, uint8_t green, uint8_t blue, uint8_t mode);
static struct key key_list[NUM_KEYS] =
{
@@ -144,7 +143,6 @@ static struct key key_list[NUM_KEYS] =
void get_light() {
// get ADC reading from LDR every 500ms
// if above threshold, set backlight to off
if ( absolute_time_diff_us(lastRead, get_absolute_time()) >= 500000) {
adc_value = adc_read();
}
@@ -316,20 +314,6 @@ static void set_color(char * name, uint8_t red, uint8_t green, uint8_t blue, uin
}
}
// set RGB color for all keys
static void set_color_all(uint8_t red, uint8_t green, uint8_t blue, uint8_t mode) {
for (uint8_t i=0; i<NUM_KEYS; i++) {
key_list[i].red = red;
key_list[i].green = green;
key_list[i].blue = blue;
// don't change modes on MUTE only to preserve toggling behavior
// user can set manually from GUI if desired
if (key_list[i].val != KEY_MUTE) {
key_list[i].mode = mode;
}
}
}
// parse color request from webpage and update keyboard colors
void parse_colors(char * data, uint16_t len) {
(void) len;
@@ -341,7 +325,7 @@ void parse_colors(char * data, uint16_t len) {
if (token != NULL) {
// first string is the RGB color code
uint8_t red, green, blue;
sscanf(token, "%02x%02x%02x", &red, &green, &blue);
sscanf(token, "%2x%2x%2x", &red, &green, &blue);
token = strtok(NULL, ",");
if (token != NULL) {