Added Reboot and Manual FW Update commands

This commit is contained in:
2025-12-29 20:12:54 +02:00
parent db57b355b9
commit 953b5bd07d
4 changed files with 160 additions and 0 deletions

View File

@@ -701,6 +701,54 @@ bool OTAManager::performManualUpdate(const String& channel) {
return installFromSD("/firmware/staged_update.bin");
}
// ════════════════════════════════════════════════════════════════════════════
// CUSTOM FIRMWARE UPDATE
// ════════════════════════════════════════════════════════════════════════════
bool OTAManager::performCustomUpdate(const String& firmwareUrl, const String& checksum, size_t fileSize) {
if (_status != Status::IDLE) {
LOG_WARNING("OTA update already in progress");
return false;
}
// Check if player is active
if (isPlayerActive()) {
LOG_ERROR("Cannot perform custom update: Player is active");
setStatus(Status::FAILED, ErrorCode::PLAYER_ACTIVE);
return false;
}
LOG_INFO("🔥 Starting CUSTOM firmware update...");
LOG_INFO(" URL: %s", firmwareUrl.c_str());
LOG_INFO(" Checksum: %s", checksum.isEmpty() ? "NOT PROVIDED" : checksum.c_str());
LOG_INFO(" File Size: %u bytes", fileSize);
if (checksum.isEmpty()) {
LOG_WARNING("⚠️ No checksum provided - update will proceed without verification!");
}
setStatus(Status::DOWNLOADING);
// Download firmware from custom URL to SD
if (!downloadToSD(firmwareUrl, checksum, fileSize)) {
LOG_ERROR("Custom firmware download failed");
return false;
}
LOG_INFO("✅ Custom firmware downloaded successfully");
// Install from SD
bool result = installFromSD("/firmware/staged_update.bin");
if (result) {
LOG_INFO("🚀 Custom firmware installed - device will reboot");
} else {
LOG_ERROR("❌ Custom firmware installation failed");
}
return result;
}
// Hardware variant management
String OTAManager::getHardwareVariant() const {
return _configManager.getHardwareVariant();