diff --git a/platformio.ini b/platformio.ini index 5f99757..b68c953 100644 --- a/platformio.ini +++ b/platformio.ini @@ -36,8 +36,11 @@ build_flags = -Wl,--wrap=esp_ota_mark_app_valid_cancel_rollback ; Enable LVGL simple include -DLV_CONF_INCLUDE_SIMPLE - ; FTP server storage type: SD_MMC - -DDEFAULT_STORAGE_TYPE_ESP32=STORAGE_SD_MMC + ; FTP server: must define BOTH network + storage with numeric values + ; to prevent FtpServerKey.h from defaulting to FFAT + ; NETWORK_ESP32=6, STORAGE_SD_MMC=10 + -DDEFAULT_FTP_SERVER_NETWORK_TYPE_ESP32=6 + -DDEFAULT_STORAGE_TYPE_ESP32=10 ; Suppress deprecation warnings -Wno-deprecated-declarations ; Allow #warning without failing build diff --git a/src/lv_conf.h b/src/lv_conf.h index 75ae942..658e9f7 100644 --- a/src/lv_conf.h +++ b/src/lv_conf.h @@ -16,7 +16,7 @@ *=========================*/ #define LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN #define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN -#define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN +#define LV_USE_STDLIB_SPRINTF LV_STDLIB_CLIB #define LV_MEM_SIZE (48U * 1024U) diff --git a/src/ui.cpp b/src/ui.cpp index fc1e3e9..a1c2e13 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -187,11 +187,21 @@ void ui_init() /* ────────────────────────────────────────────────────────────── */ /* CLOCK AREA (y = 385 … 490) */ /* ────────────────────────────────────────────────────────────── */ - lbl_time = make_label(scr, &lv_font_montserrat_40, CLR_WHITE, - LV_ALIGN_TOP_MID, 0, 398, "--:--"); + lbl_time = lv_label_create(scr); + lv_label_set_text(lbl_time, "--:--:--"); + lv_obj_set_style_text_font(lbl_time, &lv_font_montserrat_40, 0); + lv_obj_set_style_text_color(lbl_time, lv_color_hex(CLR_WHITE), 0); + lv_obj_set_width(lbl_time, SCR_W); + lv_obj_set_style_text_align(lbl_time, LV_TEXT_ALIGN_CENTER, 0); + lv_obj_align(lbl_time, LV_ALIGN_TOP_MID, 0, 398); - lbl_date = make_label(scr, &lv_font_montserrat_18, CLR_GRAY, - LV_ALIGN_TOP_MID, 0, 456, "--- --, ----"); + lbl_date = lv_label_create(scr); + lv_label_set_text(lbl_date, "--- --, ----"); + lv_obj_set_style_text_font(lbl_date, &lv_font_montserrat_18, 0); + lv_obj_set_style_text_color(lbl_date, lv_color_hex(CLR_GRAY), 0); + lv_obj_set_width(lbl_date, SCR_W); + lv_obj_set_style_text_align(lbl_date, LV_TEXT_ALIGN_CENTER, 0); + lv_obj_align(lbl_date, LV_ALIGN_TOP_MID, 0, 456); /* ────────────────────────────────────────────────────────────── */ /* ERROR OVERLAY (hidden by default) */ @@ -281,10 +291,14 @@ void ui_set_sd(uint64_t used_mb, uint64_t total_mb) } lv_bar_set_value(bar_sd, pct, LV_ANIM_OFF); - float used_gb = used_mb / 1024.0f; - float total_gb = total_mb / 1024.0f; - lv_label_set_text_fmt(lbl_sd_info, "%.1f / %.1f GB", - (double)used_gb, (double)total_gb); + /* Format with one decimal using integer math (LVGL builtin sprintf + may lack %f support) */ + uint32_t used_gb_i = (uint32_t)(used_mb / 1024); + uint32_t used_gb_f = (uint32_t)((used_mb % 1024) * 10 / 1024); + uint32_t total_gb_i = (uint32_t)(total_mb / 1024); + uint32_t total_gb_f = (uint32_t)((total_mb % 1024) * 10 / 1024); + lv_label_set_text_fmt(lbl_sd_info, "%lu.%lu / %lu.%lu GB", + used_gb_i, used_gb_f, total_gb_i, total_gb_f); lv_label_set_text_fmt(lbl_sd_pct, "%d%%", pct); /* bar turns red when storage > 90% */