diff --git a/src/config/settings.h b/src/config/settings.h index cc91f5f1..ea864ede 100644 --- a/src/config/settings.h +++ b/src/config/settings.h @@ -107,15 +107,21 @@ class settings { DPRINTLN(DBG_INFO, F("Initializing FS ..")); mValid = false; + #if !defined(ESP32) + LittleFSConfig cfg; + cfg.setAutoFormat(false); + LittleFS.setConfig(cfg); + #define LITTLFS_TRUE + #define LITTLFS_FALSE + #else + #define LITTLFS_TRUE true + #define LITTLFS_FALSE false + #endif - LittleFSConfig cfg; - cfg.setAutoFormat(false); - LittleFS.setConfig(cfg); - - if(!LittleFS.begin()) { + if(!LittleFS.begin(LITTLFS_FALSE)) { DPRINTLN(DBG_INFO, F(".. format ..")); LittleFS.format(); - if(LittleFS.begin()) + if(LittleFS.begin(LITTLFS_TRUE)) DPRINTLN(DBG_INFO, F(".. success")); else DPRINTLN(DBG_INFO, F(".. failed")); @@ -142,13 +148,17 @@ class settings { } void getInfo(uint32_t *used, uint32_t *size) { - FSInfo info; - LittleFS.info(info); - *used = info.usedBytes; - *size = info.totalBytes; + #if !defined(ESP32) + FSInfo info; + LittleFS.info(info); + *used = info.usedBytes; + *size = info.totalBytes; - DPRINTLN(DBG_INFO, F("-- FILESYSTEM INFO --")); - DPRINTLN(DBG_INFO, String(info.usedBytes) + F(" of ") + String(info.totalBytes) + F(" used")); + DPRINTLN(DBG_INFO, F("-- FILESYSTEM INFO --")); + DPRINTLN(DBG_INFO, String(info.usedBytes) + F(" of ") + String(info.totalBytes) + F(" used")); + #else + DPRINTLN(DBG_WARN, F("not supported by ESP32")); + #endif } void readSettings(void) { diff --git a/src/wifi/ahoywifi.cpp b/src/wifi/ahoywifi.cpp index caf2007e..8ba34529 100644 --- a/src/wifi/ahoywifi.cpp +++ b/src/wifi/ahoywifi.cpp @@ -87,8 +87,11 @@ bool ahoywifi::loop(void) { DPRINTLN(DBG_INFO, String(cnt) + F(" client connected (no timeout)")); mNextTryTs = (millis() + (WIFI_AP_ACTIVE_TIME * 1000)); } - else - DPRINTLN(DBG_INFO, F("AP will be closed in ") + String((mNextTryTs - mApLastTick) / 1000) + F(" seconds")); + else { + DBGPRINT(F("AP will be closed in ")); + DBGPRINT(String((mNextTryTs - mApLastTick) / 1000)); + DBGPRINTLN(F(" seconds")); + } } } #endif @@ -110,12 +113,14 @@ void ahoywifi::setupAp(const char *ssid, const char *pwd) { DPRINTLN(DBG_VERBOSE, F("app::setupAp")); IPAddress apIp(192, 168, 4, 1); - DPRINTLN(DBG_INFO, F("\n---------\nAP MODE\nSSID: ") - + String(ssid) + F("\nPWD: ") - + String(pwd) + F("\nActive for: ") - + String(WIFI_AP_ACTIVE_TIME) + F(" seconds") - + F("\n---------\n")); - DPRINTLN(DBG_DEBUG, String(mNextTryTs)); + DBGPRINT(F("\n---------\nAP MODE\nSSID: ")); + DBGPRINTLN(ssid); + DBGPRINT(F("PWD: ")); + DBGPRINTLN(pwd); + DBGPRINT(F("\nActive for: ")); + DBGPRINT(String(WIFI_AP_ACTIVE_TIME)); + DBGPRINTLN(F(" seconds")); + DBGPRINTLN(F("\n---------\n")); WiFi.mode(WIFI_AP); WiFi.softAPConfig(apIp, apIp, IPAddress(255, 255, 255, 0)); @@ -153,13 +158,15 @@ bool ahoywifi::setupStation(uint32_t timeout) { WiFi.hostname(mConfig->sys.deviceName); delay(2000); - DPRINTLN(DBG_INFO, F("connect to network '") + String(mConfig->sys.stationSsid) + F("' ...")); + DBGPRINT(F("connect to network '")); + DBGPRINT(mConfig->sys.stationSsid); + DBGPRINTLN(F("' ...")); while (WiFi.status() != WL_CONNECTED) { delay(100); if(cnt % 40 == 0) - Serial.println("."); + DBGPRINTLN("."); else - Serial.print("."); + DBGPRINT("."); if(timeout > 0) { // limit == 0 -> no limit if(--cnt <= 0) {