2024-09-11 15:40:44 +00:00
|
|
|
#pragma once
|
|
|
|
|
2023-11-10 22:18:14 +00:00
|
|
|
#include <Arduino.h>
|
|
|
|
#include <ArduinoOTA.h>
|
|
|
|
|
2023-11-30 21:56:50 +00:00
|
|
|
#include "lib/config.hpp"
|
|
|
|
#include "lib/shared.hpp"
|
|
|
|
|
2024-09-11 15:40:44 +00:00
|
|
|
#ifndef UPDATE_MESSAGE_HPP
|
|
|
|
#define UPDATE_MESSAGE_HPP
|
|
|
|
typedef struct {
|
|
|
|
char updateType;
|
|
|
|
} UpdateMessage;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern QueueHandle_t otaQueue;
|
|
|
|
|
2023-11-10 22:18:14 +00:00
|
|
|
void setupOTA();
|
|
|
|
void onOTAStart();
|
2023-11-12 11:38:28 +00:00
|
|
|
void handleOTATask(void *parameter);
|
2023-11-12 23:33:48 +00:00
|
|
|
void onOTAProgress(unsigned int progress, unsigned int total);
|
2024-09-11 01:23:41 +00:00
|
|
|
// void downloadUpdate();
|
2023-11-13 00:02:01 +00:00
|
|
|
void onOTAError(ota_error_t error);
|
2023-11-30 21:56:50 +00:00
|
|
|
void onOTAComplete();
|
2024-09-11 15:40:44 +00:00
|
|
|
int downloadUpdateHandler(char updateType);
|
|
|
|
String getLatestRelease(const String& fileToDownload);
|
|
|
|
|
|
|
|
bool getIsOTAUpdating();
|
2024-06-29 00:19:25 +00:00
|
|
|
|
2024-09-11 15:40:44 +00:00
|
|
|
void updateWebUi(String latestRelease, int command);
|
|
|
|
String downloadSHA256(const String& filename);
|