Fix wifi and serial log

This commit is contained in:
fvanroie 2020-03-31 22:40:43 +02:00
parent 36b17ef784
commit 938873b5b3
3 changed files with 13 additions and 4 deletions

View File

@ -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());
}

View File

@ -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<uint16_t>() | 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<uint32_t>() * 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);
}
}

View File

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