diff options
| author | Fred Sundvik <fsundvik@gmail.com> | 2016-04-24 16:26:53 +0300 |
|---|---|---|
| committer | Fred Sundvik <fsundvik@gmail.com> | 2016-04-24 16:26:53 +0300 |
| commit | 15906b86ae1db858b38bc77393e31e7741223b01 (patch) | |
| tree | c5f4f48a845bc076662f9738ab45855b37b52236 | |
| parent | 0530ebb77d6961a7edc14f3a5b943165a8b52497 (diff) | |
| download | qmk_firmware-15906b86ae1db858b38bc77393e31e7741223b01.tar.gz qmk_firmware-15906b86ae1db858b38bc77393e31e7741223b01.zip | |
LEDS are flushed automatically
After running the animation, instead of having to do it manually.
This avoids duplicate flushing, and better support for cross-fades.
| -rw-r--r-- | led_test.c | 4 | ||||
| -rw-r--r-- | visualizer.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/led_test.c b/led_test.c index 8c0de604a..c987eca38 100644 --- a/led_test.c +++ b/led_test.c | |||
| @@ -63,7 +63,6 @@ static void keyframe_fade_all_leds_from_to(keyframe_animation_t* animation, uint | |||
| 63 | uint8_t luma = fade_led_color(animation, from, to); | 63 | uint8_t luma = fade_led_color(animation, from, to); |
| 64 | color_t color = LUMA2COLOR(luma); | 64 | color_t color = LUMA2COLOR(luma); |
| 65 | gdispGClear(LED_DISPLAY, color); | 65 | gdispGClear(LED_DISPLAY, color); |
| 66 | gdispGFlush(LED_DISPLAY); | ||
| 67 | } | 66 | } |
| 68 | 67 | ||
| 69 | // TODO: Should be customizable per keyboard | 68 | // TODO: Should be customizable per keyboard |
| @@ -102,7 +101,6 @@ bool keyframe_led_left_to_right_gradient(keyframe_animation_t* animation, visual | |||
| 102 | uint8_t color = compute_gradient_color(t, i, NUM_COLS); | 101 | uint8_t color = compute_gradient_color(t, i, NUM_COLS); |
| 103 | gdispGDrawLine(LED_DISPLAY, i, 0, i, NUM_ROWS - 1, LUMA2COLOR(color)); | 102 | gdispGDrawLine(LED_DISPLAY, i, 0, i, NUM_ROWS - 1, LUMA2COLOR(color)); |
| 104 | } | 103 | } |
| 105 | gdispGFlush(LED_DISPLAY); | ||
| 106 | return true; | 104 | return true; |
| 107 | } | 105 | } |
| 108 | 106 | ||
| @@ -115,7 +113,6 @@ bool keyframe_led_top_to_bottom_gradient(keyframe_animation_t* animation, visual | |||
| 115 | uint8_t color = compute_gradient_color(t, i, NUM_ROWS); | 113 | uint8_t color = compute_gradient_color(t, i, NUM_ROWS); |
| 116 | gdispGDrawLine(LED_DISPLAY, 0, i, NUM_COLS - 1, i, LUMA2COLOR(color)); | 114 | gdispGDrawLine(LED_DISPLAY, 0, i, NUM_COLS - 1, i, LUMA2COLOR(color)); |
| 117 | } | 115 | } |
| 118 | gdispGFlush(LED_DISPLAY); | ||
| 119 | return true; | 116 | return true; |
| 120 | } | 117 | } |
| 121 | 118 | ||
| @@ -140,6 +137,5 @@ bool keyframe_led_crossfade(keyframe_animation_t* animation, visualizer_state_t* | |||
| 140 | gdispGDrawPixel(LED_DISPLAY, j, i, color); | 137 | gdispGDrawPixel(LED_DISPLAY, j, i, color); |
| 141 | } | 138 | } |
| 142 | } | 139 | } |
| 143 | gdispGFlush(LED_DISPLAY); | ||
| 144 | return true; | 140 | return true; |
| 145 | } | 141 | } |
diff --git a/visualizer.c b/visualizer.c index 2ec6e34f5..81ec8298f 100644 --- a/visualizer.c +++ b/visualizer.c | |||
| @@ -127,6 +127,7 @@ void stop_all_keyframe_animations(void) { | |||
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | static bool update_keyframe_animation(keyframe_animation_t* animation, visualizer_state_t* state, systime_t delta, systime_t* sleep_time) { | 129 | static bool update_keyframe_animation(keyframe_animation_t* animation, visualizer_state_t* state, systime_t delta, systime_t* sleep_time) { |
| 130 | // TODO: Clean up this messy code | ||
| 130 | dprintf("Animation frame%d, left %d, delta %d\n", animation->current_frame, | 131 | dprintf("Animation frame%d, left %d, delta %d\n", animation->current_frame, |
| 131 | animation->time_left_in_frame, delta); | 132 | animation->time_left_in_frame, delta); |
| 132 | if (animation->current_frame == animation->num_frames) { | 133 | if (animation->current_frame == animation->num_frames) { |
| @@ -394,6 +395,9 @@ static THD_FUNCTION(visualizerThread, arg) { | |||
| 394 | update_keyframe_animation(animations[i], &state, delta, &sleep_time); | 395 | update_keyframe_animation(animations[i], &state, delta, &sleep_time); |
| 395 | } | 396 | } |
| 396 | } | 397 | } |
| 398 | #ifdef LED_ENABLE | ||
| 399 | gdispGFlush(LED_DISPLAY); | ||
| 400 | #endif | ||
| 397 | // The animation can enable the visualizer | 401 | // The animation can enable the visualizer |
| 398 | // And we might need to update the state when that happens | 402 | // And we might need to update the state when that happens |
| 399 | // so don't sleep | 403 | // so don't sleep |
