mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-02 17:29:14 +00:00
37bd0d546a
* Updater: UI rework initial * Updater: further updates to UI, added a temporary parrot * Updater: additional checks on radio stack type before update * Second iteration of updater UI: additional handling of resource unpacking errors * updater: removed extra logging, renamed some stages * Updater: Changed "back" button icon on error screen * Archive: signed/unsigned fix * Updater: cancelling update also cancels LFS+resources processing; restored /ext/update/ folder magic to 0 * Updater: root dir fix Co-authored-by: nminaylov <nm29719@gmail.com>
87 lines
2.1 KiB
C
87 lines
2.1 KiB
C
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <update_util/update_manifest.h>
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <m-string.h>
|
|
|
|
#define UPDATE_DELAY_OPERATION_OK 300
|
|
#define UPDATE_DELAY_OPERATION_ERROR INT_MAX
|
|
|
|
typedef enum {
|
|
UpdateTaskStageProgress = 0,
|
|
|
|
UpdateTaskStageReadManifest,
|
|
UpdateTaskStageLfsBackup,
|
|
|
|
UpdateTaskStageRadioImageValidate,
|
|
UpdateTaskStageRadioErase,
|
|
UpdateTaskStageRadioWrite,
|
|
UpdateTaskStageRadioInstall,
|
|
UpdateTaskStageRadioBusy,
|
|
|
|
UpdateTaskStageOBValidation,
|
|
|
|
UpdateTaskStageValidateDFUImage,
|
|
UpdateTaskStageFlashWrite,
|
|
UpdateTaskStageFlashValidate,
|
|
|
|
UpdateTaskStageLfsRestore,
|
|
UpdateTaskStageResourcesUpdate,
|
|
|
|
UpdateTaskStageCompleted,
|
|
UpdateTaskStageError,
|
|
UpdateTaskStageOBError,
|
|
UpdateTaskStageMAX
|
|
} UpdateTaskStage;
|
|
|
|
inline bool update_stage_is_error(const UpdateTaskStage stage) {
|
|
return stage >= UpdateTaskStageError;
|
|
}
|
|
|
|
typedef enum {
|
|
UpdateTaskStageGroupMisc = 0,
|
|
UpdateTaskStageGroupPreUpdate = 1 << 1,
|
|
UpdateTaskStageGroupFirmware = 1 << 2,
|
|
UpdateTaskStageGroupOptionBytes = 1 << 3,
|
|
UpdateTaskStageGroupRadio = 1 << 4,
|
|
UpdateTaskStageGroupPostUpdate = 1 << 5,
|
|
UpdateTaskStageGroupResources = 1 << 6,
|
|
} UpdateTaskStageGroup;
|
|
|
|
typedef struct {
|
|
UpdateTaskStage stage;
|
|
uint8_t overall_progress, stage_progress;
|
|
string_t status;
|
|
UpdateTaskStageGroup groups;
|
|
uint32_t total_progress_points;
|
|
uint32_t completed_stages_points;
|
|
} UpdateTaskState;
|
|
|
|
typedef struct UpdateTask UpdateTask;
|
|
|
|
typedef void (
|
|
*updateProgressCb)(const char* status, const uint8_t stage_pct, bool failed, void* state);
|
|
|
|
UpdateTask* update_task_alloc();
|
|
|
|
void update_task_free(UpdateTask* update_task);
|
|
|
|
void update_task_set_progress_cb(UpdateTask* update_task, updateProgressCb cb, void* state);
|
|
|
|
bool update_task_start(UpdateTask* update_task);
|
|
|
|
bool update_task_is_running(UpdateTask* update_task);
|
|
|
|
UpdateTaskState const* update_task_get_state(UpdateTask* update_task);
|
|
|
|
UpdateManifest const* update_task_get_manifest(UpdateTask* update_task);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|