[FL-2517, FL-2518, FL-2523] Updater UI overhaul (#1196)

* 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>
This commit is contained in:
hedger
2022-05-06 19:26:25 +03:00
committed by GitHub
parent 4d6b170769
commit 37bd0d546a
19 changed files with 275 additions and 179 deletions

View File

@@ -10,46 +10,63 @@ extern "C" {
#include <stdbool.h>
#include <m-string.h>
#define UPDATE_DELAY_OPERATION_OK 600
#define UPDATE_DELAY_OPERATION_OK 300
#define UPDATE_DELAY_OPERATION_ERROR INT_MAX
typedef enum {
UpdateTaskStageProgress,
UpdateTaskStageProgress = 0,
UpdateTaskStageReadManifest,
UpdateTaskStageValidateDFUImage,
UpdateTaskStageFlashWrite,
UpdateTaskStageFlashValidate,
UpdateTaskStageLfsBackup,
UpdateTaskStageRadioImageValidate,
UpdateTaskStageRadioErase,
UpdateTaskStageRadioWrite,
UpdateTaskStageRadioInstall,
UpdateTaskStageRadioBusy,
UpdateTaskStageOBValidation,
UpdateTaskStageLfsBackup,
UpdateTaskStageValidateDFUImage,
UpdateTaskStageFlashWrite,
UpdateTaskStageFlashValidate,
UpdateTaskStageLfsRestore,
UpdateTaskStageResourcesUpdate,
UpdateTaskStageCompleted,
UpdateTaskStageError,
UpdateTaskStageOBError
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 progress;
uint8_t current_stage_idx;
uint8_t total_stages;
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,
const uint8_t idx_stage,
const uint8_t total_stages,
bool failed,
void* state);
typedef void (
*updateProgressCb)(const char* status, const uint8_t stage_pct, bool failed, void* state);
UpdateTask* update_task_alloc();