Start timer only when appropriate

This commit is contained in:
ReFil 2022-06-23 15:48:06 +01:00
parent 75750ec1c1
commit 497b0a2256

View file

@ -273,9 +273,11 @@ static int zmk_rgb_underglow_init(const struct device *_arg) {
#if IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_USB)
state.on = zmk_usb_is_powered();
#endif
if (state.on)
k_timer_start(&underglow_tick, K_NO_WAIT, K_MSEC(50));
#else
k_timer_start(&underglow_tick, K_NO_WAIT, K_MSEC(50));
#endif
return 0;
}