localization
This commit is contained in:
@@ -1,42 +1,42 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// Firmware-Update ueber WLAN (Menue > System > "Nach Update suchen") -
|
||||
// prueft gegen die neueste Version im GitHub-Repository (Releases-API) und
|
||||
// installiert sie bei Bestaetigung direkt auf dem Geraet, ohne Kabel/
|
||||
// Web-Flasher. Blockierende, synchrone HTTPS-Aufrufe - werden nur bei
|
||||
// explizitem Tastendruck ausgefuehrt (kein Hintergrund-Polling), analog zu
|
||||
// AircraftDetails' Modell-/Routen-Abfragen, nur eben auf Core 1 statt
|
||||
// Core 0, da hier direkt auf Nutzer-Interaktion reagiert wird.
|
||||
// Firmware update over WiFi (Menu > System > "Check for update") -
|
||||
// checks against the latest version in the GitHub repository (Releases API) and
|
||||
// installs it on the device directly upon confirmation, without cable/
|
||||
// web flasher. Blocking, synchronous HTTPS calls - only executed on
|
||||
// explicit button press (no background polling), analogous to
|
||||
// AircraftDetails' model/route queries, just on Core 1 instead of
|
||||
// Core 0, since it reacts directly to user interaction.
|
||||
namespace OtaUpdate {
|
||||
|
||||
enum class CheckResult { Error, UpToDate, UpdateAvailable };
|
||||
|
||||
struct CheckInfo {
|
||||
CheckResult result = CheckResult::Error;
|
||||
// Neueste verfuegbare Version OHNE "v"-Praefix (z.B. "3.5.0") -
|
||||
// sowohl bei UpToDate als auch bei UpdateAvailable gesetzt, damit
|
||||
// der aufrufende Screen sie in beiden Faellen anzeigen kann.
|
||||
// Latest available version WITHOUT "v" prefix (e.g. "3.5.0") -
|
||||
// set for both UpToDate and UpdateAvailable, so
|
||||
// the calling screen can display it in both cases.
|
||||
char latestVersion[16] = {0};
|
||||
// Direkter Download-Link zur firmware.bin des Releases - nur
|
||||
// gesetzt, wenn result == UpdateAvailable.
|
||||
// Direct download link to the firmware.bin of the release - only
|
||||
// set when result == UpdateAvailable.
|
||||
char downloadUrl[192] = {0};
|
||||
};
|
||||
|
||||
// Fragt die GitHub-Releases-API nach dem neuesten Release ab, vergleicht
|
||||
// dessen Versionsnummer (Tag-Name, "v"-Praefix wird ignoriert) gegen
|
||||
// Config::APP_VERSION und sucht im Release den Anhang "firmware.bin".
|
||||
// CheckResult::Error bei jedem Fehler unterwegs (kein WLAN, Zeitueber-
|
||||
// schreitung, unerwartetes JSON, kein firmware.bin im Release).
|
||||
// Queries the GitHub Releases API for the latest release, compares
|
||||
// its version number (tag name, "v" prefix is ignored) against
|
||||
// Config::APP_VERSION and looks for the "firmware.bin" attachment in the release.
|
||||
// CheckResult::Error on any error along the way (no WiFi, timeout,
|
||||
// unexpected JSON, no firmware.bin in the release).
|
||||
CheckInfo checkForUpdate();
|
||||
|
||||
// Laedt die firmware.bin von 'url' herunter und flasht sie (ueber die
|
||||
// Standard-Arduino-HTTPUpdate-Bibliothek). Ruft bei Erfolg BEWUSST
|
||||
// NICHT selbst ESP.restart() auf - der Aufrufer zeigt zuerst eine
|
||||
// kurze Erfolgsmeldung an und startet danach selbst neu. onProgress
|
||||
// wird waehrend des Downloads wiederholt mit 0-100 (Prozent) aufgerufen
|
||||
// (darf nullptr sein). Gibt false zurueck, wenn Download oder Flash-
|
||||
// Vorgang fehlschlagen - das Geraet laeuft in dem Fall unveraendert mit
|
||||
// der bisherigen Firmware weiter.
|
||||
// Downloads the firmware.bin from 'url' and flashes it (via the
|
||||
// standard Arduino HTTPUpdate library). Intentionally does NOT call
|
||||
// ESP.restart() itself on success - the caller shows a
|
||||
// brief success message first and then restarts itself. onProgress
|
||||
// is called repeatedly during download with 0-100 (percent)
|
||||
// (may be nullptr). Returns false if download or flash
|
||||
// process fails - the device continues running unchanged with
|
||||
// the previous firmware in that case.
|
||||
bool performUpdate(const char* url, void (*onProgress)(uint8_t percent));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user