LED: double steps in init animation

This commit is contained in:
Thomas Haukland 2023-05-11 23:55:25 +02:00
parent 9b9040430e
commit e908f86835

View File

@ -3,7 +3,7 @@
// This is to keep state between callbacks, when it is 0 the // This is to keep state between callbacks, when it is 0 the
// initial RGB flash is finished // initial RGB flash is finished
uint8_t _hue_countdown = 25; uint8_t _hue_countdown = 50;
// These are to keep track of user selected color, so we // These are to keep track of user selected color, so we
// can restore it after RGB flash // can restore it after RGB flash
@ -16,14 +16,14 @@ uint8_t _value;
// stop us from using the keyboard. // stop us from using the keyboard.
// https://docs.qmk.fm/#/custom_quantum_functions?id=deferred-executor-registration // https://docs.qmk.fm/#/custom_quantum_functions?id=deferred-executor-registration
uint32_t flash_led(uint32_t next_trigger_time, void *cb_arg) { uint32_t flash_led(uint32_t next_trigger_time, void *cb_arg) {
rgblight_sethsv(_hue_countdown * 10, 230, 70); rgblight_sethsv(_hue_countdown * 5, 230, 70);
_hue_countdown--; _hue_countdown--;
if (_hue_countdown == 0) { if (_hue_countdown == 0) {
// Finished, reset to user chosen led color // Finished, reset to user chosen led color
rgblight_sethsv(_hue, _saturation, _value); rgblight_sethsv(_hue, _saturation, _value);
return 0; return 0;
} else { } else {
return 100; return 50;
} }
} }
@ -39,7 +39,7 @@ void keyboard_post_init_user(void) {
_value = rgblight_get_val(); _value = rgblight_get_val();
// Flash a little on start // Flash a little on start
defer_exec(100, flash_led, NULL); defer_exec(50, flash_led, NULL);
} }
// Make the builtin RGB led show different colors per layer: // Make the builtin RGB led show different colors per layer: