reenabled ota and logs to TCP ocnnection port 9876

This commit is contained in:
Emanuele Trabattoni
2025-08-29 21:30:38 +02:00
parent f9c5ab86ef
commit cde86a7f99
3 changed files with 14 additions and 3 deletions

View File

@@ -23,8 +23,8 @@ build_type = release
board_build.filesystem = ffat board_build.filesystem = ffat
board_build.partitions = fatfs_partition.csv ; se stai usando uno custom board_build.partitions = fatfs_partition.csv ; se stai usando uno custom
#upload_protocol = espota upload_protocol = espota
#upload_port = 10.0.2.139 upload_port = 10.0.2.139
[env:esp32-s3-waveshare8-debug] [env:esp32-s3-waveshare8-debug]

View File

@@ -237,7 +237,7 @@ const bool Cron::processEvents()
LOG_INFO("Cron skipping INACTIVE event [", eventName.c_str(), "] next execution time [", drivers::PCF85063::tm2str(eventParams.next).c_str(), "]"); LOG_INFO("Cron skipping INACTIVE event [", eventName.c_str(), "] next execution time [", drivers::PCF85063::tm2str(eventParams.next).c_str(), "]");
break; break;
case CronStatus::SKIP: case CronStatus::SKIP:
LOG_INFO("Cron skipping 1 time ACTIVE event [", eventName.c_str(), "] next execution time [", drivers::PCF85063::tm2str(eventParams.next).c_str(), "]"); LOG_INFO("Cron skipping one time ACTIVE event [", eventName.c_str(), "] next execution time [", drivers::PCF85063::tm2str(eventParams.next).c_str(), "]");
eventParams.status = CronStatus::ACTIVE; eventParams.status = CronStatus::ACTIVE;
break; break;
default: default:

View File

@@ -36,6 +36,7 @@ void loop()
uint16_t k(0); uint16_t k(0);
uint8_t sensors(0); uint8_t sensors(0);
bool buzzing(false); bool buzzing(false);
NetworkClient logStream;
//////////////// DEVICES //////////////// //////////////// DEVICES ////////////////
// Declared here to keep devices local to the main loop otherwise the kernel crashes // // Declared here to keep devices local to the main loop otherwise the kernel crashes //
@@ -129,6 +130,7 @@ void loop()
if (!eth.isConnected()) if (!eth.isConnected())
{ {
led.setColor(led.COLOR_RED); led.setColor(led.COLOR_RED);
logStream.stop();
return; return;
} }
if (io.digitalInRead(DI::OTAENABLE)) // Initialize OTA, BLUE if (io.digitalInRead(DI::OTAENABLE)) // Initialize OTA, BLUE
@@ -146,6 +148,7 @@ void loop()
time_t ntpTime; time_t ntpTime;
uint8_t timeRetries(0); uint8_t timeRetries(0);
uint8_t mqttRetries(0); uint8_t mqttRetries(0);
uint8_t logStreamRetries(0);
while (timeRetries++ < conf.m_ntpRetries) while (timeRetries++ < conf.m_ntpRetries)
{ {
eth.setNtpTimeOffset(conf.m_ntpTimezone); eth.setNtpTimeOffset(conf.m_ntpTimezone);
@@ -173,6 +176,14 @@ void loop()
} }
delay(250); delay(250);
} }
while (logStreamRetries++ < conf.m_mqttRetries)
{
if (logStream.connect(conf.m_mqttHost.c_str(), 9876))
{
LOG_ATTACH_STREAM(logStream);
break;
}
}
}); });
//////////////////////////////////////// ////////////////////////////////////////