Changed OTA to write Directly to flash
This commit is contained in:
@@ -26,9 +26,13 @@
|
||||
#include <functional>
|
||||
#include <time.h>
|
||||
#include "../FileManager/FileManager.hpp"
|
||||
#include "../Telemetry/Telemetry.hpp"
|
||||
#include "../TimeKeeper/TimeKeeper.hpp"
|
||||
|
||||
class ConfigManager; // Forward declaration
|
||||
class Player; // Forward declaration for idle check
|
||||
class ConfigManager; // Forward declaration
|
||||
class Player; // Forward declaration for idle check
|
||||
class Timekeeper; // Forward declaration for freeze mode
|
||||
class Telemetry; // Forward declaration for freeze mode
|
||||
|
||||
class OTAManager {
|
||||
public:
|
||||
@@ -66,7 +70,9 @@ public:
|
||||
|
||||
void begin();
|
||||
void setFileManager(FileManager* fm);
|
||||
void setPlayer(Player* player); // NEW: Set player reference for idle check
|
||||
void setPlayer(Player* player); // Set player reference for idle check
|
||||
void setTimeKeeper(Timekeeper* tk); // Set timekeeper reference for freeze mode
|
||||
void setTelemetry(Telemetry* telemetry); // Set telemetry reference for freeze mode
|
||||
|
||||
void checkForUpdates();
|
||||
void checkForUpdates(const String& channel); // Check specific channel
|
||||
@@ -104,7 +110,9 @@ public:
|
||||
private:
|
||||
ConfigManager& _configManager;
|
||||
FileManager* _fileManager;
|
||||
Player* _player; // NEW: Player reference for idle check
|
||||
Player* _player; // Player reference for idle check
|
||||
Timekeeper* _timeKeeper; // TimeKeeper reference for freeze mode
|
||||
Telemetry* _telemetry; // Telemetry reference for freeze mode
|
||||
Status _status;
|
||||
ErrorCode _lastError;
|
||||
uint16_t _availableVersion;
|
||||
@@ -127,6 +135,19 @@ private:
|
||||
TimerHandle_t _initialCheckTimer;
|
||||
static void initialCheckCallback(TimerHandle_t xTimer);
|
||||
void performInitialCheck(); // Async initial check after boot
|
||||
|
||||
// Worker task for OTA operations (prevents stack overflow in timer callbacks)
|
||||
TaskHandle_t _otaWorkerTask;
|
||||
SemaphoreHandle_t _otaWorkSignal;
|
||||
static void otaWorkerTaskFunction(void* parameter);
|
||||
void otaWorkerLoop();
|
||||
|
||||
enum class OTAWorkType {
|
||||
NONE,
|
||||
INITIAL_CHECK,
|
||||
SCHEDULED_CHECK
|
||||
};
|
||||
OTAWorkType _pendingWork;
|
||||
|
||||
void setStatus(Status status, ErrorCode error = ErrorCode::NONE);
|
||||
void notifyProgress(size_t current, size_t total);
|
||||
@@ -135,7 +156,8 @@ private:
|
||||
bool checkChannelsMetadata();
|
||||
bool downloadAndInstall();
|
||||
bool downloadAndInstall(const String& channel);
|
||||
bool downloadToSD(const String& url, const String& expectedChecksum, size_t expectedSize); // NEW: Added size param
|
||||
bool downloadDirectToFlash(const String& url, size_t expectedSize); // NEW: Direct to flash (bypasses SD)
|
||||
bool downloadToSD(const String& url, const String& expectedChecksum, size_t expectedSize); // OLD: Via SD card
|
||||
bool verifyChecksum(const String& filePath, const String& expectedChecksum);
|
||||
String calculateSHA256(const String& filePath);
|
||||
bool installFromSD(const String& filePath);
|
||||
|
||||
Reference in New Issue
Block a user