Minor tweaks

This commit is contained in:
fvanroie 2023-02-14 03:55:07 +01:00
parent 8bd001ccb0
commit 303cd45a11
5 changed files with 14 additions and 10 deletions

View File

@ -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
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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: