Dont save the home sceen when switching to the unit edit screen

This commit is contained in:
leo 2023-08-24 14:57:42 +02:00
parent 2fc79d35f9
commit 4bad995d15
Signed by: leo
GPG Key ID: 0DD993BFB2B307DB
3 changed files with 7 additions and 7 deletions

View File

@ -10,6 +10,6 @@
#include "PSE_unit.h" #include "PSE_unit.h"
void PSE_unit_edit_screen_Gen(lv_obj_t* parent, pse_unit* units, pse_unit* unit, uint8_t units_num); void PSE_unit_edit_screen_Gen(pse_unit* units, pse_unit* unit, uint8_t units_num);
#endif /* INC_PSE_EDIT_SCREEN_H_ */ #endif /* INC_PSE_EDIT_SCREEN_H_ */

View File

@ -14,10 +14,10 @@
#include "PSE_unit.h" #include "PSE_unit.h"
#include "keypad_screen.h" #include "keypad_screen.h"
#include "pse_stepper_planer.h" #include "pse_stepper_planer.h"
#include "home_screen.h"
#include "lvgl.h" #include "lvgl.h"
static lv_obj_t* parent_screen;
static lv_obj_t* this_screen; static lv_obj_t* this_screen;
static pse_unit* c_pse_units; static pse_unit* c_pse_units;
static pse_unit* c_pse_unit; static pse_unit* c_pse_unit;
@ -34,7 +34,7 @@ static void back_button_handler(lv_event_t * e){
// go back to the main menu // go back to the main menu
lv_obj_t* curr_scr = lv_scr_act(); lv_obj_t* curr_scr = lv_scr_act();
lv_scr_load(parent_screen); Home_Screen_Gen(c_pse_units, c_pse_units_num);
lv_obj_del(curr_scr); lv_obj_del(curr_scr);
} }
} }
@ -194,8 +194,7 @@ static lv_obj_t* controls_widget(lv_obj_t* parent, pse_unit* unit){
return cont; return cont;
} }
void PSE_unit_edit_screen_Gen(lv_obj_t* parent, pse_unit* units, pse_unit* c_unit, uint8_t units_num){ void PSE_unit_edit_screen_Gen(pse_unit* units, pse_unit* c_unit, uint8_t units_num){
parent_screen = parent;
// Create a new screen // Create a new screen
lv_obj_t* scr = lv_obj_create(NULL); lv_obj_t* scr = lv_obj_create(NULL);
this_screen = scr; this_screen = scr;
@ -244,5 +243,5 @@ void PSE_unit_edit_screen_Gen(lv_obj_t* parent, pse_unit* units, pse_unit* c_uni
lv_obj_set_grid_cell(controls, LV_GRID_ALIGN_CENTER, 3, 1, LV_GRID_ALIGN_CENTER, 0, 1); lv_obj_set_grid_cell(controls, LV_GRID_ALIGN_CENTER, 3, 1, LV_GRID_ALIGN_CENTER, 0, 1);
// fade in the new screen // fade in the new screen
lv_scr_load(scr); lv_scr_load_anim(scr, LV_SCR_LOAD_ANIM_NONE, 0, 0, true);
} }

View File

@ -58,6 +58,7 @@ static void unit_widget_enabled_handler(lv_event_t * e){
lv_label_set_text(label, LV_SYMBOL_CLOSE); lv_label_set_text(label, LV_SYMBOL_CLOSE);
unit->enabled = 1; unit->enabled = 1;
} }
save_units(units, units_num);
} }
} }
@ -66,7 +67,7 @@ static void unit_widget_clicked_handler(lv_event_t* e){
if(code == LV_EVENT_CLICKED) { if(code == LV_EVENT_CLICKED) {
pse_unit* unit = lv_event_get_user_data(e); pse_unit* unit = lv_event_get_user_data(e);
PSE_unit_edit_screen_Gen(screen, units, unit, units_num); PSE_unit_edit_screen_Gen(units, unit, units_num);
} }
} }