diff --git a/core/Makefile b/core/Makefile index f5de14dea9..844efe558c 100644 --- a/core/Makefile +++ b/core/Makefile @@ -54,8 +54,8 @@ FIRMWARE_BUILD_VERSION=$(shell cat ./embed/firmware/version.h | grep -E '#define ifndef BUILD_ID BUILD_COMMIT=$(shell git rev-parse HEAD | cut -c1-7) ifeq ($(BITCOIN_ONLY), 1) -FIRMWARE_BUILD_NAME=pro.$(FIRMWARE_BUILD_VERSION)-Stable-bc-only-$(BUILD_DATE)-$(BUILD_COMMIT) -FIRMWARE_BUILD_ID=pro.$(FIRMWARE_BUILD_VERSION)-Stable-bc-only-$(BUILD_COMMIT) +FIRMWARE_BUILD_NAME=pro.$(FIRMWARE_BUILD_VERSION)-Stable-btc-$(BUILD_DATE)-$(BUILD_COMMIT) +FIRMWARE_BUILD_ID=pro.$(FIRMWARE_BUILD_VERSION)-Stable-btc-$(BUILD_COMMIT) else FIRMWARE_BUILD_NAME=pro.$(FIRMWARE_BUILD_VERSION)-Stable-$(BUILD_DATE)-$(BUILD_COMMIT) FIRMWARE_BUILD_ID=pro.$(FIRMWARE_BUILD_VERSION)-Stable-$(BUILD_COMMIT) diff --git a/core/embed/bootloader/bootui.c b/core/embed/bootloader/bootui.c index 909847fac2..9a9673a5a6 100644 --- a/core/embed/bootloader/bootui.c +++ b/core/embed/bootloader/bootui.c @@ -360,6 +360,8 @@ void ui_screen_confirm(char* title, char* note_l1, char* note_l2, char* note_l3, ui_confirm_cancel_buttons("Back", "OK", COLOR_BL_DARK, COLOR_BL_FAIL); } +static bool ui_progress_bar_visible = false; + void ui_screen_progress_bar_init(char* title, char* notes, int progress) { ui_statusbar_update(); ui_logo_onekey(); @@ -373,16 +375,30 @@ void ui_screen_progress_bar_init(char* title, char* notes, int progress) { void ui_screen_progress_bar_prepare(char* title, char* notes) { ui_statusbar_update(); ui_logo_onekey(); - ui_screen_progress_bar_update(title, notes, -1); + ui_progress_bar_visible = true; + if (title != NULL) { + display_text_center(DISPLAY_RESX / 2, TITLE_OFFSET_Y, title, -1, + FONT_PJKS_BOLD_38, COLOR_BL_FG, COLOR_BL_BG); + } + display_progress(notes ? notes : "Keep connected.", 0); } void ui_screen_progress_bar_update(char* title, char* notes, int progress) { + if (!ui_progress_bar_visible) { + ui_fadeout(); + ui_statusbar_update(); + ui_logo_onekey(); + display_progress(notes ? notes : "Keep connected.", 0); + ui_fadein(); + ui_progress_bar_visible = true; + } + if (title != NULL) { display_text_center(DISPLAY_RESX / 2, TITLE_OFFSET_Y, title, -1, FONT_PJKS_BOLD_38, COLOR_BL_FG, COLOR_BL_BG); } - if ((progress >= 0) && (progress <= 100)) { + if (progress >= 0 && progress <= 100) { if (progress > 0) { display_progress(NULL, progress); } @@ -391,6 +407,8 @@ void ui_screen_progress_bar_update(char* title, char* notes, int progress) { } } +void ui_progress_bar_visible_clear(void) { ui_progress_bar_visible = false; } + void ui_screen_install_start(void) { ui_statusbar_update(); ui_logo_onekey(); @@ -967,6 +985,8 @@ void ui_bootloader_first(const image_header* const hdr) { uint8_t se_state; char se_info[64] = {0}; + ui_progress_bar_visible_clear(); + static image_header* current_hdr = NULL; if (current_hdr == NULL && hdr) { @@ -1289,11 +1309,11 @@ void ui_bootloader_page_switch(const image_header* const hdr) { } } } else if (ui_bootloader_page_current == 2) { - response = ui_input_poll(INPUT_PREVIOUS | INPUT_RESTART, false); - if (INPUT_PREVIOUS == response) { + response = ui_input_poll(INPUT_CANCEL | INPUT_CONFIRM, false); + if (INPUT_CANCEL == response) { display_clear(); ui_bootloader_first(hdr); - } else if (INPUT_RESTART == response) { + } else if (INPUT_CONFIRM == response) { device_burnin_test_clear_flag(); } click_now = HAL_GetTick(); diff --git a/core/embed/bootloader/bootui.h b/core/embed/bootloader/bootui.h index f4773df714..398e53fcca 100644 --- a/core/embed/bootloader/bootui.h +++ b/core/embed/bootloader/bootui.h @@ -55,6 +55,7 @@ void ui_screen_confirm(char* title, char* note_l1, char* note_l2, char* note_l3, void ui_screen_progress_bar_init(char* title, char* notes, int progress); void ui_screen_progress_bar_prepare(char* title, char* notes); void ui_screen_progress_bar_update(char* msg_status, char* notes, int progress); +void ui_progress_bar_visible_clear(void); void ui_screen_wipe_confirm(void); void ui_screen_wipe(void); diff --git a/core/embed/bootloader/main.c b/core/embed/bootloader/main.c index d321d50951..b34da1b896 100644 --- a/core/embed/bootloader/main.c +++ b/core/embed/bootloader/main.c @@ -388,7 +388,6 @@ static secbool bootloader_usb_loop(const vendor_header* const vhdr, // give a way to go back to bootloader home page if (get_ui_bootloader_page_current() != 0) { ble_power_button_state_clear(); - ui_progress_bar_visible_clear(); ui_fadeout(); ui_bootloader_first(NULL); ui_fadein(); diff --git a/core/embed/emmc_wrapper/emmc_commands.c b/core/embed/emmc_wrapper/emmc_commands.c index 154d2dff7c..eb7b68b38d 100644 --- a/core/embed/emmc_wrapper/emmc_commands.c +++ b/core/embed/emmc_wrapper/emmc_commands.c @@ -1,6 +1,7 @@ #include "emmc_commands.h" #include "emmc_commands_macros.h" +#include "bootui.h" #include "fw_keys.h" #include "se_thd89.h" #include "thd89_boot.h" @@ -8,14 +9,44 @@ // ######## global vars ######## // SDRAM BUFFER bootloader_buffer* bl_buffer = (bootloader_buffer*)FMC_SDRAM_BOOLOADER_BUFFER_ADDRESS; -// UI progesss -bool ui_progress_bar_visible = false; -// ######## helpers ######## +static int ui_progress_bar_handle_update(int percentage, const char* title) +{ + static uint32_t ui_percentage_last = 0xff; + char* progress_title = (char*)((title != NULL) ? title : "Transferring Data"); + + if ( (percentage < 0) || (percentage > 100) ) + { + return -1; + } + + if ( ui_percentage_last == (uint32_t)percentage ) + { + return 0; + } + + ui_percentage_last = (uint32_t)percentage; + + if ( percentage < 100 ) + { + ui_screen_progress_bar_update(progress_title, NULL, percentage); + } + else + { + ui_screen_progress_bar_update(progress_title, NULL, percentage); + ui_fadeout(); + ui_bootloader_first(NULL); + ui_fadein(); + } -void ui_progress_bar_visible_clear() + return 0; +} + +static void ui_progress_bar_handle_clear(void) { - ui_progress_bar_visible = false; + ui_progress_bar_visible_clear(); + display_clear(); + ui_bootloader_first(NULL); } static void packet_generate_first( @@ -1701,58 +1732,16 @@ int process_msg_EmmcFileRead(uint8_t iface_num, uint32_t msg_size, uint8_t* buf) // (requester intersted) size if ( msg_recv.has_ui_percentage ) { - char ui_progress_title[] = "Transferring Data"; - - // sanity check - if ( (msg_recv.ui_percentage < 0) || (msg_recv.ui_percentage > 100) ) + const char* progress_title = "Transferring Data"; + if ( ui_progress_bar_handle_update(msg_recv.ui_percentage, progress_title) != 0 ) { send_failure(iface_num, FailureType_Failure_ProcessError, "Percentage invalid!"); return -1; } - - else if ( msg_recv.ui_percentage < 100 ) - { - if ( !ui_progress_bar_visible ) - { - ui_fadeout(); - ui_screen_progress_bar_prepare(ui_progress_title, NULL); - ui_fadein(); - ui_screen_progress_bar_update(NULL, NULL, msg_recv.ui_percentage); - ui_progress_bar_visible = true; - } - else - ui_screen_progress_bar_update(NULL, NULL, msg_recv.ui_percentage); - } - else if ( msg_recv.ui_percentage == 100 ) - { - if ( !ui_progress_bar_visible ) - { - // this is for the instant 100% case, which happens if the file is too - // small - ui_fadeout(); - ui_screen_progress_bar_prepare(ui_progress_title, NULL); - ui_screen_progress_bar_update(NULL, NULL, msg_recv.ui_percentage); - ui_fadein(); - } - else - { - // normal path - ui_screen_progress_bar_update(NULL, NULL, msg_recv.ui_percentage); - ui_progress_bar_visible = false; - } - ui_fadeout(); - ui_bootloader_first(NULL); - ui_fadein(); - } } else { - if ( ui_progress_bar_visible ) - { - ui_progress_bar_visible = false; - display_clear(); - ui_bootloader_first(NULL); - } + ui_progress_bar_handle_clear(); } // get file info @@ -1853,69 +1842,16 @@ int process_msg_EmmcFileWrite(uint8_t iface_num, uint32_t msg_size, uint8_t* buf // (requester intersted) size if ( msg_recv.has_ui_percentage ) { - char ui_progress_title[] = "Transferring Data"; - - static uint32_t ui_percentage_last = 0xff; - - // sanity check - if ( (msg_recv.ui_percentage < 0) || (msg_recv.ui_percentage > 100) ) + const char* progress_title = "Transferring Data"; + if ( ui_progress_bar_handle_update(msg_recv.ui_percentage, progress_title) != 0 ) { send_failure(iface_num, FailureType_Failure_ProcessError, "Percentage invalid!"); return -1; } - else if ( msg_recv.ui_percentage < 100 ) - { - if ( ui_percentage_last != msg_recv.ui_percentage ) - { - ui_percentage_last = msg_recv.ui_percentage; - if ( !ui_progress_bar_visible ) - { - ui_fadeout(); - ui_screen_progress_bar_prepare(ui_progress_title, NULL); - ui_fadein(); - ui_screen_progress_bar_update(NULL, NULL, msg_recv.ui_percentage); - ui_progress_bar_visible = true; - } - else - { - ui_screen_progress_bar_update(NULL, NULL, msg_recv.ui_percentage); - } - } - } - else if ( msg_recv.ui_percentage == 100 ) - { - if ( ui_percentage_last != msg_recv.ui_percentage ) - { - ui_percentage_last = msg_recv.ui_percentage; - if ( !ui_progress_bar_visible ) - { - // this is for the instant 100% case, which happens if the file is too - // small - ui_fadeout(); - ui_screen_progress_bar_prepare(ui_progress_title, NULL); - ui_screen_progress_bar_update(NULL, NULL, msg_recv.ui_percentage); - ui_fadein(); - } - else - { - // normal path - ui_screen_progress_bar_update(NULL, NULL, msg_recv.ui_percentage); - ui_progress_bar_visible = false; - } - ui_fadeout(); - ui_bootloader_first(NULL); - ui_fadein(); - } - } } else { - if ( ui_progress_bar_visible ) - { - ui_progress_bar_visible = false; - display_clear(); - ui_bootloader_first(NULL); - } + ui_progress_bar_handle_clear(); } // get file info diff --git a/core/embed/emmc_wrapper/emmc_commands.h b/core/embed/emmc_wrapper/emmc_commands.h index d739ecae86..30cb398dcc 100644 --- a/core/embed/emmc_wrapper/emmc_commands.h +++ b/core/embed/emmc_wrapper/emmc_commands.h @@ -143,12 +143,8 @@ typedef struct // ######## global vars ######## -extern bool ui_progress_bar_visible; - // ######## functions ######## -void ui_progress_bar_visible_clear(); - // void packet_generate_first( // uint16_t msg_id, uint32_t msg_size, uint8_t* desc_buff, size_t desc_buff_offset, const uint8_t* // src_buff, size_t data_len diff --git a/core/embed/extmod/modtrezorui/mipi_lcd.c b/core/embed/extmod/modtrezorui/mipi_lcd.c index 6acb924f2a..2121a9c9ec 100644 --- a/core/embed/extmod/modtrezorui/mipi_lcd.c +++ b/core/embed/extmod/modtrezorui/mipi_lcd.c @@ -468,15 +468,17 @@ void fb_fill_rect(uint32_t x_pos, uint32_t y_pos, uint32_t width, } start_x = x_pos < lcd_window.start_x ? lcd_window.start_x : x_pos; start_y = y_pos < lcd_window.start_y ? lcd_window.start_y : y_pos; - end_x = x_pos + width > lcd_window.end_x ? lcd_window.end_x : x_pos + width; - end_y = y_pos + height > lcd_window.end_y ? lcd_window.end_y : y_pos + height; + end_x = x_pos + width - 1; + end_y = y_pos + height - 1; + end_x = end_x > lcd_window.end_x ? lcd_window.end_x : end_x; + end_y = end_y > lcd_window.end_y ? lcd_window.end_y : end_y; /* Get the rectangle start address */ uint32_t address = lcd_params.fb_base + ((lcd_params.bbp) * (lcd_params.hres * start_y + start_x)); /* Fill the rectangle */ - fb_fill_buffer((uint32_t*)address, end_x - start_x, end_y - start_y, - (lcd_params.hres - (end_x - start_x)), color); + fb_fill_buffer((uint32_t*)address, end_x - start_x + 1, end_y - start_y + 1, + (lcd_params.hres - (end_x - start_x + 1)), color); } void fb_draw_hline(uint32_t x_pos, uint32_t y_pos, uint32_t len, diff --git a/vendor/lvgl_mp b/vendor/lvgl_mp index fbca53bdff..6eeace043d 160000 --- a/vendor/lvgl_mp +++ b/vendor/lvgl_mp @@ -1 +1 @@ -Subproject commit fbca53bdffc5d14dffb1363dc91b7a69b0cff160 +Subproject commit 6eeace043d7038876e395e2b0f277d36d008cd1f