]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
LEDS are flushed automatically
authorFred Sundvik <fsundvik@gmail.com>
Sun, 24 Apr 2016 13:26:53 +0000 (16:26 +0300)
committerFred Sundvik <fsundvik@gmail.com>
Sun, 24 Apr 2016 13:26:53 +0000 (16:26 +0300)
After running the animation, instead of having to do it manually.
This avoids duplicate flushing, and better support for cross-fades.

led_test.c
visualizer.c

index 8c0de604a2aede8d7318e3050e61349c6673af55..c987eca380214e68536a2d03ba18b9b85caa22a7 100644 (file)
@@ -63,7 +63,6 @@ static void keyframe_fade_all_leds_from_to(keyframe_animation_t* animation, uint
     uint8_t luma = fade_led_color(animation, from, to);
     color_t color = LUMA2COLOR(luma);
     gdispGClear(LED_DISPLAY, color);
-    gdispGFlush(LED_DISPLAY);
 }
 
 // TODO: Should be customizable per keyboard
@@ -102,7 +101,6 @@ bool keyframe_led_left_to_right_gradient(keyframe_animation_t* animation, visual
         uint8_t color = compute_gradient_color(t, i, NUM_COLS);
         gdispGDrawLine(LED_DISPLAY, i, 0, i, NUM_ROWS - 1, LUMA2COLOR(color));
     }
-    gdispGFlush(LED_DISPLAY);
     return true;
 }
 
@@ -115,7 +113,6 @@ bool keyframe_led_top_to_bottom_gradient(keyframe_animation_t* animation, visual
         uint8_t color = compute_gradient_color(t, i, NUM_ROWS);
         gdispGDrawLine(LED_DISPLAY, 0, i, NUM_COLS - 1, i, LUMA2COLOR(color));
     }
-    gdispGFlush(LED_DISPLAY);
     return true;
 }
 
@@ -140,6 +137,5 @@ bool keyframe_led_crossfade(keyframe_animation_t* animation, visualizer_state_t*
             gdispGDrawPixel(LED_DISPLAY, j, i, color);
         }
     }
-    gdispGFlush(LED_DISPLAY);
     return true;
 }
index 2ec6e34f5862b1d90477c26513210fe7a6543b62..81ec8298fdf65c5aae3d47e990e3b524688005f1 100644 (file)
@@ -127,6 +127,7 @@ void stop_all_keyframe_animations(void) {
 }
 
 static bool update_keyframe_animation(keyframe_animation_t* animation, visualizer_state_t* state, systime_t delta, systime_t* sleep_time) {
+    // TODO: Clean up this messy code
     dprintf("Animation frame%d, left %d, delta %d\n", animation->current_frame,
             animation->time_left_in_frame, delta);
     if (animation->current_frame == animation->num_frames) {
@@ -394,6 +395,9 @@ static THD_FUNCTION(visualizerThread, arg) {
                 update_keyframe_animation(animations[i], &state, delta, &sleep_time);
             }
         }
+#ifdef LED_ENABLE
+        gdispGFlush(LED_DISPLAY);
+#endif
         // The animation can enable the visualizer
         // And we might need to update the state when that happens
         // so don't sleep