store/load run status on edit

This commit is contained in:
leo 2023-09-21 17:26:53 +02:00
parent e017cb8a9d
commit 11446b5de7
Signed by: leo
GPG Key ID: 0DD993BFB2B307DB

View File

@ -23,6 +23,8 @@ static lv_obj_t* ws_label;
static lv_timer_t* volume_readout_update_timer = NULL; static lv_timer_t* volume_readout_update_timer = NULL;
static uint8_t run_status = 0;
static void delete_timer(lv_timer_t** timer){ static void delete_timer(lv_timer_t** timer){
if(*timer == NULL) return; if(*timer == NULL) return;
lv_timer_del(*timer); lv_timer_del(*timer);
@ -51,6 +53,7 @@ static void run_handler(lv_event_t * e){
lv_label_set_text(label, LV_SYMBOL_PAUSE); lv_label_set_text(label, LV_SYMBOL_PAUSE);
pse_sp_set_dir_all(units, units_num, 1); pse_sp_set_dir_all(units, units_num, 1);
pse_sp_start_all(units, units_num); pse_sp_start_all(units, units_num);
run_status = 1;
volume_readout_update_timer = lv_timer_create(volume_readout_update, 100, NULL); 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); lv_label_set_text(label, LV_SYMBOL_PLAY);
pse_sp_stop_all(units, units_num); pse_sp_stop_all(units, units_num);
delete_timer(&volume_readout_update_timer); delete_timer(&volume_readout_update_timer);
run_status = 0;
} }
} }
} }
@ -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_obj_t* run_label = lv_label_create(run_button);
lv_label_set_text(run_label, LV_SYMBOL_PLAY); lv_label_set_text(run_label, LV_SYMBOL_PLAY);
lv_obj_center(run_label); 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 // add workspace switcher
lv_obj_t* ws_left = lv_btn_create(top_menu); lv_obj_t* ws_left = lv_btn_create(top_menu);