diff options
author | skullY <skullydazed@gmail.com> | 2019-01-27 16:28:11 -0800 |
---|---|---|
committer | skullydazed <skullydazed@users.noreply.github.com> | 2019-02-10 15:37:12 -0800 |
commit | 32116f1a4580e36c92870ca800cf3cc9106c35dd (patch) | |
tree | ed56b116572985aaf6973c91d6cd73ae3c40fbac /quantum/led_matrix.c | |
parent | 24df54b80794144907db94c2cb5ceca928700e2d (diff) | |
download | qmk_firmware-32116f1a4580e36c92870ca800cf3cc9106c35dd.tar.gz qmk_firmware-32116f1a4580e36c92870ca800cf3cc9106c35dd.zip |
Move the 1 second delay to led_matrix_init
Diffstat (limited to 'quantum/led_matrix.c')
-rw-r--r-- | quantum/led_matrix.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/quantum/led_matrix.c b/quantum/led_matrix.c index f849d478d..2709de112 100644 --- a/quantum/led_matrix.c +++ b/quantum/led_matrix.c | |||
@@ -82,7 +82,7 @@ void eeconfig_update_led_matrix_default(void) { | |||
82 | eeconfig_update_led_matrix(led_matrix_config.raw); | 82 | eeconfig_update_led_matrix(led_matrix_config.raw); |
83 | } | 83 | } |
84 | void eeconfig_debug_led_matrix(void) { | 84 | void eeconfig_debug_led_matrix(void) { |
85 | dprintf("led_matrix_config eprom\n"); | 85 | dprintf("led_matrix_config eeprom\n"); |
86 | dprintf("led_matrix_config.enable = %d\n", led_matrix_config.enable); | 86 | dprintf("led_matrix_config.enable = %d\n", led_matrix_config.enable); |
87 | dprintf("led_matrix_config.mode = %d\n", led_matrix_config.mode); | 87 | dprintf("led_matrix_config.mode = %d\n", led_matrix_config.mode); |
88 | dprintf("led_matrix_config.val = %d\n", led_matrix_config.val); | 88 | dprintf("led_matrix_config.val = %d\n", led_matrix_config.val); |
@@ -176,21 +176,12 @@ void led_matrix_task(void) { | |||
176 | return; | 176 | return; |
177 | } | 177 | } |
178 | 178 | ||
179 | // delay 1 second before driving LEDs or doing anything else | ||
180 | // FIXME: Can't we use wait_ms() here? | ||
181 | static uint8_t startup_tick = 0; | ||
182 | if (startup_tick < 20) { | ||
183 | startup_tick++; | ||
184 | return; | ||
185 | } | ||
186 | |||
187 | g_tick++; | 179 | g_tick++; |
188 | 180 | ||
189 | if (g_any_key_hit < 0xFFFFFFFF) { | 181 | if (g_any_key_hit < 0xFFFFFFFF) { |
190 | g_any_key_hit++; | 182 | g_any_key_hit++; |
191 | } | 183 | } |
192 | 184 | ||
193 | /* FIXME: WHY YOU COMMENT OUT?! | ||
194 | for (int led = 0; led < LED_DRIVER_LED_COUNT; led++) { | 185 | for (int led = 0; led < LED_DRIVER_LED_COUNT; led++) { |
195 | if (g_key_hit[led] < 255) { | 186 | if (g_key_hit[led] < 255) { |
196 | if (g_key_hit[led] == 254) | 187 | if (g_key_hit[led] == 254) |
@@ -199,12 +190,6 @@ void led_matrix_task(void) { | |||
199 | } | 190 | } |
200 | } | 191 | } |
201 | 192 | ||
202 | // Factory default magic value | ||
203 | if (led_matrix_config.mode == 255) { | ||
204 | led_matrix_uniform_brightness(); | ||
205 | return; | ||
206 | } | ||
207 | */ | ||
208 | // Ideally we would also stop sending zeros to the LED driver PWM buffers | 193 | // Ideally we would also stop sending zeros to the LED driver PWM buffers |
209 | // while suspended and just do a software shutdown. This is a cheap hack for now. | 194 | // while suspended and just do a software shutdown. This is a cheap hack for now. |
210 | bool suspend_backlight = ((g_suspend_state && LED_DISABLE_WHEN_USB_SUSPENDED) || | 195 | bool suspend_backlight = ((g_suspend_state && LED_DISABLE_WHEN_USB_SUSPENDED) || |
@@ -263,25 +248,28 @@ void led_matrix_indicators_user(void) {} | |||
263 | void led_matrix_init(void) { | 248 | void led_matrix_init(void) { |
264 | led_matrix_driver.init(); | 249 | led_matrix_driver.init(); |
265 | 250 | ||
266 | // TODO: put the 1 second startup delay here? | 251 | // Wait a second for the driver to finish initializing |
252 | wait_ms(1000); | ||
267 | 253 | ||
268 | // clear the key hits | 254 | // clear the key hits |
269 | for (int led=0; led<LED_DRIVER_LED_COUNT; led++) { | 255 | for (int led=0; led<LED_DRIVER_LED_COUNT; led++) { |
270 | g_key_hit[led] = 255; | 256 | g_key_hit[led] = 255; |
271 | } | 257 | } |
272 | 258 | ||
273 | |||
274 | if (!eeconfig_is_enabled()) { | 259 | if (!eeconfig_is_enabled()) { |
275 | dprintf("led_matrix_init_drivers eeconfig is not enabled.\n"); | 260 | dprintf("led_matrix_init_drivers eeconfig is not enabled.\n"); |
276 | eeconfig_init(); | 261 | eeconfig_init(); |
277 | eeconfig_update_led_matrix_default(); | 262 | eeconfig_update_led_matrix_default(); |
278 | } | 263 | } |
264 | |||
279 | led_matrix_config.raw = eeconfig_read_led_matrix(); | 265 | led_matrix_config.raw = eeconfig_read_led_matrix(); |
266 | |||
280 | if (!led_matrix_config.mode) { | 267 | if (!led_matrix_config.mode) { |
281 | dprintf("led_matrix_init_drivers led_matrix_config.mode = 0. Write default values to EEPROM.\n"); | 268 | dprintf("led_matrix_init_drivers led_matrix_config.mode = 0. Write default values to EEPROM.\n"); |
282 | eeconfig_update_led_matrix_default(); | 269 | eeconfig_update_led_matrix_default(); |
283 | led_matrix_config.raw = eeconfig_read_led_matrix(); | 270 | led_matrix_config.raw = eeconfig_read_led_matrix(); |
284 | } | 271 | } |
272 | |||
285 | eeconfig_debug_led_matrix(); // display current eeprom values | 273 | eeconfig_debug_led_matrix(); // display current eeprom values |
286 | } | 274 | } |
287 | 275 | ||