Skip to content

Commit

Permalink
Improve printing of firmware version: support x.y.z format
Browse files Browse the repository at this point in the history
  • Loading branch information
hwflyboi committed May 9, 2022
1 parent 2db458c commit 30d3b33
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions toolbox/hwfly.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ void hwfly_update_fw()
// save version
fw_version = current_version;

gfx_printf("Current FW Ver: %d\nForce update: %d\n\n", current_version, force_update);
u32 version_print = current_version < 0x100 ? (current_version << 8) : current_version;
gfx_printf("Current FW Ver: %d.%d.%d\nForce update: %d\n\n", version_print >> 16, (version_print >> 8) & 0xFF, version_print & 0xFF, force_update);

u32 size = 0;
uint8_t *firmware = sd_file_read("firmware.bin", &size);
Expand Down Expand Up @@ -412,10 +413,11 @@ void hwfly_update_fw()
goto out;
}

version_print = new_version < 0x100 ? (new_version << 8) : new_version;
if (force_update)
gfx_printf("Forced update to version %d.\nPress Power to update or VOL to exit..\n", new_version);
gfx_printf("Forced update to version %d.%d.%d.\nPress Power to update or VOL to exit..\n", version_print >> 16, (version_print >> 8) & 0xFF, version_print & 0xFF);
else
gfx_printf("New version %d found.\nPress Power to update or VOL to exit..\n", new_version);
gfx_printf("New version %d.%d.%d found.\nPress Power to update or VOL to exit..\n", version_print >> 16, (version_print >> 8) & 0xFF, version_print & 0xFF);

msleep(500);
uint32_t btn = btn_wait();
Expand Down

0 comments on commit 30d3b33

Please sign in to comment.