summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2016-03-13 21:35:42 +0200
committerFred Sundvik <fsundvik@gmail.com>2016-03-13 21:35:42 +0200
commitf4c11740f7bac033194ab1d5f5a52721b1d7c6d2 (patch)
tree66c19a7e5528c325791d610635b86a76617be4af
parentb93d07198a18063594a59dd193d0961622087868 (diff)
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.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/visualizer.c b/visualizer.c
index 5b0d560ed9..867a1d3347 100644
--- a/visualizer.c
+++ b/visualizer.c
@@ -174,7 +174,7 @@ bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t*
#ifdef LCD_BACKLIGHT_ENABLE
bool keyframe_animate_backlight_color(keyframe_animation_t* animation, visualizer_state_t* state) {
- int frame_length = animation->frame_lengths[1];
+ int frame_length = animation->frame_lengths[animation->current_frame];
int current_pos = frame_length - animation->time_left_in_frame;
uint8_t t_h = LCD_HUE(state->target_lcd_color);
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
bool keyframe_disable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
+#ifdef LCD_ENABLE
+ gdispSetPowerMode(powerOff);
+#endif
+#ifdef LCD_BACKLIGHT_ENABLE
+ lcd_backlight_hal_color(0, 0, 0);
+#endif
return false;
}
bool keyframe_enable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
+#ifdef LCD_ENABLE
+ gdispSetPowerMode(powerOn);
+#endif
return false;
}
@@ -339,8 +348,8 @@ static THD_FUNCTION(visualizerThread, arg) {
else {
state.status = current_status;
update_user_visualizer_state(&state);
- state.prev_lcd_color = state.current_lcd_color;
}
+ state.prev_lcd_color = state.current_lcd_color;
}
}
if (!enabled && state.status.suspended && current_status.suspended == false) {
@@ -350,6 +359,7 @@ static THD_FUNCTION(visualizerThread, arg) {
state.status.suspended = false;
stop_all_keyframe_animations();
user_visualizer_resume(&state);
+ state.prev_lcd_color = state.current_lcd_color;
}
sleep_time = TIME_INFINITE;
for (int i=0;i<MAX_SIMULTANEOUS_ANIMATIONS;i++) {