fix: 快速旋转 EC11 时,有概率界面卡死或崩溃。
This commit is contained in:
parent
3bdd8d70c3
commit
7c9c016aef
14
main/gui.c
14
main/gui.c
@ -84,6 +84,7 @@ static lv_obj_t *desktop_label;
|
||||
static lv_anim_t desktop_animate;
|
||||
|
||||
value_setting_panel_t *value_setting_panel = NULL;
|
||||
static bool panel_locked = false;
|
||||
|
||||
static lv_obj_t *scr;
|
||||
|
||||
@ -237,10 +238,11 @@ static void gui_close_value_setting_panel() {
|
||||
}
|
||||
|
||||
static void gui_check_value_setting_panel_task(void *pvParameters) {
|
||||
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(GUI_PANEL_TIMEOUT_US / 1000 / portTICK_PERIOD_MS);
|
||||
for (;;) {
|
||||
if (esp_timer_get_time() - value_setting_panel->last_updated_at >
|
||||
GUI_PANEL_TIMEOUT_US) {
|
||||
if (!panel_locked &&
|
||||
esp_timer_get_time() - value_setting_panel->last_updated_at >
|
||||
GUI_PANEL_TIMEOUT_US) {
|
||||
gui_close_value_setting_panel();
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
@ -296,26 +298,32 @@ static void gui_create_value_setting_panel() {
|
||||
}
|
||||
|
||||
static void gui_change_strip_level(int32_t target_value) {
|
||||
panel_locked = true;
|
||||
gui_create_value_setting_panel();
|
||||
lv_label_set_text(value_setting_panel->label, "Strip Level");
|
||||
lv_bar_set_range(value_setting_panel->bar, 0, 255);
|
||||
lv_bar_set_value(value_setting_panel->bar, target_value, LV_ANIM_ON);
|
||||
panel_locked = false;
|
||||
}
|
||||
|
||||
static void gui_change_display_brightness(int8_t display_index,
|
||||
int32_t target_value) {
|
||||
panel_locked = true;
|
||||
gui_create_value_setting_panel();
|
||||
lv_label_set_text_fmt(value_setting_panel->label, "Display#%d Brightness",
|
||||
display_index);
|
||||
lv_bar_set_range(value_setting_panel->bar, 0, 100);
|
||||
lv_bar_set_value(value_setting_panel->bar, target_value, LV_ANIM_ON);
|
||||
panel_locked = false;
|
||||
}
|
||||
|
||||
static void gui_change_volume_level(int32_t target_value) {
|
||||
panel_locked = true;
|
||||
gui_create_value_setting_panel();
|
||||
lv_label_set_text(value_setting_panel->label, "Volume Level");
|
||||
lv_bar_set_range(value_setting_panel->bar, 0, 100);
|
||||
lv_bar_set_value(value_setting_panel->bar, target_value, LV_ANIM_ON);
|
||||
panel_locked = false;
|
||||
}
|
||||
|
||||
void gui_status_bar_create(lv_obj_t *scr) {
|
||||
|
Loading…
Reference in New Issue
Block a user