Skip to content

Commit

Permalink
misc fixes to UI
Browse files Browse the repository at this point in the history
  • Loading branch information
bitgamma committed Mar 6, 2025
1 parent 08834bc commit 3b46836
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/qrcode/qrout.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ app_err_t qrout_display_address() {

screen_draw_text(&ctx, (SCREEN_WIDTH - TH_QRCODE_ADDR_MARGIN), SCREEN_HEIGHT - TH_NAV_HINT_HEIGHT, (uint8_t*) g_ui_cmd.params.address.address, strlen(g_ui_cmd.params.address.address), false, true);

dialog_pager_colors(*g_ui_cmd.params.address.index, UINT32_MAX, SCREEN_COLOR_WHITE, SCREEN_COLOR_BLACK);
dialog_pager_colors(*g_ui_cmd.params.address.index, UINT32_MAX, 0, SCREEN_COLOR_WHITE, SCREEN_COLOR_BLACK);

while(1) {
switch(ui_wait_keypress(portMAX_DELAY)) {
Expand Down
4 changes: 3 additions & 1 deletion app/screen/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
#include <string.h>

#define SCREEN_TIMEOUT 100
#define SCREEN_CAMERA_X 48
#define SCREEN_CAMERA_Y 0

#define MAX_GLYPHS_PER_LINE 50

const screen_area_t screen_fullarea = { 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT };
const screen_area_t screen_camarea = { (SCREEN_WIDTH - CAM_OUT_WIDTH), (SCREEN_HEIGHT - CAM_OUT_HEIGHT)/2, CAM_OUT_WIDTH, CAM_OUT_HEIGHT };
const screen_area_t screen_camarea = { SCREEN_CAMERA_X, SCREEN_CAMERA_Y, CAM_OUT_WIDTH, CAM_OUT_HEIGHT };

struct screen_render_ctx {
const uint8_t* data;
Expand Down
6 changes: 3 additions & 3 deletions app/ui/dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,22 +173,22 @@ app_err_t dialog_nav_hints_colors(nav_icon_t left, nav_icon_t right, uint16_t bg
return ERR_OK;
}

app_err_t dialog_pager_colors(size_t page, size_t last_page, uint16_t bg, uint16_t fg) {
app_err_t dialog_pager_colors(size_t page, size_t last_page, size_t base_page, uint16_t bg, uint16_t fg) {
uint8_t page_indicator[(UINT32_STRING_LEN * 2) + 4];
size_t total_len = 0;
page_indicator[total_len++] = SYM_LEFT_CHEVRON;
page_indicator[total_len++] = ' ';

uint8_t page_str[UINT32_STRING_LEN];
uint8_t* p = u32toa(page + 1, page_str, UINT32_STRING_LEN);
uint8_t* p = u32toa(page + base_page, page_str, UINT32_STRING_LEN);
uint8_t p_len = strlen((char *) p);
memcpy(&page_indicator[total_len], p, p_len);
total_len += p_len;

if (last_page != UINT32_MAX) {
page_indicator[total_len++] = '/';

p = u32toa(last_page + 1, page_str, UINT32_STRING_LEN);
p = u32toa(last_page + base_page, page_str, UINT32_STRING_LEN);
p_len = strlen((char *) p);
memcpy(&page_indicator[total_len], p, p_len);
total_len += p_len;
Expand Down
4 changes: 2 additions & 2 deletions app/ui/dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ app_err_t dialog_inverted_string(screen_text_ctx_t* ctx, const char* str, uint16
app_err_t dialog_title_colors(const char* title, uint16_t bg, uint16_t fg, uint16_t icon);
app_err_t dialog_footer_colors(uint16_t yOff, uint16_t bg);
app_err_t dialog_nav_hints_colors(nav_icon_t left, nav_icon_t right, uint16_t bg);
app_err_t dialog_pager_colors(size_t page, size_t last_page, uint16_t bg, uint16_t fg);
app_err_t dialog_pager_colors(size_t page, size_t last_page, size_t base_page, uint16_t bg, uint16_t fg);
app_err_t dialog_margin(uint16_t yOff, uint16_t height);

app_err_t dialog_confirm_eth_tx();
Expand All @@ -43,7 +43,7 @@ static inline app_err_t dialog_nav_hints(nav_icon_t left, nav_icon_t right) {
}

static inline app_err_t dialog_pager(size_t page, size_t last_page) {
return dialog_pager_colors(page, last_page, TH_COLOR_BG, TH_COLOR_FG);
return dialog_pager_colors(page, last_page, 1, TH_COLOR_BG, TH_COLOR_FG);
}

#endif
12 changes: 6 additions & 6 deletions app/ui/english.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ const char *const i18n_english_strings[] = {
"Help",

// Connect menu
"Ethereum wallet",
"Bitcoin wallet",
"Sparrow Testnet wallet",
"Backpack/OKX Wallet",
"Ethereum",
"Bitcoin",
"Sparrow Testnet",
"Cross-chain",

// Addresses menu
"Ethereum",
Expand Down Expand Up @@ -82,7 +82,7 @@ const char *const i18n_english_strings[] = {
"Your BTC address",

// PIN input
"Insert your PIN",
"Keycard PIN",
"Wrong PIN. Please try again.",
"Choose a new PIN",
"Remaining attempts: ",
Expand All @@ -91,7 +91,7 @@ const char *const i18n_english_strings[] = {
"PIN changed successfully",

// PUK input
"Insert your PUK",
"Keycard PUK",
"Wrong PUK. Please try again.",
"Choose a new PUK",
"PUK changed successfully",
Expand Down
2 changes: 1 addition & 1 deletion app/ui/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const menu_t menu_connect = {
4, {
{MENU_CONNECT_EIP4527, NULL},
{MENU_CONNECT_BITCOIN, NULL},
{MENU_CONNECT_BITCOIN_TESTNET, NULL},
{MENU_CONNECT_MULTICOIN, NULL},
{MENU_CONNECT_BITCOIN_TESTNET, NULL},
}
};

Expand Down

0 comments on commit 3b46836

Please sign in to comment.