diff --git a/src/hasp_config.cpp b/src/hasp_config.cpp index 6c35abc4..1aaafe39 100644 --- a/src/hasp_config.cpp +++ b/src/hasp_config.cpp @@ -117,6 +117,11 @@ void configGetConfig(JsonDocument & settings, bool setupdebug = false) } } + // File does not exist or error reading file + if(setupdebug) { + debugPreSetup(settings[F("debug")]); + } + configStartDebug(setupdebug, configFile); Log.error(F("CONF: Failed to load %s"), configFile.c_str()); } diff --git a/src/hasp_debug.cpp b/src/hasp_debug.cpp index fb9b89d7..7b802938 100644 --- a/src/hasp_debug.cpp +++ b/src/hasp_debug.cpp @@ -389,13 +389,15 @@ void debugPreSetup(JsonObject settings) Log.setPrefix(debugPrintPrefix); // Uncomment to get timestamps as prefix Log.setSuffix(debugPrintSuffix); // Uncomment to get newline as suffix - uint16_t baudrate = settings[FPSTR(F_CONFIG_BAUD)].as() | debugSerialBaud; - if(baudrate >= 960) { /* the baudrates are stored divided by 10 */ - Serial.begin(baudrate * 10); /* prepare for possible serial debug */ + uint32_t baudrate = settings[FPSTR(F_CONFIG_BAUD)].as() * 10; + if(baudrate == 0) baudrate = 115200u; + if(baudrate >= 9600u) { /* the baudrates are stored divided by 10 */ + Serial.begin(baudrate); /* prepare for possible serial debug */ delay(10); debugSerialStarted = true; + Serial.println(); Log.registerOutput(0, &Serial, LOG_LEVEL_VERBOSE, true); - Log.trace(F("Serial started at %u baud"), baudrate * 10); + Log.trace(F("Serial started at %u baud"), baudrate); } } diff --git a/src/hasp_wifi.cpp b/src/hasp_wifi.cpp index b2d573f3..6b2b3586 100644 --- a/src/hasp_wifi.cpp +++ b/src/hasp_wifi.cpp @@ -176,6 +176,8 @@ void wifiSetup(JsonObject settings) bool wifiEvery5Seconds() { + if(WiFi.getMode() == WIFI_AP) return true; + if(WiFi.status() == WL_CONNECTED) { return true; } else {