reenabled ota and logs to TCP ocnnection port 9876
This commit is contained in:
11
src/main.cpp
11
src/main.cpp
@@ -36,6 +36,7 @@ void loop()
|
||||
uint16_t k(0);
|
||||
uint8_t sensors(0);
|
||||
bool buzzing(false);
|
||||
NetworkClient logStream;
|
||||
|
||||
//////////////// DEVICES ////////////////
|
||||
// Declared here to keep devices local to the main loop otherwise the kernel crashes //
|
||||
@@ -129,6 +130,7 @@ void loop()
|
||||
if (!eth.isConnected())
|
||||
{
|
||||
led.setColor(led.COLOR_RED);
|
||||
logStream.stop();
|
||||
return;
|
||||
}
|
||||
if (io.digitalInRead(DI::OTAENABLE)) // Initialize OTA, BLUE
|
||||
@@ -146,6 +148,7 @@ void loop()
|
||||
time_t ntpTime;
|
||||
uint8_t timeRetries(0);
|
||||
uint8_t mqttRetries(0);
|
||||
uint8_t logStreamRetries(0);
|
||||
while (timeRetries++ < conf.m_ntpRetries)
|
||||
{
|
||||
eth.setNtpTimeOffset(conf.m_ntpTimezone);
|
||||
@@ -173,6 +176,14 @@ void loop()
|
||||
}
|
||||
delay(250);
|
||||
}
|
||||
while (logStreamRetries++ < conf.m_mqttRetries)
|
||||
{
|
||||
if (logStream.connect(conf.m_mqttHost.c_str(), 9876))
|
||||
{
|
||||
LOG_ATTACH_STREAM(logStream);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user