mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 21:26:43 +00:00
Fix wifi and serial log
This commit is contained in:
parent
36b17ef784
commit
938873b5b3
@ -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());
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user