This commit is contained in:
2026-04-11 00:40:33 +02:00
parent eaeb515074
commit d41a99ee88
4 changed files with 95 additions and 6 deletions

View File

@@ -14,6 +14,7 @@
#include <datasave.h>
#include <webserver.h>
#include <ui.h>
#include <led.h>
// Defines to enable channel B
#define CH_B_ENABLE
@@ -76,6 +77,8 @@ void setup()
void loop()
{
// global variables
RGBled led;
led.setStatus(RGBled::LedStatus::INIT);
bool running = true;
const uint32_t max_queue = 128;
const uint32_t filter_k = 10;
@@ -219,6 +222,7 @@ void loop()
}
LOG_DEBUG("Real Time Tasks A & B initialized");
led.setStatus(RGBled::LedStatus::OK);
bool partial_save = false; // flag to indicate if a partial save has been done after a timeout
auto last_data = millis();
@@ -238,7 +242,7 @@ void loop()
WebPage webPage(80, LittleFS); // Initialize webserver and Websocket
//////////////// INNER LOOP /////////////////////
while (running)
while (running)
{
auto dataA = pdFALSE;
auto dataB = pdFALSE;
@@ -264,9 +268,15 @@ void loop()
#endif
// Update last data
if (dataA == pdTRUE || dataB == pdTRUE)
{
last_data = millis();
}
// Update Led color
if (dataA == pdTRUE && dataB == pdFALSE)
led.setStatus(RGBled::DATA_A);
else if (dataB == pdTRUE && dataA == pdFALSE)
led.setStatus(RGBled::DATA_B);
else
led.setStatus(RGBled::DATA_ALL);
if (dataA == pdTRUE)
{
@@ -314,17 +324,17 @@ void loop()
partial_save = true;
first_save = true;
}
//Serial.printf("[%d] Waiting for data...\r", wait_count++);
// Serial.printf("[%d] Waiting for data...\r", wait_count++);
led.setStatus(RGBled::LedStatus::IDLE);
delay(100);
}
if ((millis() - last_info) > 1000)
{
clearScreen();
Serial.println();
printRunningTasksMod(Serial);
last_info = millis();
}
} //////////////// INNER LOOP /////////////////////