|
|
@ -107,17 +107,17 @@ void setrgb(uint8_t r, uint8_t g, uint8_t b, struct cRGB *led1) {
|
|
|
|
uint32_t eeconfig_read_rgblight(void) {
|
|
|
|
uint32_t eeconfig_read_rgblight(void) {
|
|
|
|
return eeprom_read_dword(EECONFIG_RGBLIGHT);
|
|
|
|
return eeprom_read_dword(EECONFIG_RGBLIGHT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void eeconfig_write_rgblight(uint32_t val) {
|
|
|
|
void eeconfig_update_rgblight(uint32_t val) {
|
|
|
|
eeprom_write_dword(EECONFIG_RGBLIGHT, val);
|
|
|
|
eeprom_update_dword(EECONFIG_RGBLIGHT, val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void eeconfig_write_rgblight_default(void) {
|
|
|
|
void eeconfig_update_rgblight_default(void) {
|
|
|
|
dprintf("eeconfig_write_rgblight_default\n");
|
|
|
|
dprintf("eeconfig_update_rgblight_default\n");
|
|
|
|
rgblight_config.enable = 1;
|
|
|
|
rgblight_config.enable = 1;
|
|
|
|
rgblight_config.mode = 1;
|
|
|
|
rgblight_config.mode = 1;
|
|
|
|
rgblight_config.hue = 200;
|
|
|
|
rgblight_config.hue = 200;
|
|
|
|
rgblight_config.sat = 204;
|
|
|
|
rgblight_config.sat = 204;
|
|
|
|
rgblight_config.val = 204;
|
|
|
|
rgblight_config.val = 204;
|
|
|
|
eeconfig_write_rgblight(rgblight_config.raw);
|
|
|
|
eeconfig_update_rgblight(rgblight_config.raw);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void eeconfig_debug_rgblight(void) {
|
|
|
|
void eeconfig_debug_rgblight(void) {
|
|
|
|
dprintf("rgblight_config eprom\n");
|
|
|
|
dprintf("rgblight_config eprom\n");
|
|
|
@ -136,12 +136,12 @@ void rgblight_init(void) {
|
|
|
|
if (!eeconfig_is_enabled()) {
|
|
|
|
if (!eeconfig_is_enabled()) {
|
|
|
|
dprintf("rgblight_init eeconfig is not enabled.\n");
|
|
|
|
dprintf("rgblight_init eeconfig is not enabled.\n");
|
|
|
|
eeconfig_init();
|
|
|
|
eeconfig_init();
|
|
|
|
eeconfig_write_rgblight_default();
|
|
|
|
eeconfig_update_rgblight_default();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rgblight_config.raw = eeconfig_read_rgblight();
|
|
|
|
rgblight_config.raw = eeconfig_read_rgblight();
|
|
|
|
if (!rgblight_config.mode) {
|
|
|
|
if (!rgblight_config.mode) {
|
|
|
|
dprintf("rgblight_init rgblight_config.mode = 0. Write default values to EEPROM.\n");
|
|
|
|
dprintf("rgblight_init rgblight_config.mode = 0. Write default values to EEPROM.\n");
|
|
|
|
eeconfig_write_rgblight_default();
|
|
|
|
eeconfig_update_rgblight_default();
|
|
|
|
rgblight_config.raw = eeconfig_read_rgblight();
|
|
|
|
rgblight_config.raw = eeconfig_read_rgblight();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
eeconfig_debug_rgblight(); // display current eeprom values
|
|
|
|
eeconfig_debug_rgblight(); // display current eeprom values
|
|
|
@ -189,7 +189,7 @@ void rgblight_mode(uint8_t mode) {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
rgblight_config.mode = mode;
|
|
|
|
rgblight_config.mode = mode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
eeconfig_write_rgblight(rgblight_config.raw);
|
|
|
|
eeconfig_update_rgblight(rgblight_config.raw);
|
|
|
|
dprintf("rgblight mode: %u\n", rgblight_config.mode);
|
|
|
|
dprintf("rgblight mode: %u\n", rgblight_config.mode);
|
|
|
|
if (rgblight_config.mode == 1) {
|
|
|
|
if (rgblight_config.mode == 1) {
|
|
|
|
rgblight_timer_disable();
|
|
|
|
rgblight_timer_disable();
|
|
|
@ -206,7 +206,7 @@ void rgblight_mode(uint8_t mode) {
|
|
|
|
|
|
|
|
|
|
|
|
void rgblight_toggle(void) {
|
|
|
|
void rgblight_toggle(void) {
|
|
|
|
rgblight_config.enable ^= 1;
|
|
|
|
rgblight_config.enable ^= 1;
|
|
|
|
eeconfig_write_rgblight(rgblight_config.raw);
|
|
|
|
eeconfig_update_rgblight(rgblight_config.raw);
|
|
|
|
dprintf("rgblight toggle: rgblight_config.enable = %u\n", rgblight_config.enable);
|
|
|
|
dprintf("rgblight toggle: rgblight_config.enable = %u\n", rgblight_config.enable);
|
|
|
|
if (rgblight_config.enable) {
|
|
|
|
if (rgblight_config.enable) {
|
|
|
|
rgblight_mode(rgblight_config.mode);
|
|
|
|
rgblight_mode(rgblight_config.mode);
|
|
|
@ -299,7 +299,7 @@ void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val){
|
|
|
|
rgblight_config.hue = hue;
|
|
|
|
rgblight_config.hue = hue;
|
|
|
|
rgblight_config.sat = sat;
|
|
|
|
rgblight_config.sat = sat;
|
|
|
|
rgblight_config.val = val;
|
|
|
|
rgblight_config.val = val;
|
|
|
|
eeconfig_write_rgblight(rgblight_config.raw);
|
|
|
|
eeconfig_update_rgblight(rgblight_config.raw);
|
|
|
|
dprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
|
|
|
|
dprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|