diff options
| author | Fred Sundvik <fsundvik@gmail.com> | 2016-03-13 21:35:42 +0200 |
|---|---|---|
| committer | Fred Sundvik <fsundvik@gmail.com> | 2016-03-13 21:35:42 +0200 |
| commit | f4c11740f7bac033194ab1d5f5a52721b1d7c6d2 (patch) | |
| tree | 66c19a7e5528c325791d610635b86a76617be4af | |
| parent | b93d07198a18063594a59dd193d0961622087868 (diff) | |
| download | qmk_firmware-f4c11740f7bac033194ab1d5f5a52721b1d7c6d2.tar.gz qmk_firmware-f4c11740f7bac033194ab1d5f5a52721b1d7c6d2.zip | |
Suspend power off, fix backlight animation
The backlight color animation was using the wrong frame number, so
it didn't work properly.
| -rw-r--r-- | visualizer.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/visualizer.c b/visualizer.c index 5b0d560ed..867a1d334 100644 --- a/visualizer.c +++ b/visualizer.c | |||
| @@ -174,7 +174,7 @@ bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t* | |||
| 174 | 174 | ||
| 175 | #ifdef LCD_BACKLIGHT_ENABLE | 175 | #ifdef LCD_BACKLIGHT_ENABLE |
| 176 | bool keyframe_animate_backlight_color(keyframe_animation_t* animation, visualizer_state_t* state) { | 176 | bool keyframe_animate_backlight_color(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 177 | int frame_length = animation->frame_lengths[1]; | 177 | int frame_length = animation->frame_lengths[animation->current_frame]; |
| 178 | int current_pos = frame_length - animation->time_left_in_frame; | 178 | int current_pos = frame_length - animation->time_left_in_frame; |
| 179 | uint8_t t_h = LCD_HUE(state->target_lcd_color); | 179 | uint8_t t_h = LCD_HUE(state->target_lcd_color); |
| 180 | uint8_t t_s = LCD_SAT(state->target_lcd_color); | 180 | uint8_t t_s = LCD_SAT(state->target_lcd_color); |
| @@ -270,12 +270,21 @@ bool keyframe_display_layer_bitmap(keyframe_animation_t* animation, visualizer_s | |||
| 270 | bool keyframe_disable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state) { | 270 | bool keyframe_disable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 271 | (void)animation; | 271 | (void)animation; |
| 272 | (void)state; | 272 | (void)state; |
| 273 | #ifdef LCD_ENABLE | ||
| 274 | gdispSetPowerMode(powerOff); | ||
| 275 | #endif | ||
| 276 | #ifdef LCD_BACKLIGHT_ENABLE | ||
| 277 | lcd_backlight_hal_color(0, 0, 0); | ||
| 278 | #endif | ||
| 273 | return false; | 279 | return false; |
| 274 | } | 280 | } |
| 275 | 281 | ||
| 276 | bool keyframe_enable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state) { | 282 | bool keyframe_enable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 277 | (void)animation; | 283 | (void)animation; |
| 278 | (void)state; | 284 | (void)state; |
| 285 | #ifdef LCD_ENABLE | ||
| 286 | gdispSetPowerMode(powerOn); | ||
| 287 | #endif | ||
| 279 | return false; | 288 | return false; |
| 280 | } | 289 | } |
| 281 | 290 | ||
| @@ -339,8 +348,8 @@ static THD_FUNCTION(visualizerThread, arg) { | |||
| 339 | else { | 348 | else { |
| 340 | state.status = current_status; | 349 | state.status = current_status; |
| 341 | update_user_visualizer_state(&state); | 350 | update_user_visualizer_state(&state); |
| 342 | state.prev_lcd_color = state.current_lcd_color; | ||
| 343 | } | 351 | } |
| 352 | state.prev_lcd_color = state.current_lcd_color; | ||
| 344 | } | 353 | } |
| 345 | } | 354 | } |
| 346 | if (!enabled && state.status.suspended && current_status.suspended == false) { | 355 | if (!enabled && state.status.suspended && current_status.suspended == false) { |
| @@ -350,6 +359,7 @@ static THD_FUNCTION(visualizerThread, arg) { | |||
| 350 | state.status.suspended = false; | 359 | state.status.suspended = false; |
| 351 | stop_all_keyframe_animations(); | 360 | stop_all_keyframe_animations(); |
| 352 | user_visualizer_resume(&state); | 361 | user_visualizer_resume(&state); |
| 362 | state.prev_lcd_color = state.current_lcd_color; | ||
| 353 | } | 363 | } |
| 354 | sleep_time = TIME_INFINITE; | 364 | sleep_time = TIME_INFINITE; |
| 355 | for (int i=0;i<MAX_SIMULTANEOUS_ANIMATIONS;i++) { | 365 | for (int i=0;i<MAX_SIMULTANEOUS_ANIMATIONS;i++) { |
