diff --git a/Core/Src/home_screen.c b/Core/Src/home_screen.c index e6a318c..8f1f394 100644 --- a/Core/Src/home_screen.c +++ b/Core/Src/home_screen.c @@ -23,6 +23,8 @@ static lv_obj_t* ws_label; static lv_timer_t* volume_readout_update_timer = NULL; +static uint8_t run_status = 0; + static void delete_timer(lv_timer_t** timer){ if(*timer == NULL) return; lv_timer_del(*timer); @@ -51,6 +53,7 @@ static void run_handler(lv_event_t * e){ lv_label_set_text(label, LV_SYMBOL_PAUSE); pse_sp_set_dir_all(units, units_num, 1); pse_sp_start_all(units, units_num); + run_status = 1; volume_readout_update_timer = lv_timer_create(volume_readout_update, 100, NULL); } @@ -58,6 +61,7 @@ static void run_handler(lv_event_t * e){ lv_label_set_text(label, LV_SYMBOL_PLAY); pse_sp_stop_all(units, units_num); delete_timer(&volume_readout_update_timer); + run_status = 0; } } } @@ -192,7 +196,7 @@ static lv_obj_t* PSE_unit_widget(lv_obj_t* parent, pse_unit* pse_unit){ lv_obj_t* enabled = lv_btn_create(cont); lv_obj_t* enabled_label = lv_label_create(enabled); lv_obj_set_width(enabled, lv_pct(100)); - lv_obj_add_flag(enabled, LV_OBJ_FLAG_CHECKABLE); + lv_obj_add_flag(enabled, LV_OBJ_FLAG_CHECKABLE); lv_obj_add_event_cb(enabled, unit_widget_enabled_handler, LV_EVENT_ALL, pse_unit); lv_obj_set_flex_grow(enabled, 1); lv_obj_center(enabled_label); @@ -232,6 +236,11 @@ void Home_Screen_Gen(pse_unit* pse_units, uint8_t pse_unit_num, uint8_t delete){ lv_obj_t* run_label = lv_label_create(run_button); lv_label_set_text(run_label, LV_SYMBOL_PLAY); lv_obj_center(run_label); + if(run_status){ + lv_obj_add_state(run_button, LV_STATE_CHECKED); + lv_label_set_text(run_label, LV_SYMBOL_PAUSE); + volume_readout_update_timer = lv_timer_create(volume_readout_update, 100, NULL); + } // add workspace switcher lv_obj_t* ws_left = lv_btn_create(top_menu);