started working on OTA but downloading files is not functional yet

This commit is contained in:
Matthias Mitscherlich
2024-03-22 17:33:53 +01:00
parent 0fcd60ff57
commit 55c3ebbbe4
10 changed files with 531 additions and 219 deletions
+29 -2
View File
@@ -42,6 +42,7 @@
#include "clock.h"
#include "clockwordmap.h"
#include "daywordmap.h"
#include "ota.h"
// --------------------------------------------------------------------------------------------------------------------
// Constant and macro definitions
// --------------------------------------------------------------------------------------------------------------------
@@ -77,11 +78,13 @@
static TaskHandle_t loggerTaskHandle;
static TaskHandle_t otaTaskHandle;
// --------------------------------------------------------------------------------------------------------------------
// Function declarations
// --------------------------------------------------------------------------------------------------------------------
void loggerTask(void* parameters);
void otaTask(void* parameters);
// --------------------------------------------------------------------------------------------------------------------
// Function definitions
@@ -179,18 +182,31 @@ extern "C" void app_main(void)
// -----------------------------------------------------------------------------------------------------------------
// Programmable LEDs in a strip
//
ledmatrix matrix = ledmatrix(MATRIX_NMBR_ROWS, MATRIX_NMBR_COLUMS, GPIO_LED_STRIP);
// Set the matrix orientation to ROW-based, from left to right, beginning on the upside
matrix.setOrientation(ledmatrix::ORIENTATION_ROW_LEFT_UP);
// -----------------------------------------------------------------------------------------------------------------
// The clock which also handles the NTP
//
Clock clk = Clock(Clock::Mode_t::TEN_BEFORE_HALF);
// -----------------------------------------------------------------------------------------------------------------
// Wordmaps for clock(time), clock(day) and temperature
//
ClockWordmap clockwords = ClockWordmap(&matrix);
clockwords.setColour(0x80, 0x40, 0xFF);
DayWordmap daywords = DayWordmap(&matrix);
daywords.setColour(0xFF, 0x00, 0x80);
Clock clk = Clock(Clock::Mode_t::TEN_BEFORE_HALF);
// -----------------------------------------------------------------------------------------------------------------
// OTA handler
//
ota otaUpdater = ota();
// Call the OTA executable within a dedicated task and forget about it afterwards
xTaskCreate(otaTask, (const char*)"OTATask", 4000, &otaUpdater, 3, &otaTaskHandle);
std::list<std::string> clockWordlist;
@@ -223,3 +239,14 @@ void loggerTask(void* parameters)
vTaskDelay(10);
}
}
void otaTask(void* parameters)
{
ota* otaHandler = (ota*) parameters;
while (1)
{
otaHandler->task();
vTaskDelay(otaHandler->checkInterval_ms);
}
}