mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 13:46:36 +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);
|
configStartDebug(setupdebug, configFile);
|
||||||
Log.error(F("CONF: Failed to load %s"), configFile.c_str());
|
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.setPrefix(debugPrintPrefix); // Uncomment to get timestamps as prefix
|
||||||
Log.setSuffix(debugPrintSuffix); // Uncomment to get newline as suffix
|
Log.setSuffix(debugPrintSuffix); // Uncomment to get newline as suffix
|
||||||
|
|
||||||
uint16_t baudrate = settings[FPSTR(F_CONFIG_BAUD)].as<uint16_t>() | debugSerialBaud;
|
uint32_t baudrate = settings[FPSTR(F_CONFIG_BAUD)].as<uint32_t>() * 10;
|
||||||
if(baudrate >= 960) { /* the baudrates are stored divided by 10 */
|
if(baudrate == 0) baudrate = 115200u;
|
||||||
Serial.begin(baudrate * 10); /* prepare for possible serial debug */
|
if(baudrate >= 9600u) { /* the baudrates are stored divided by 10 */
|
||||||
|
Serial.begin(baudrate); /* prepare for possible serial debug */
|
||||||
delay(10);
|
delay(10);
|
||||||
debugSerialStarted = true;
|
debugSerialStarted = true;
|
||||||
|
Serial.println();
|
||||||
Log.registerOutput(0, &Serial, LOG_LEVEL_VERBOSE, true);
|
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()
|
bool wifiEvery5Seconds()
|
||||||
{
|
{
|
||||||
|
if(WiFi.getMode() == WIFI_AP) return true;
|
||||||
|
|
||||||
if(WiFi.status() == WL_CONNECTED) {
|
if(WiFi.status() == WL_CONNECTED) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user