bootloader: refactor fadeins/fadeouts

pull/25/head
Pavol Rusnak 6 years ago
parent 5538614a79
commit 117a3efbe2
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -146,11 +146,9 @@ void ui_screen_install_confirm(void)
void ui_screen_install(void)
{
display_fade(BACKLIGHT_NORMAL, 0, 100);
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
display_loader(1000, -20, COLOR_BL_PROCESS, COLOR_WHITE, toi_icon_install, sizeof(toi_icon_install), COLOR_BLACK);
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, "Installing firmware", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
display_fade(0, BACKLIGHT_NORMAL, 100);
}
void ui_screen_install_progress_erase(int pos, int len)
@ -184,11 +182,9 @@ void ui_screen_wipe_confirm(void)
void ui_screen_wipe(void)
{
display_fade(BACKLIGHT_NORMAL, 0, 100);
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
display_loader(1000, -20, COLOR_BL_PROCESS, COLOR_WHITE, toi_icon_wipe, sizeof(toi_icon_wipe), COLOR_BLACK);
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, "Wiping Device", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
display_fade(0, BACKLIGHT_NORMAL, 100);
}
void ui_screen_wipe_progress(int pos, int len)

@ -135,7 +135,9 @@ static secbool bootloader_usb_loop(const vendor_header * const vhdr, const image
send_user_abort(USB_IFACE_NUM, "Wipe cancelled");
break;
}
ui_fadeout();
ui_screen_wipe();
ui_fadein();
r = process_msg_WipeDevice(USB_IFACE_NUM, msg_size, buf);
if (r < 0) { // error
ui_screen_fail();
@ -160,7 +162,9 @@ static secbool bootloader_usb_loop(const vendor_header * const vhdr, const image
break;
}
}
ui_fadeout();
ui_screen_install();
ui_fadein();
process_msg_FirmwareErase(USB_IFACE_NUM, msg_size, buf);
break;
case 7: // FirmwareUpload
@ -255,40 +259,58 @@ main_start:
image_header hdr;
secbool firmware_present;
// start the bootloader if user touched the screen or no firmware installed
// detect whether the devices contains a firmware
firmware_present = load_vendor_header_keys((const uint8_t *)FIRMWARE_START, &vhdr);
if (sectrue == firmware_present) {
firmware_present = load_image_header((const uint8_t *)(FIRMWARE_START + vhdr.hdrlen), FIRMWARE_IMAGE_MAGIC, FIRMWARE_IMAGE_MAXSIZE, vhdr.vsig_m, vhdr.vsig_n, vhdr.vpub, &hdr);
}
// start the bootloader if no firmware found ...
if (firmware_present != sectrue) {
// show intro animation
// no ui_fadeout(); - we already start from black screen
ui_screen_first();
ui_fadein();
hal_delay(1000);
ui_fadeout();
ui_fadeout();
ui_screen_second();
ui_fadein();
hal_delay(1000);
ui_fadeout();
ui_fadeout();
ui_screen_third();
ui_fadein();
// and start the usb loop
if (bootloader_usb_loop(NULL, NULL) != sectrue) {
return 1;
}
} else
// ... or if user touched the screen on start
if (touched) {
// show firmware info with connect buttons
// no ui_fadeout(); - we already start from black screen
ui_screen_info(sectrue, &vhdr, &hdr);
ui_fadein();
secbool response = ui_button_response();
ui_fadeout();
// if cancel was pressed -> restart
if (sectrue != response) {
goto main_start;
}
// show firmware info without connect buttons
ui_screen_info(secfalse, &vhdr, &hdr);
ui_fadein();
// and start the usb loop
if (bootloader_usb_loop(&vhdr, &hdr) != sectrue) {
return 1;
}
@ -314,6 +336,7 @@ main_start:
if ((vhdr.vtrust & VTRUST_ALL) != VTRUST_ALL) {
// ui_fadeout(); // no fadeout - we start from black screen
ui_screen_boot(&vhdr, &hdr);
ui_fadein();

Loading…
Cancel
Save