Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
30 changes: 25 additions & 5 deletions core/embed/bootloader/bootui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}
Expand All @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions core/embed/bootloader/bootui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion core/embed/bootloader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
148 changes: 42 additions & 106 deletions core/embed/emmc_wrapper/emmc_commands.c
Original file line number Diff line number Diff line change
@@ -1,21 +1,52 @@
#include "emmc_commands.h"
#include "emmc_commands_macros.h"

#include "bootui.h"
#include "fw_keys.h"
#include "se_thd89.h"
#include "thd89_boot.h"

// ######## 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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions core/embed/emmc_wrapper/emmc_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions core/embed/extmod/modtrezorui/mipi_lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion vendor/lvgl_mp
Submodule lvgl_mp updated 1 files
+1 −1 lvgl
Loading