diff --git a/Core/Src/home_screen.c b/Core/Src/home_screen.c index 8f1f394..2dae9e7 100644 --- a/Core/Src/home_screen.c +++ b/Core/Src/home_screen.c @@ -41,7 +41,8 @@ void volume_readout_update(lv_timer_t* timer){ } } } - + +// start stop button handler static void run_handler(lv_event_t * e){ lv_event_code_t code = lv_event_get_code(e); @@ -49,19 +50,27 @@ static void run_handler(lv_event_t * e){ lv_obj_t* button = lv_event_get_current_target(e); lv_obj_t* label = lv_obj_get_child(button, 0); lv_state_t state = lv_obj_get_state(button); + + // start if(state & LV_STATE_CHECKED){ lv_label_set_text(label, LV_SYMBOL_PAUSE); pse_sp_set_dir_all(units, units_num, 1); pse_sp_start_all(units, units_num); + + // store the status in case we switch to the edit screen while running run_status = 1; + // start the volume readout update timer volume_readout_update_timer = lv_timer_create(volume_readout_update, 100, NULL); } - else{ + else{ // stop lv_label_set_text(label, LV_SYMBOL_PLAY); pse_sp_stop_all(units, units_num); delete_timer(&volume_readout_update_timer); run_status = 0; + + // save the unit (to keep track of the position) + save_units(units, units_num, workspace_index); } } } @@ -173,6 +182,7 @@ static lv_obj_t* PSE_unit_widget(lv_obj_t* parent, pse_unit* pse_unit){ lv_obj_t* flow = lv_label_create(cont); lv_obj_set_width(flow, lv_pct(100)); lv_obj_set_flex_grow(flow, 1); + lv_label_set_long_mode(flow, LV_LABEL_LONG_CLIP); lv_label_set_text_fmt(flow, "%02u.%03u\nmL/mn", pse_unit->flow / 1000, pse_unit->flow % 1000); pse_unit->home_display->flow = flow; @@ -180,6 +190,7 @@ static lv_obj_t* PSE_unit_widget(lv_obj_t* parent, pse_unit* pse_unit){ lv_obj_t* vol = lv_label_create(cont); lv_obj_set_width(vol, lv_pct(100)); lv_obj_set_flex_grow(vol, 1); + lv_label_set_long_mode(vol, LV_LABEL_LONG_CLIP); lv_label_set_text_fmt(vol, "%d.%03u\nmL", pse_unit->volume / 1000, abs(pse_unit->volume) % 1000); pse_unit->home_display->volume = vol;