diff --git a/applications/lvgl/guider/generated/events_init.c b/applications/lvgl/guider/generated/events_init.c index 1bd50b4..26c20ef 100644 --- a/applications/lvgl/guider/generated/events_init.c +++ b/applications/lvgl/guider/generated/events_init.c @@ -439,6 +439,7 @@ static void screen_btn_2_event_handler (lv_event_t *e) switch (code) { case LV_EVENT_CLICKED: { + STEP_DATA_set_ui_w(); lv_obj_add_flag(guider_ui.screen_stepinf, LV_OBJ_FLAG_HIDDEN); lv_obj_add_flag(guider_ui.screen_stepinf_s1b, LV_OBJ_FLAG_HIDDEN); lv_obj_add_flag(guider_ui.screen_stepinf_s2b, LV_OBJ_FLAG_HIDDEN); diff --git a/applications/lvgl/ui_data_labels.h b/applications/lvgl/ui_data_labels.h index d907aff..424d8ba 100644 --- a/applications/lvgl/ui_data_labels.h +++ b/applications/lvgl/ui_data_labels.h @@ -123,5 +123,6 @@ void UI_pname_new(); #include void STEP_DATA_set_ui(IO_STEP_DATA* STEPDATA_inf); +void STEP_DATA_set_ui_w(); #endif /* APPLICATIONS_LVGL_UI_DATA_LABELS_H_ */ diff --git a/applications/lvgl/ui_data_labels_step.c b/applications/lvgl/ui_data_labels_step.c index a900abd..7e9efc4 100644 --- a/applications/lvgl/ui_data_labels_step.c +++ b/applications/lvgl/ui_data_labels_step.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -22,9 +23,10 @@ #include #include "libcsv.h" -// 全局或静态数组 - -extern struct rt_memheap sram_SRAM1,sdram_heap; +// +int STEP_SET_MODE=-1;//页面功能状态 +char ProgramID[32]; +char stepsql[512] = {0}; // 初始化为 0 static const int get_step_name(char * step_id) { @@ -83,6 +85,7 @@ static const int get_step_namer(char * step_id) #include "sql/DB_SQLite.h" #include"ui_data_csv.h" +//数字格式化 void str_step_ui(char *buffer,double scaled_val) { int integer_part = (int) scaled_val; @@ -100,8 +103,10 @@ void STEP_DATA_set_ui(IO_STEP_DATA* STEPDATA_inf) //步骤信息页面填入 char str_str[4]; char str_step[5]; + lv_snprintf(str_str, sizeof(str_str), "%03d", STEPDATA_inf->Step); lv_label_set_text(guider_ui.screen_stepinf_step,(const char *)str_str); + lv_snprintf(ProgramID, sizeof(ProgramID), STEPDATA_inf->Dyelot); lv_label_set_text(guider_ui.screen_stepinf_name,(const char *)STEPDATA_inf->Program); lv_dropdown_set_selected(guider_ui.screen_stepinf_s1,get_step_name(STEPDATA_inf->StepID)); lv_dropdown_set_selected(guider_ui.screen_stepinf_s2,get_step_namer(STEPDATA_inf->StepID_S1)); @@ -138,5 +143,38 @@ void STEP_DATA_set_ui(IO_STEP_DATA* STEPDATA_inf) lv_textarea_set_text(guider_ui.screen_stepinf_p5b2,(const char *)str_step); lv_obj_clear_flag(guider_ui.screen_stepinf_s1b, LV_OBJ_FLAG_HIDDEN); + + STEP_SET_MODE=0;//程序页面步骤修改 } + +void STEP_DATA_set_ui_w() +{ + switch(STEP_SET_MODE){ + case 0: + rt_snprintf(stepsql, sizeof(stepsql),"UPDATE ProgramSteps " + "SET P1=%s,P2=%s,P3=%s,P4=%s,P5=%s," + "P1_S1=%s,P2_S1=%s,P3_S1=%s,P4_S1=%s,P5_S1=%s," + "P1_S2=%s,P2_S2=%s,P3_S2=%s,P4_S2=%s,P5_S2=%s " + "WHERE Program='%s' and Step=%d;", + lv_textarea_get_text(guider_ui.screen_stepinf_p1), + lv_textarea_get_text(guider_ui.screen_stepinf_p2), + lv_textarea_get_text(guider_ui.screen_stepinf_p3), + lv_textarea_get_text(guider_ui.screen_stepinf_p4), + lv_textarea_get_text(guider_ui.screen_stepinf_p5), + lv_textarea_get_text(guider_ui.screen_stepinf_p1b1), + lv_textarea_get_text(guider_ui.screen_stepinf_p2b1), + lv_textarea_get_text(guider_ui.screen_stepinf_p3b1), + lv_textarea_get_text(guider_ui.screen_stepinf_p4b1), + lv_textarea_get_text(guider_ui.screen_stepinf_p5b1), + lv_textarea_get_text(guider_ui.screen_stepinf_p1b2), + lv_textarea_get_text(guider_ui.screen_stepinf_p2b2), + lv_textarea_get_text(guider_ui.screen_stepinf_p3b2), + lv_textarea_get_text(guider_ui.screen_stepinf_p4b2), + lv_textarea_get_text(guider_ui.screen_stepinf_p5b2), + lv_label_get_text(guider_ui.screen_stepinf_name), + atoi(lv_label_get_text(guider_ui.screen_stepinf_step))); + default: ; + } + STEP_SET_MODE=-1; +}