[FL-164] Add bootloader version (#417)
* Add bootloader versioning * Move some logic to api-hal-version * Backport to f4 * Dolphin: update version screen layout, make it more readable Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -191,6 +191,33 @@ bool dolphin_view_lockmenu_input(InputEvent* event, void* context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dolphin_view_idle_down_input(InputEvent* event, void* context) {
|
||||
furi_assert(event);
|
||||
furi_assert(context);
|
||||
Dolphin* dolphin = context;
|
||||
|
||||
if(event->type != InputTypeShort) return false;
|
||||
|
||||
if((event->key == InputKeyLeft) || (event->key == InputKeyRight)) {
|
||||
with_view_model(
|
||||
dolphin->idle_view_down, (DolphinViewIdleDownModel * model) {
|
||||
model->show_fw_or_boot = !model->show_fw_or_boot;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
if(event->key == InputKeyBack) {
|
||||
with_view_model(
|
||||
dolphin->idle_view_down, (DolphinViewIdleDownModel * model) {
|
||||
model->show_fw_or_boot = 0;
|
||||
return true;
|
||||
});
|
||||
view_dispatcher_switch_to_view(dolphin->idle_view_dispatcher, DolphinViewIdleMain);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Dolphin* dolphin_alloc() {
|
||||
Dolphin* dolphin = furi_alloc(sizeof(Dolphin));
|
||||
// Message queue
|
||||
@@ -255,11 +282,14 @@ Dolphin* dolphin_alloc() {
|
||||
|
||||
// Down Idle View
|
||||
dolphin->idle_view_down = view_alloc();
|
||||
view_set_context(dolphin->idle_view_down, dolphin);
|
||||
view_allocate_model(
|
||||
dolphin->idle_view_down, ViewModelTypeLockFree, sizeof(DolphinViewIdleDownModel));
|
||||
view_set_draw_callback(dolphin->idle_view_down, dolphin_view_idle_down_draw);
|
||||
view_set_input_callback(dolphin->idle_view_down, dolphin_view_idle_down_input);
|
||||
view_set_previous_callback(dolphin->idle_view_down, dolphin_view_idle_back);
|
||||
view_dispatcher_add_view(
|
||||
dolphin->idle_view_dispatcher, DolphinViewIdleDown, dolphin->idle_view_down);
|
||||
|
||||
// HW Mismatch
|
||||
dolphin->view_hw_mismatch = view_alloc();
|
||||
view_set_draw_callback(dolphin->view_hw_mismatch, dolphin_view_hw_mismatch_draw);
|
||||
|
@@ -3,6 +3,8 @@
|
||||
#include <gui/gui.h>
|
||||
#include <gui/elements.h>
|
||||
#include <api-hal.h>
|
||||
#include <version.h>
|
||||
#include <api-hal-version.h>
|
||||
|
||||
static char* Lockmenu_Items[3] = {"Lock", "Set PIN", "DUMB mode"};
|
||||
|
||||
@@ -92,25 +94,46 @@ void dolphin_view_lockmenu_draw(Canvas* canvas, void* model) {
|
||||
}
|
||||
|
||||
void dolphin_view_idle_down_draw(Canvas* canvas, void* model) {
|
||||
canvas_clear(canvas);
|
||||
DolphinViewIdleDownModel* m = model;
|
||||
const Version* ver;
|
||||
char buffer[64];
|
||||
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
canvas_draw_str(canvas, 2, 15, "Version info:");
|
||||
canvas_draw_str(canvas, 2, 13, m->show_fw_or_boot ? "Boot Version info:" : "FW Version info:");
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
canvas_draw_str(canvas, 5, 25, TARGET " " BUILD_DATE);
|
||||
canvas_draw_str(canvas, 5, 35, GIT_BRANCH);
|
||||
canvas_draw_str(canvas, 5, 45, GIT_BRANCH_NUM " " GIT_COMMIT);
|
||||
|
||||
char buffer[64];
|
||||
// Hardware version
|
||||
snprintf(
|
||||
buffer,
|
||||
64,
|
||||
"HW: %d.F%dB%dC%d",
|
||||
sizeof(buffer),
|
||||
"HW: %d.F%dB%dC%d %s",
|
||||
api_hal_version_get_hw_version(),
|
||||
api_hal_version_get_hw_target(),
|
||||
api_hal_version_get_hw_body(),
|
||||
api_hal_version_get_hw_connect());
|
||||
canvas_draw_str(canvas, 5, 55, buffer);
|
||||
api_hal_version_get_hw_connect(),
|
||||
api_hal_version_get_name_ptr());
|
||||
canvas_draw_str(canvas, 5, 23, buffer);
|
||||
|
||||
ver = m->show_fw_or_boot ? api_hal_version_get_boot_version() :
|
||||
api_hal_version_get_fw_version();
|
||||
|
||||
if(!ver) {
|
||||
canvas_draw_str(canvas, 5, 33, "No info");
|
||||
return;
|
||||
}
|
||||
|
||||
snprintf(
|
||||
buffer, sizeof(buffer), "%s [%s]", version_get_version(ver), version_get_builddate(ver));
|
||||
canvas_draw_str(canvas, 5, 33, buffer);
|
||||
|
||||
snprintf(
|
||||
buffer, sizeof(buffer), "%s [%s]", version_get_githash(ver), version_get_gitbranchnum(ver));
|
||||
canvas_draw_str(canvas, 5, 43, buffer);
|
||||
|
||||
snprintf(
|
||||
buffer, sizeof(buffer), "[%s] %s", version_get_target(ver), version_get_gitbranch(ver));
|
||||
canvas_draw_str(canvas, 5, 53, buffer);
|
||||
}
|
||||
|
||||
void dolphin_view_hw_mismatch_draw(Canvas* canvas, void* model) {
|
||||
|
@@ -28,6 +28,10 @@ typedef struct {
|
||||
uint32_t butthurt;
|
||||
} DolphinViewIdleUpModel;
|
||||
|
||||
typedef struct {
|
||||
bool show_fw_or_boot;
|
||||
} DolphinViewIdleDownModel;
|
||||
|
||||
typedef struct {
|
||||
uint8_t idx;
|
||||
} DolphinViewMenuModel;
|
||||
|
Reference in New Issue
Block a user