From 1cc9d27dfd75b0ed7990ba1486feef626254f18b Mon Sep 17 00:00:00 2001 From: 01trisha Date: Mon, 23 Mar 2026 00:42:07 +0700 Subject: [PATCH] fix text --- main/gui_generated.c | 90 ++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 46 deletions(-) diff --git a/main/gui_generated.c b/main/gui_generated.c index 0cd2a52..9ff3f19 100644 --- a/main/gui_generated.c +++ b/main/gui_generated.c @@ -1974,7 +1974,7 @@ static void create_popup_readings(void) { y += 28; lbl = lv_label_create(popup_readings); - snprintf(buf, sizeof(buf), "Температура: %.1f°C", state.temp_room / 10.0f); + snprintf(buf, sizeof(buf), "Температура: %.1f°C", state.temp_room / 10.0f + config.temp_room_offset); lv_label_set_text(lbl, buf); lv_obj_set_pos(lbl, 40, y); lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_DANGER), 0); @@ -1982,7 +1982,7 @@ static void create_popup_readings(void) { y += 26; lbl = lv_label_create(popup_readings); - snprintf(buf, sizeof(buf), "Влажность: %.1f%%", state.hum_room / 10.0f); + snprintf(buf, sizeof(buf), "Влажность: %.1f%%", state.hum_room / 10.0f + config.hum_room_offset); lv_label_set_text(lbl, buf); lv_obj_set_pos(lbl, 40, y); lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_TEXT_ACCENT), 0); @@ -1998,7 +1998,7 @@ static void create_popup_readings(void) { y += 28; lbl = lv_label_create(popup_readings); - snprintf(buf, sizeof(buf), "Температура: %.1f°C", state.temp_channel / 10.0f); + snprintf(buf, sizeof(buf), "Температура: %.1f°C", state.temp_channel / 10.0f + config.temp_channel_offset); lv_label_set_text(lbl, buf); lv_obj_set_pos(lbl, 40, y); lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_DANGER), 0); @@ -2006,7 +2006,7 @@ static void create_popup_readings(void) { y += 26; lbl = lv_label_create(popup_readings); - snprintf(buf, sizeof(buf), "Влажность: %.1f%%", state.hum_channel / 10.0f); + snprintf(buf, sizeof(buf), "Влажность: %.1f%%", state.hum_channel / 10.0f + config.hum_channel_offset); lv_label_set_text(lbl, buf); lv_obj_set_pos(lbl, 40, y); lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_TEXT_ACCENT), 0); @@ -2091,19 +2091,19 @@ static void create_screen_main(void) { lv_obj_t *lbl = lv_label_create(panel_status); lv_label_set_text(lbl, "Состояние"); - lv_obj_set_pos(lbl, 10, 5); + lv_obj_set_pos(lbl, 10, 0); lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_TEXT_DIM), 0); lv_obj_set_style_text_font(lbl, &montserrat_16_ru_en, 0); lbl_room_num = lv_label_create(panel_status); lv_label_set_text(lbl_room_num, "Комната: 101"); - lv_obj_set_pos(lbl_room_num, 10, 30); + lv_obj_set_pos(lbl_room_num, 10, 25); lv_obj_set_style_text_color(lbl_room_num, lv_color_hex(COLOR_TEXT), 0); lv_obj_set_style_text_font(lbl_room_num, &montserrat_16_ru_en, 0); lbl_master_slave = lv_label_create(panel_status); lv_label_set_text(lbl_master_slave, "Мастер"); - lv_obj_set_pos(lbl_master_slave, 10, 55); + lv_obj_set_pos(lbl_master_slave, 10, 50); lv_obj_set_style_text_color(lbl_master_slave, lv_color_hex(COLOR_ACCENT), 0); lv_obj_set_style_text_font(lbl_master_slave, &montserrat_16_ru_en, 0); @@ -2114,13 +2114,13 @@ static void create_screen_main(void) { snprintf(sbuf, sizeof(sbuf), "Сезон: %s", seasons[state.season % 3]); lv_label_set_text(lbl_season, sbuf); } - lv_obj_set_pos(lbl_season, 10, 80); + lv_obj_set_pos(lbl_season, 10, 75); lv_obj_set_style_text_color(lbl_season, lv_color_hex(COLOR_TEXT_ACCENT), 0); lv_obj_set_style_text_font(lbl_season, &montserrat_16_ru_en, 0); lbl_mode = lv_label_create(panel_status); lv_label_set_text(lbl_mode, "Режим: Дежурный"); - lv_obj_set_pos(lbl_mode, 10, 105); + lv_obj_set_pos(lbl_mode, 10, 100); lv_obj_set_style_text_color(lbl_mode, lv_color_hex(COLOR_WARNING), 0); lv_obj_set_style_text_font(lbl_mode, &montserrat_16_ru_en, 0); @@ -2131,7 +2131,7 @@ static void create_screen_main(void) { state.day, state.month, state.year, state.hour, state.minute); lv_label_set_text(lbl_datetime, dt_buf); } - lv_obj_set_pos(lbl_datetime, 10, 130); + lv_obj_set_pos(lbl_datetime, 10, 125); lv_obj_set_style_text_color(lbl_datetime, lv_color_hex(COLOR_TEXT_DIM), 0); lv_obj_set_style_text_font(lbl_datetime, &montserrat_16_ru_en, 0); @@ -2146,51 +2146,51 @@ static void create_screen_main(void) { lbl = lv_label_create(panel_climate); lv_label_set_text(lbl, "Комната"); - lv_obj_set_pos(lbl, 10, 5); + lv_obj_set_pos(lbl, 10, 0); lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_TEXT_DIM), 0); lv_obj_set_style_text_font(lbl, &montserrat_16_ru_en, 0); lbl = lv_label_create(panel_climate); lv_label_set_text(lbl, "Температура:"); - lv_obj_set_pos(lbl, 10, 35); - lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_TEXT_DIM), 0); + lv_obj_set_pos(lbl, 10, 25); + lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_TEXT), 0); lv_obj_set_style_text_font(lbl, &montserrat_16_ru_en, 0); lbl_temp_room = lv_label_create(panel_climate); lv_label_set_text(lbl_temp_room, "--.-°C"); - lv_obj_set_pos(lbl_temp_room, 130, 35); + lv_obj_set_pos(lbl_temp_room, 130, 25); lv_obj_set_style_text_color(lbl_temp_room, lv_color_hex(COLOR_DANGER), 0); lv_obj_set_style_text_font(lbl_temp_room, &montserrat_16_ru_en, 0); lbl = lv_label_create(panel_climate); lv_label_set_text(lbl, "Влажность:"); - lv_obj_set_pos(lbl, 10, 65); - lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_TEXT_DIM), 0); + lv_obj_set_pos(lbl, 10, 50); + lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_TEXT), 0); lv_obj_set_style_text_font(lbl, &montserrat_16_ru_en, 0); lbl_hum_room = lv_label_create(panel_climate); lv_label_set_text(lbl_hum_room, "--.-%"); - lv_obj_set_pos(lbl_hum_room, 130, 65); + lv_obj_set_pos(lbl_hum_room, 130, 50); lv_obj_set_style_text_color(lbl_hum_room, lv_color_hex(COLOR_TEXT_ACCENT), 0); lv_obj_set_style_text_font(lbl_hum_room, &montserrat_16_ru_en, 0); /* Channel info */ lbl = lv_label_create(panel_climate); lv_label_set_text(lbl, "Канал:"); - lv_obj_set_pos(lbl, 10, 100); - lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_TEXT_DIM), 0); + lv_obj_set_pos(lbl, 10, 85); + lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_TEXT), 0); lv_obj_set_style_text_font(lbl, &montserrat_16_ru_en, 0); lbl_temp_channel = lv_label_create(panel_climate); lv_label_set_text(lbl_temp_channel, "--.-°C"); - lv_obj_set_pos(lbl_temp_channel, 70, 100); - lv_obj_set_style_text_color(lbl_temp_channel, lv_color_hex(COLOR_TEXT), 0); + lv_obj_set_pos(lbl_temp_channel, 70, 85); + lv_obj_set_style_text_color(lbl_temp_channel, lv_color_hex(COLOR_DANGER), 0); lv_obj_set_style_text_font(lbl_temp_channel, &montserrat_16_ru_en, 0); lbl_hum_channel = lv_label_create(panel_climate); lv_label_set_text(lbl_hum_channel, "--%"); - lv_obj_set_pos(lbl_hum_channel, 150, 100); - lv_obj_set_style_text_color(lbl_hum_channel, lv_color_hex(COLOR_TEXT), 0); + lv_obj_set_pos(lbl_hum_channel, 150, 85); + lv_obj_set_style_text_color(lbl_hum_channel, lv_color_hex(COLOR_TEXT_ACCENT), 0); lv_obj_set_style_text_font(lbl_hum_channel, &montserrat_16_ru_en, 0); /* === CONTROL BUTTONS === (правая часть нижней половины) */ @@ -2467,7 +2467,7 @@ static void create_screen_screen2(void) { /* Alarm entry container */ lv_obj_t *entry_cont = lv_obj_create(log_panel); lv_obj_set_pos(entry_cont, 5, y); - lv_obj_set_size(entry_cont, 740, 75); + lv_obj_set_size(entry_cont, 710, 75); lv_obj_set_style_bg_color(entry_cont, lv_color_hex(COLOR_BG_BTN), 0); lv_obj_set_style_radius(entry_cont, 6, 0); lv_obj_set_style_border_width(entry_cont, 1, 0); @@ -2479,7 +2479,7 @@ static void create_screen_screen2(void) { snprintf(buf, sizeof(buf), "%s %s", alarm_log[i].message, alarm_log[i].timestamp); lbl = lv_label_create(entry_cont); lv_label_set_text(lbl, buf); - lv_obj_set_pos(lbl, 10, 8); + lv_obj_set_pos(lbl, 5, 8); lv_obj_set_width(lbl, 550); lv_label_set_long_mode(lbl, LV_LABEL_LONG_CLIP); if (alarm_log[i].active) { @@ -2494,19 +2494,19 @@ static void create_screen_screen2(void) { /* Show confirmed status */ lbl = lv_label_create(entry_cont); lv_label_set_text(lbl, "Подтверждено"); - lv_obj_set_pos(lbl, 580, 10); + lv_obj_set_pos(lbl, 550, 0); lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_ACCENT), 0); lv_obj_set_style_text_font(lbl, &montserrat_16_ru_en, 0); lbl = lv_label_create(entry_cont); lv_label_set_text(lbl, alarm_log[i].confirm_timestamp); - lv_obj_set_pos(lbl, 580, 35); + lv_obj_set_pos(lbl, 550, 25); lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_TEXT_DIM), 0); lv_obj_set_style_text_font(lbl, &montserrat_16_ru_en, 0); } else { /* Confirm button - centered vertically */ lv_obj_t *btn_confirm = lv_btn_create(entry_cont); - lv_obj_set_pos(btn_confirm, 580, 17); + lv_obj_set_pos(btn_confirm, 550, 0); lv_obj_set_size(btn_confirm, 130, 40); lv_obj_set_style_bg_color(btn_confirm, lv_color_hex(COLOR_BG_MODULE), 0); lv_obj_set_style_radius(btn_confirm, 4, 0); @@ -2611,7 +2611,7 @@ static void create_screen_screen3(void) { /* Left panel - Work mode - NO SCROLL, with pagination */ lv_obj_t *panel_work = lv_obj_create(scr); lv_obj_set_pos(panel_work, 15, 40); - lv_obj_set_size(panel_work, 380, 270); + lv_obj_set_size(panel_work, 380, 285); lv_obj_set_style_bg_color(panel_work, lv_color_hex(COLOR_BG_PANEL), 0); lv_obj_set_style_radius(panel_work, 6, 0); lv_obj_set_style_border_width(panel_work, 0, 0); @@ -2801,7 +2801,7 @@ static void create_screen_screen3(void) { /* Right panel - Standby mode - NO SCROLL, with pagination */ lv_obj_t *panel_standby = lv_obj_create(scr); lv_obj_set_pos(panel_standby, 405, 40); - lv_obj_set_size(panel_standby, 380, 270); + lv_obj_set_size(panel_standby, 380, 285); lv_obj_set_style_bg_color(panel_standby, lv_color_hex(COLOR_BG_PANEL), 0); lv_obj_set_style_radius(panel_standby, 6, 0); lv_obj_set_style_border_width(panel_standby, 0, 0); @@ -2989,35 +2989,29 @@ static void create_screen_screen3(void) { /* Common parameters section */ lv_obj_t *panel_common = lv_obj_create(scr); - lv_obj_set_pos(panel_common, 15, 320); + lv_obj_set_pos(panel_common, 15, 335); lv_obj_set_size(panel_common, 770, 60); lv_obj_set_style_bg_color(panel_common, lv_color_hex(COLOR_BG_PANEL), 0); lv_obj_set_style_radius(panel_common, 6, 0); lv_obj_set_style_border_width(panel_common, 0, 0); lv_obj_clear_flag(panel_common, LV_OBJ_FLAG_SCROLLABLE); - lbl = lv_label_create(panel_common); - lv_label_set_text(lbl, "Общие:"); - lv_obj_set_pos(lbl, 10, 3); - lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_TEXT_DIM), 0); - lv_obj_set_style_text_font(lbl, &montserrat_16_ru_en, 0); - snprintf(buf, sizeof(buf), "Фильтр G4: %s", filter_g4_date); lbl = lv_label_create(panel_common); lv_label_set_text(lbl, buf); - lv_obj_set_pos(lbl, 10, 28); + lv_obj_set_pos(lbl, 10, 0); lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_TEXT), 0); lv_obj_set_style_text_font(lbl, &montserrat_16_ru_en, 0); snprintf(buf, sizeof(buf), "Фильтр H13: %s", filter_h13_date); lbl = lv_label_create(panel_common); lv_label_set_text(lbl, buf); - lv_obj_set_pos(lbl, 250, 28); + lv_obj_set_pos(lbl, 250, 0); lv_obj_set_style_text_color(lbl, lv_color_hex(COLOR_TEXT), 0); lv_obj_set_style_text_font(lbl, &montserrat_16_ru_en, 0); /* Buttons row */ - int btn_y = 395; + int btn_y = 410; btn = lv_btn_create(scr); lv_obj_set_pos(btn, 200, btn_y); @@ -3408,23 +3402,23 @@ void gui_update_values(void) { /* Update room climate */ if (lbl_temp_room) { - snprintf(buf, sizeof(buf), "%.1f°C", state.temp_room / 10.0f); + snprintf(buf, sizeof(buf), "%.1f°C", state.temp_room / 10.0f + config.temp_room_offset); lv_label_set_text(lbl_temp_room, buf); } if (lbl_hum_room) { - snprintf(buf, sizeof(buf), "%.1f%%", state.hum_room / 10.0f); + snprintf(buf, sizeof(buf), "%.1f%%", state.hum_room / 10.0f + config.hum_room_offset); lv_label_set_text(lbl_hum_room, buf); } /* Update channel climate */ if (lbl_temp_channel) { - snprintf(buf, sizeof(buf), "%.1f°C", state.temp_channel / 10.0f); + snprintf(buf, sizeof(buf), "%.1f°C", state.temp_channel / 10.0f + config.temp_channel_offset); lv_label_set_text(lbl_temp_channel, buf); } if (lbl_hum_channel) { - snprintf(buf, sizeof(buf), "%.1f%%", state.hum_channel / 10.0f); + snprintf(buf, sizeof(buf), "%.1f%%", state.hum_channel / 10.0f + config.hum_channel_offset); lv_label_set_text(lbl_hum_channel, buf); } @@ -3531,7 +3525,9 @@ static void update_module_display(int module_idx) { break; case MODULE_CHANNEL: /* Display channel temperature and humidity */ - snprintf(buf, sizeof(buf), "%.1f°\n%.0f%%", state.temp_channel / 10.0f, state.hum_channel / 10.0f); + snprintf(buf, sizeof(buf), "%.1f°\n%.0f%%", + state.temp_channel / 10.0f + config.temp_channel_offset, + state.hum_channel / 10.0f + config.hum_channel_offset); lv_label_set_text(modules[module_idx].label_value, buf); break; } @@ -3587,7 +3583,9 @@ static void update_settings_module_display(int module_idx) { break; case MODULE_CHANNEL: /* Display channel temperature and humidity */ - snprintf(buf, sizeof(buf), "%.1f°\n%.0f%%", state.temp_channel / 10.0f, state.hum_channel / 10.0f); + snprintf(buf, sizeof(buf), "%.1f°\n%.0f%%", + state.temp_channel / 10.0f + config.temp_channel_offset, + state.hum_channel / 10.0f + config.hum_channel_offset); lv_label_set_text(settings_module_label_value[module_idx], buf); break; }