From 303cd45a11c1b6d841a8dacf30a78e6f5bd1a0d5 Mon Sep 17 00:00:00 2001 From: fvanroie Date: Tue, 14 Feb 2023 03:55:07 +0100 Subject: [PATCH] Minor tweaks --- src/hasp/hasp.cpp | 2 ++ src/hasp_config.cpp | 12 ++++++------ src/sys/net/hasp_time.cpp | 1 + src/sys/net/hasp_wifi.cpp | 7 ++++--- tools/auto_firmware_version.py | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/hasp/hasp.cpp b/src/hasp/hasp.cpp index 595a34da..dc89fc19 100644 --- a/src/hasp/hasp.cpp +++ b/src/hasp/hasp.cpp @@ -763,6 +763,7 @@ void hasp_get_info(JsonDocument& doc) } #endif +#if LV_MEM_CUSTOM == 0 info = doc.createNestedObject(F(D_INFO_LVGL_MEMORY)); lv_mem_monitor_t mem_mon; lv_mem_monitor(&mem_mon); @@ -771,6 +772,7 @@ void hasp_get_info(JsonDocument& doc) Parser::format_bytes(mem_mon.free_size, size_buf, sizeof(size_buf)); info[F(D_INFO_FREE_MEMORY)] = size_buf; info[F(D_INFO_FRAGMENTATION)] = std::to_string(mem_mon.frag_pct) + "%"; +#endif } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/hasp_config.cpp b/src/hasp_config.cpp index f029de43..cb091b9e 100644 --- a/src/hasp_config.cpp +++ b/src/hasp_config.cpp @@ -1,4 +1,4 @@ -/* MIT License - Copyright (c) 2019-2022 Francis Van Roie +/* MIT License - Copyright (c) 2019-2023 Francis Van Roie For full license information read the LICENSE file in the project folder */ #if HASP_USE_CONFIG > 0 @@ -147,11 +147,11 @@ DeserializationError configParseFile(String& configFile, JsonDocument& settings) DeserializationError result; if(file) { - size_t size = file.size(); - if(size > 1024) { - LOG_ERROR(TAG_CONF, F("Config file size is too large")); - return DeserializationError::NoMemory; - } + // size_t size = file.size(); + // if(size > 1024) { + // LOG_ERROR(TAG_CONF, F("Config file size is too large")); + // return DeserializationError::NoMemory; + // } result = deserializeJson(settings, file); file.close(); return result; diff --git a/src/sys/net/hasp_time.cpp b/src/sys/net/hasp_time.cpp index 2a6d566b..6f445c8a 100644 --- a/src/sys/net/hasp_time.cpp +++ b/src/sys/net/hasp_time.cpp @@ -54,6 +54,7 @@ void timeSetup() #endif } +// https://github.com/nayarsystems/posix_tz_db String time_zone_to_possix(const char* timezone) { #if defined(ARDUINO_ARCH_ESP32) diff --git a/src/sys/net/hasp_wifi.cpp b/src/sys/net/hasp_wifi.cpp index 37902193..6f209f03 100644 --- a/src/sys/net/hasp_wifi.cpp +++ b/src/sys/net/hasp_wifi.cpp @@ -429,7 +429,7 @@ static void wifiReconnect(void) #elif defined(ARDUINO_ARCH_ESP32) // https://github.com/espressif/arduino-esp32/issues/3438#issuecomment-721428310 - WiFi.persistent(true); + WiFi.persistent(false); WiFi.disconnect(true); WiFi.setHostname(haspDevice.get_hostname()); WiFi.setSleep(false); @@ -502,11 +502,12 @@ void wifiSetup() WiFi.onEvent(wifi_callback); Preferences preferences; - nvs_user_begin(preferences,"wifi", true); + nvs_user_begin(preferences, "wifi", true); String password = preferences.getString(FP_CONFIG_PASS, WIFI_PASSWORD); strncpy(wifiPassword, password.c_str(), sizeof(wifiPassword)); LOG_DEBUG(TAG_WIFI, F(D_BULLET "Read %s => %s (%d bytes)"), FP_CONFIG_PASS, password.c_str(), password.length()); + preferences.end(); #endif wifiReconnect(); @@ -685,7 +686,7 @@ bool wifiGetConfig(const JsonObject& settings) bool wifiSetConfig(const JsonObject& settings) { Preferences preferences; - nvs_user_begin(preferences,"wifi", false); + nvs_user_begin(preferences, "wifi", false); configOutput(settings, TAG_WIFI); bool changed = false; diff --git a/tools/auto_firmware_version.py b/tools/auto_firmware_version.py index 9a80b0d0..f0a3d901 100644 --- a/tools/auto_firmware_version.py +++ b/tools/auto_firmware_version.py @@ -37,7 +37,7 @@ env.Append( r = Repo('.') commit_hash = r.head().decode("utf-8")[0:7] -with open("data/editor.htm", "r", encoding="utf-8") as f: +with open("data/edit.htm", "r", encoding="utf-8") as f: html=f.read() html = html.replace("COMMIT_HASH", commit_hash) with gzip.open('data/static/edit.htm.gz', 'wb') as f: