diff --git a/applications/INI/config.c b/applications/INI/config.c index b1af329..97a9df8 100644 --- a/applications/INI/config.c +++ b/applications/INI/config.c @@ -54,8 +54,8 @@ int read_sample(void) if (access(INI_config, F_OK) != 0) { LOG_E("NOT 828config"); - int fd = open(INI_config, O_WRONLY | O_CREAT);//创建文件 - close(fd); + // int fd = open(INI_config, O_WRONLY | O_CREAT);//创建文件 + // close(fd); } // 初始化INI解析器 INI_File *ini = ini_init(); diff --git a/applications/INI/config.h b/applications/INI/config.h new file mode 100644 index 0000000..57eee9a --- /dev/null +++ b/applications/INI/config.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2026-01-23 Administrator the first version + */ +#ifndef APPLICATIONS_INI_CONFIG_H_ +#define APPLICATIONS_INI_CONFIG_H_ + +extern void write_sample(void); + +#endif /* APPLICATIONS_INI_CONFIG_H_ */ diff --git a/applications/lvgl/guider/generated/events_init.c b/applications/lvgl/guider/generated/events_init.c index 0d135a1..bf01292 100644 --- a/applications/lvgl/guider/generated/events_init.c +++ b/applications/lvgl/guider/generated/events_init.c @@ -15,6 +15,8 @@ #include "freemaster_client.h" #endif +#include "INI/config.h" +#include "data/Variable.h" static void screen_inf_img_event_handler (lv_event_t *e) { @@ -217,6 +219,14 @@ static void screen_sys_save_event_handler (lv_event_t *e) switch (code) { case LV_EVENT_CLICKED: { + + const char* machine_ID_t = lv_textarea_get_text(guider_ui.screen_machine_id_rt); + strncpy(machine_ID, machine_ID_t,sizeof(machine_ID)-1); + machine_ID[sizeof(machine_ID)-1]='\0'; + const char* machine_name_t = lv_textarea_get_text(guider_ui.screen_machine_name_rt); + strncpy(machine_name, machine_name_t,sizeof(machine_name)-1); + machine_name[sizeof(machine_name)-1]='\0'; + write_sample(); break; } default: diff --git a/applications/lvgl/guider/generated/gui_guider.h b/applications/lvgl/guider/generated/gui_guider.h index bff9ed7..a7af4d2 100644 --- a/applications/lvgl/guider/generated/gui_guider.h +++ b/applications/lvgl/guider/generated/gui_guider.h @@ -341,9 +341,9 @@ typedef struct lv_obj_t *screen_set_Save_label; lv_obj_t *screen_step_; lv_obj_t *screen_w_5; - lv_obj_t *screen_machine_name; + lv_obj_t *screen_machine_name_rt; lv_obj_t *screen_sys_name; - lv_obj_t *screen_machine_id; + lv_obj_t *screen_machine_id_rt; lv_obj_t *screen_sys_id; lv_obj_t *screen_sys_var; lv_obj_t *screen_sys_save; diff --git a/applications/lvgl/guider/generated/setup_scr_screen.c b/applications/lvgl/guider/generated/setup_scr_screen.c index d1996fc..b297771 100644 --- a/applications/lvgl/guider/generated/setup_scr_screen.c +++ b/applications/lvgl/guider/generated/setup_scr_screen.c @@ -5062,7 +5062,7 @@ void setup_scr_screen(lv_ui *ui) //Write codes screen_w_5 ui->screen_w_5 = lv_obj_create(ui->screen_tabview_tab_5); - lv_obj_set_pos(ui->screen_w_5, 0, 0); + lv_obj_set_pos(ui->screen_w_5, 0, -1); lv_obj_set_size(ui->screen_w_5, 800, 450); lv_obj_set_scrollbar_mode(ui->screen_w_5, LV_SCROLLBAR_MODE_OFF); @@ -5076,45 +5076,45 @@ void setup_scr_screen(lv_ui *ui) lv_obj_set_style_pad_right(ui->screen_w_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_w_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); - //Write codes screen_machine_name - ui->screen_machine_name = lv_textarea_create(ui->screen_w_5); - lv_textarea_set_text(ui->screen_machine_name, "828"); - lv_textarea_set_placeholder_text(ui->screen_machine_name, ""); - lv_textarea_set_password_bullet(ui->screen_machine_name, "*"); - lv_textarea_set_password_mode(ui->screen_machine_name, false); - lv_textarea_set_one_line(ui->screen_machine_name, true); - lv_textarea_set_accepted_chars(ui->screen_machine_name, ""); - lv_textarea_set_max_length(ui->screen_machine_name, 32); + //Write codes screen_machine_name_rt + ui->screen_machine_name_rt = lv_textarea_create(ui->screen_w_5); + lv_textarea_set_text(ui->screen_machine_name_rt, "828"); + lv_textarea_set_placeholder_text(ui->screen_machine_name_rt, ""); + lv_textarea_set_password_bullet(ui->screen_machine_name_rt, "*"); + lv_textarea_set_password_mode(ui->screen_machine_name_rt, false); + lv_textarea_set_one_line(ui->screen_machine_name_rt, true); + lv_textarea_set_accepted_chars(ui->screen_machine_name_rt, ""); + lv_textarea_set_max_length(ui->screen_machine_name_rt, 32); #if LV_USE_KEYBOARD != 0 || LV_USE_ZH_KEYBOARD != 0 - lv_obj_add_event_cb(ui->screen_machine_name, ta_event_cb, LV_EVENT_ALL, ui->g_kb_top_layer); + lv_obj_add_event_cb(ui->screen_machine_name_rt, ta_event_cb, LV_EVENT_ALL, ui->g_kb_top_layer); #endif - lv_obj_set_pos(ui->screen_machine_name, 150, 70); - lv_obj_set_size(ui->screen_machine_name, 200, 50); - - //Write style for screen_machine_name, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. - lv_obj_set_style_text_color(ui->screen_machine_name, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_text_font(ui->screen_machine_name, &lv_font_montserratMedium_30, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_text_opa(ui->screen_machine_name, 255, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_text_letter_space(ui->screen_machine_name, 0, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_text_align(ui->screen_machine_name, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_bg_opa(ui->screen_machine_name, 255, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_bg_color(ui->screen_machine_name, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_bg_grad_dir(ui->screen_machine_name, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_border_width(ui->screen_machine_name, 2, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_border_opa(ui->screen_machine_name, 255, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_border_color(ui->screen_machine_name, lv_color_hex(0xe6e6e6), LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_border_side(ui->screen_machine_name, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_shadow_width(ui->screen_machine_name, 0, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_pad_top(ui->screen_machine_name, 4, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_pad_right(ui->screen_machine_name, 4, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_pad_left(ui->screen_machine_name, 4, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_radius(ui->screen_machine_name, 4, LV_PART_MAIN|LV_STATE_DEFAULT); - - //Write style for screen_machine_name, Part: LV_PART_SCROLLBAR, State: LV_STATE_DEFAULT. - lv_obj_set_style_bg_opa(ui->screen_machine_name, 255, LV_PART_SCROLLBAR|LV_STATE_DEFAULT); - lv_obj_set_style_bg_color(ui->screen_machine_name, lv_color_hex(0x2195f6), LV_PART_SCROLLBAR|LV_STATE_DEFAULT); - lv_obj_set_style_bg_grad_dir(ui->screen_machine_name, LV_GRAD_DIR_NONE, LV_PART_SCROLLBAR|LV_STATE_DEFAULT); - lv_obj_set_style_radius(ui->screen_machine_name, 0, LV_PART_SCROLLBAR|LV_STATE_DEFAULT); + lv_obj_set_pos(ui->screen_machine_name_rt, 150, 70); + lv_obj_set_size(ui->screen_machine_name_rt, 200, 50); + + //Write style for screen_machine_name_rt, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. + lv_obj_set_style_text_color(ui->screen_machine_name_rt, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui->screen_machine_name_rt, &lv_font_montserratMedium_30, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui->screen_machine_name_rt, 255, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_text_letter_space(ui->screen_machine_name_rt, 0, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_text_align(ui->screen_machine_name_rt, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(ui->screen_machine_name_rt, 255, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_bg_color(ui->screen_machine_name_rt, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_bg_grad_dir(ui->screen_machine_name_rt, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_border_width(ui->screen_machine_name_rt, 2, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_border_opa(ui->screen_machine_name_rt, 255, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_border_color(ui->screen_machine_name_rt, lv_color_hex(0xe6e6e6), LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_border_side(ui->screen_machine_name_rt, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_shadow_width(ui->screen_machine_name_rt, 0, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_pad_top(ui->screen_machine_name_rt, 4, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_pad_right(ui->screen_machine_name_rt, 4, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_pad_left(ui->screen_machine_name_rt, 4, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_radius(ui->screen_machine_name_rt, 4, LV_PART_MAIN|LV_STATE_DEFAULT); + + //Write style for screen_machine_name_rt, Part: LV_PART_SCROLLBAR, State: LV_STATE_DEFAULT. + lv_obj_set_style_bg_opa(ui->screen_machine_name_rt, 255, LV_PART_SCROLLBAR|LV_STATE_DEFAULT); + lv_obj_set_style_bg_color(ui->screen_machine_name_rt, lv_color_hex(0x2195f6), LV_PART_SCROLLBAR|LV_STATE_DEFAULT); + lv_obj_set_style_bg_grad_dir(ui->screen_machine_name_rt, LV_GRAD_DIR_NONE, LV_PART_SCROLLBAR|LV_STATE_DEFAULT); + lv_obj_set_style_radius(ui->screen_machine_name_rt, 0, LV_PART_SCROLLBAR|LV_STATE_DEFAULT); //Write codes screen_sys_name ui->screen_sys_name = lv_label_create(ui->screen_w_5); @@ -5139,45 +5139,45 @@ void setup_scr_screen(lv_ui *ui) lv_obj_set_style_pad_left(ui->screen_sys_name, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_sys_name, 0, LV_PART_MAIN|LV_STATE_DEFAULT); - //Write codes screen_machine_id - ui->screen_machine_id = lv_textarea_create(ui->screen_w_5); - lv_textarea_set_text(ui->screen_machine_id, "ID"); - lv_textarea_set_placeholder_text(ui->screen_machine_id, ""); - lv_textarea_set_password_bullet(ui->screen_machine_id, "*"); - lv_textarea_set_password_mode(ui->screen_machine_id, false); - lv_textarea_set_one_line(ui->screen_machine_id, true); - lv_textarea_set_accepted_chars(ui->screen_machine_id, ""); - lv_textarea_set_max_length(ui->screen_machine_id, 32); + //Write codes screen_machine_id_rt + ui->screen_machine_id_rt = lv_textarea_create(ui->screen_w_5); + lv_textarea_set_text(ui->screen_machine_id_rt, "ID"); + lv_textarea_set_placeholder_text(ui->screen_machine_id_rt, ""); + lv_textarea_set_password_bullet(ui->screen_machine_id_rt, "*"); + lv_textarea_set_password_mode(ui->screen_machine_id_rt, false); + lv_textarea_set_one_line(ui->screen_machine_id_rt, true); + lv_textarea_set_accepted_chars(ui->screen_machine_id_rt, "0123456789"); + lv_textarea_set_max_length(ui->screen_machine_id_rt, 2); #if LV_USE_KEYBOARD != 0 || LV_USE_ZH_KEYBOARD != 0 - lv_obj_add_event_cb(ui->screen_machine_id, ta_event_cb, LV_EVENT_ALL, ui->g_kb_top_layer); + lv_obj_add_event_cb(ui->screen_machine_id_rt, ta_event_cb, LV_EVENT_ALL, ui->g_kb_top_layer); #endif - lv_obj_set_pos(ui->screen_machine_id, 150, 10); - lv_obj_set_size(ui->screen_machine_id, 200, 50); - - //Write style for screen_machine_id, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. - lv_obj_set_style_text_color(ui->screen_machine_id, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_text_font(ui->screen_machine_id, &lv_font_montserratMedium_30, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_text_opa(ui->screen_machine_id, 255, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_text_letter_space(ui->screen_machine_id, 0, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_text_align(ui->screen_machine_id, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_bg_opa(ui->screen_machine_id, 255, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_bg_color(ui->screen_machine_id, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_bg_grad_dir(ui->screen_machine_id, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_border_width(ui->screen_machine_id, 2, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_border_opa(ui->screen_machine_id, 255, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_border_color(ui->screen_machine_id, lv_color_hex(0xe6e6e6), LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_border_side(ui->screen_machine_id, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_shadow_width(ui->screen_machine_id, 0, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_pad_top(ui->screen_machine_id, 4, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_pad_right(ui->screen_machine_id, 4, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_pad_left(ui->screen_machine_id, 4, LV_PART_MAIN|LV_STATE_DEFAULT); - lv_obj_set_style_radius(ui->screen_machine_id, 4, LV_PART_MAIN|LV_STATE_DEFAULT); - - //Write style for screen_machine_id, Part: LV_PART_SCROLLBAR, State: LV_STATE_DEFAULT. - lv_obj_set_style_bg_opa(ui->screen_machine_id, 255, LV_PART_SCROLLBAR|LV_STATE_DEFAULT); - lv_obj_set_style_bg_color(ui->screen_machine_id, lv_color_hex(0x2195f6), LV_PART_SCROLLBAR|LV_STATE_DEFAULT); - lv_obj_set_style_bg_grad_dir(ui->screen_machine_id, LV_GRAD_DIR_NONE, LV_PART_SCROLLBAR|LV_STATE_DEFAULT); - lv_obj_set_style_radius(ui->screen_machine_id, 0, LV_PART_SCROLLBAR|LV_STATE_DEFAULT); + lv_obj_set_pos(ui->screen_machine_id_rt, 150, 10); + lv_obj_set_size(ui->screen_machine_id_rt, 200, 50); + + //Write style for screen_machine_id_rt, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. + lv_obj_set_style_text_color(ui->screen_machine_id_rt, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_text_font(ui->screen_machine_id_rt, &lv_font_montserratMedium_30, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_text_opa(ui->screen_machine_id_rt, 255, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_text_letter_space(ui->screen_machine_id_rt, 0, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_text_align(ui->screen_machine_id_rt, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(ui->screen_machine_id_rt, 255, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_bg_color(ui->screen_machine_id_rt, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_bg_grad_dir(ui->screen_machine_id_rt, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_border_width(ui->screen_machine_id_rt, 2, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_border_opa(ui->screen_machine_id_rt, 255, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_border_color(ui->screen_machine_id_rt, lv_color_hex(0xe6e6e6), LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_border_side(ui->screen_machine_id_rt, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_shadow_width(ui->screen_machine_id_rt, 0, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_pad_top(ui->screen_machine_id_rt, 4, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_pad_right(ui->screen_machine_id_rt, 4, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_pad_left(ui->screen_machine_id_rt, 4, LV_PART_MAIN|LV_STATE_DEFAULT); + lv_obj_set_style_radius(ui->screen_machine_id_rt, 4, LV_PART_MAIN|LV_STATE_DEFAULT); + + //Write style for screen_machine_id_rt, Part: LV_PART_SCROLLBAR, State: LV_STATE_DEFAULT. + lv_obj_set_style_bg_opa(ui->screen_machine_id_rt, 255, LV_PART_SCROLLBAR|LV_STATE_DEFAULT); + lv_obj_set_style_bg_color(ui->screen_machine_id_rt, lv_color_hex(0x2195f6), LV_PART_SCROLLBAR|LV_STATE_DEFAULT); + lv_obj_set_style_bg_grad_dir(ui->screen_machine_id_rt, LV_GRAD_DIR_NONE, LV_PART_SCROLLBAR|LV_STATE_DEFAULT); + lv_obj_set_style_radius(ui->screen_machine_id_rt, 0, LV_PART_SCROLLBAR|LV_STATE_DEFAULT); //Write codes screen_sys_id ui->screen_sys_id = lv_label_create(ui->screen_w_5); @@ -5217,7 +5217,7 @@ void setup_scr_screen(lv_ui *ui) lv_obj_align(ui->screen_sys_save_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_pad_all(ui->screen_sys_save, 0, LV_STATE_DEFAULT); lv_obj_set_width(ui->screen_sys_save_label, LV_PCT(100)); - lv_obj_set_pos(ui->screen_sys_save, 880, 400); + lv_obj_set_pos(ui->screen_sys_save, 880, 398); lv_obj_set_size(ui->screen_sys_save, 100, 50); //Write style for screen_sys_save, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. diff --git a/applications/lvgl/lv__user_gui.c b/applications/lvgl/lv__user_gui.c index af185b0..6de4960 100644 --- a/applications/lvgl/lv__user_gui.c +++ b/applications/lvgl/lv__user_gui.c @@ -301,8 +301,8 @@ void setup_user_screen(lv_ui *ui) { lv_obj_clear_flag(lv_tabview_get_content(ui->screen_tabview), LV_OBJ_FLAG_SCROLLABLE);//禁止左右滑动 lv_obj_clear_flag(lv_tabview_get_content(ui->screen_w_io), LV_OBJ_FLAG_SCROLLABLE);//禁止左右滑动 - lv_textarea_set_text(ui->screen_machine_id, machine_ID);//设备id - lv_textarea_set_text(ui->screen_machine_name, machine_name);//设备名 + lv_textarea_set_text(ui->screen_machine_id_rt, machine_ID);//设备id + lv_textarea_set_text(ui->screen_machine_name_rt, machine_name);//设备名 }