17lv_obj_t *
make_button(lv_obj_t *parent,
const char *label, lv_color_t bg,
18 lv_color_t fg, lv_coord_t w, lv_coord_t h,
19 lv_align_t align, lv_coord_t x, lv_coord_t y,
21 lv_obj_t *btn = lv_btn_create(parent);
22 lv_obj_set_size(btn, w, h);
23 lv_obj_align(btn, align, x, y);
29 lv_obj_set_style_bg_color(btn, bg, LV_PART_MAIN);
30 lv_obj_set_style_bg_grad_dir(btn, LV_GRAD_DIR_NONE, LV_PART_MAIN);
31 lv_obj_set_style_bg_opa(btn, LV_OPA_COVER, LV_PART_MAIN);
32 lv_obj_set_style_radius(btn,
BTN_RADIUS, LV_PART_MAIN);
33 lv_obj_set_style_border_width(btn, 0, LV_PART_MAIN);
36 lv_obj_set_style_shadow_width(btn, 0, LV_PART_MAIN);
41 lv_obj_set_style_border_width(btn, 1, LV_PART_MAIN);
42 lv_obj_set_style_border_color(btn,
COL_BORDER, LV_PART_MAIN);
48 lv_obj_set_style_bg_color(btn,
50 ? lv_color_mix(lv_color_white(), bg, 40)
51 : lv_color_mix(lv_color_black(), bg, 70),
52 LV_PART_MAIN | LV_STATE_PRESSED);
55 reinterpret_cast<void *
>(
static_cast<intptr_t
>(act)));
57 lv_obj_t *lbl = lv_label_create(btn);
58 lv_label_set_text(lbl, label);
59 lv_obj_set_style_text_color(lbl, fg, LV_PART_MAIN);
60 lv_obj_set_style_text_font(lbl, font, LV_PART_MAIN);
64lv_obj_t *
make_label(lv_obj_t *parent,
const char *txt, lv_color_t color,
65 const lv_font_t *font, lv_align_t align,
66 lv_coord_t x, lv_coord_t y) {
67 lv_obj_t *lbl = lv_label_create(parent);
68 lv_label_set_text(lbl, txt);
69 lv_obj_set_style_text_color(lbl, color, LV_PART_MAIN);
70 lv_obj_set_style_text_font(lbl, font, LV_PART_MAIN);
71 lv_obj_align(lbl, align, x, y);
79 lv_coord_t w, lv_align_t align,
80 lv_coord_t x, lv_coord_t y,
BtnAction act) {
84 lv_obj_set_style_border_width(b, 1, LV_PART_MAIN);
85 lv_obj_set_style_border_color(b,
COL_BORDER, LV_PART_MAIN);
86 lv_obj_set_style_border_opa(b, LV_OPA_COVER, LV_PART_MAIN);
92 lv_obj_t *d = lv_obj_create(parent);
93 lv_obj_set_size(d,
SCR_W - 48, 2);
94 lv_obj_align(d, LV_ALIGN_TOP_MID, 0, y);
95 lv_obj_set_style_bg_color(d,
COL_BORDER, LV_PART_MAIN);
96 lv_obj_set_style_border_width(d, 0, LV_PART_MAIN);
97 lv_obj_set_style_radius(d, 1, LV_PART_MAIN);
98 lv_obj_set_style_pad_all(d, 0, LV_PART_MAIN);
99 lv_obj_clear_flag(d, LV_OBJ_FLAG_SCROLLABLE);
102#define BADGE_SZ (COIN_SZ + 6)
104 lv_color_t bg, lv_coord_t sz) {
105 lv_obj_t *d = lv_obj_create(parent);
106 lv_obj_remove_style_all(d);
107 lv_obj_set_size(d, sz, sz);
108 lv_obj_set_style_bg_color(d, bg, LV_PART_MAIN);
109 lv_obj_set_style_bg_opa(d, LV_OPA_COVER, LV_PART_MAIN);
110 lv_obj_set_style_radius(d, LV_RADIUS_CIRCLE, LV_PART_MAIN);
111 lv_obj_clear_flag(d, LV_OBJ_FLAG_SCROLLABLE);
112 lv_obj_clear_flag(d, LV_OBJ_FLAG_CLICKABLE);
113 lv_obj_t *l = lv_label_create(d);
114 lv_label_set_text(l, sym);
115 lv_obj_set_style_text_color(l,
COL_BG, LV_PART_MAIN);
129static lv_obj_t *
make_icon_box(lv_obj_t *parent,
const lv_img_dsc_t *coin_src,
130 const lv_img_dsc_t *chip_src) {
131 lv_obj_t *box = lv_obj_create(parent);
132 lv_obj_remove_style_all(box);
135 lv_obj_clear_flag(box, LV_OBJ_FLAG_SCROLLABLE);
136 lv_obj_clear_flag(box, LV_OBJ_FLAG_CLICKABLE);
138 lv_obj_t *coin = lv_img_create(box);
139 lv_img_set_src(coin, coin_src);
142 if (chip_src != NULL) {
143 lv_obj_t *chip = lv_img_create(box);
144 lv_img_set_src(chip, chip_src);
145 lv_obj_align(chip, LV_ALIGN_BOTTOM_RIGHT, 0, 0);
173 const int n = (int)a->
net;
187 lv_obj_set_style_bg_grad_dir(
s_asset_btn, LV_GRAD_DIR_NONE, LV_PART_MAIN);
188 lv_obj_set_style_bg_opa(
s_asset_btn, LV_OPA_COVER, LV_PART_MAIN);
189 lv_obj_set_style_radius(
s_asset_btn, LV_RADIUS_CIRCLE, LV_PART_MAIN);
190 lv_obj_set_style_border_width(
s_asset_btn, 0, LV_PART_MAIN);
191 lv_obj_set_style_shadow_width(
s_asset_btn, 0, LV_PART_MAIN);
194 LV_PART_MAIN | LV_STATE_PRESSED);
196 reinterpret_cast<void *
>(
201 lv_obj_set_flex_flow(
s_asset_btn, LV_FLEX_FLOW_ROW);
202 lv_obj_set_flex_align(
s_asset_btn, LV_FLEX_ALIGN_CENTER,
203 LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
205 lv_obj_set_style_pad_column(
s_asset_btn, 5, LV_PART_MAIN);
206 lv_obj_clear_flag(
s_asset_btn, LV_OBJ_FLAG_SCROLLABLE);
210 LV_ALIGN_DEFAULT, 0, 0);
221 if (compact) { lv_obj_add_flag(
s_asset_arrow, LV_OBJ_FLAG_HIDDEN); }
222 else { lv_obj_clear_flag(
s_asset_arrow, LV_OBJ_FLAG_HIDDEN); }
246#define TAP_MARK_W 109
251#define COL_TAP_MARK COL_TEXT
253 lv_obj_t *img = lv_img_create(parent);
255 lv_obj_clear_flag(img, LV_OBJ_FLAG_CLICKABLE);
257 lv_obj_set_style_img_recolor(img,
COL_TAP_MARK, LV_PART_MAIN);
258 lv_obj_set_style_img_recolor_opa(img, LV_OPA_COVER, LV_PART_MAIN);
259 lv_obj_align(img, LV_ALIGN_TOP_MID, 0, y);
261#define PILL_TEXT_X 52
264#define PILL_TEXT_PAD_R 24
265lv_obj_t *
make_pill(lv_obj_t *parent,
const char *title,
const char *sub,
266 lv_coord_t w, lv_coord_t y,
BtnAction act,
268 lv_obj_t *btn = lv_btn_create(parent);
269 lv_obj_set_size(btn, w,
PILL_H);
270 lv_obj_align(btn, LV_ALIGN_TOP_MID, 0, y);
271 lv_obj_set_style_bg_color(btn,
COL_SURFACE, LV_PART_MAIN);
272 lv_obj_set_style_bg_grad_dir(btn, LV_GRAD_DIR_NONE, LV_PART_MAIN);
273 lv_obj_set_style_bg_opa(btn, LV_OPA_COVER, LV_PART_MAIN);
274 lv_obj_set_style_radius(btn, LV_RADIUS_CIRCLE, LV_PART_MAIN);
275 lv_obj_set_style_border_width(btn, 0, LV_PART_MAIN);
276 lv_obj_set_style_shadow_width(btn, 0, LV_PART_MAIN);
277 lv_obj_set_style_pad_all(btn, 0, LV_PART_MAIN);
278 lv_obj_set_style_bg_color(btn,
280 LV_PART_MAIN | LV_STATE_PRESSED);
281 lv_obj_add_event_cb(btn,
btn_event_cb, LV_EVENT_CLICKED,
282 reinterpret_cast<void *
>(
static_cast<intptr_t
>(act)));
295 lv_label_set_long_mode(sl, LV_LABEL_LONG_DOT);
305 LV_ALIGN_RIGHT_MID, -14, 0);
317 const char *value, lv_color_t col) {
318 lv_obj_t *box = lv_obj_create(parent);
319 lv_obj_remove_style_all(box);
320 lv_obj_set_size(box,
TAB_W, LV_SIZE_CONTENT);
321 lv_obj_clear_flag(box, LV_OBJ_FLAG_SCROLLABLE);
322 lv_obj_set_flex_flow(box, LV_FLEX_FLOW_COLUMN);
323 lv_obj_set_style_pad_row(box, 4, LV_PART_MAIN);
326 LV_ALIGN_DEFAULT, 0, 0);
328 LV_ALIGN_DEFAULT, 0, 0);
329 lv_obj_set_width(v,
TAB_W);
330 lv_label_set_long_mode(v, LV_LABEL_LONG_WRAP);
335 lv_obj_set_y(
static_cast<lv_obj_t *
>(obj),
static_cast<lv_coord_t
>(v));
342 lv_obj_t *sh = lv_obj_create(lv_scr_act());
343 lv_obj_remove_style_all(sh);
345 lv_obj_set_pos(sh, 0,
SCR_H);
346 lv_obj_set_style_bg_color(sh,
COL_BG, LV_PART_MAIN);
347 lv_obj_set_style_bg_opa(sh, LV_OPA_COVER, LV_PART_MAIN);
348 lv_obj_clear_flag(sh, LV_OBJ_FLAG_SCROLLABLE);
357 lv_anim_set_var(&a, sh);
359 lv_anim_set_values(&a,
SCR_H, 0);
360 lv_anim_set_time(&a, 260);
363 lv_anim_set_path_cb(&a, lv_anim_path_ease_out);
372 if (ta == NULL) {
return; }
373 char *t =
const_cast<char *
>(lv_textarea_get_text(ta));
374 if (t != NULL) { CW_Utils::secure_wipe(
reinterpret_cast<uint8_t *
>(t), strlen(t)); }
375 char *l = lv_label_get_text(lv_textarea_get_label(ta));
376 if (l != NULL) { CW_Utils::secure_wipe(
reinterpret_cast<uint8_t *
>(l), strlen(l)); }
379 lv_obj_t *scr = lv_scr_act();
384 lv_obj_set_style_bg_color(scr,
COL_BG, LV_PART_MAIN);
388 lv_obj_set_style_bg_grad_dir(scr, LV_GRAD_DIR_NONE, LV_PART_MAIN);
389 lv_obj_set_style_bg_opa(scr, LV_OPA_COVER, LV_PART_MAIN);
440 const time_t utc = time(NULL);
443 if (utc < (time_t)1700000000) {
451 if (gmtime_r(&local, &tmv) == NULL) {
456 (void)snprintf(b,
sizeof(b),
"%02d:%02d", tmv.tm_hour, tmv.tm_min);
471 lv_obj_set_style_bg_color(obj,
COL_PAGE, LV_PART_MAIN);
472 lv_obj_set_style_bg_grad_color(obj,
COL_PAGE_GRAD, LV_PART_MAIN);
473 lv_obj_set_style_bg_grad_dir(obj, LV_GRAD_DIR_VER, LV_PART_MAIN);
474 lv_obj_set_style_bg_opa(obj, LV_OPA_COVER, LV_PART_MAIN);
482 lv_obj_t *card = lv_obj_create(parent);
483 lv_obj_remove_style_all(card);
486 lv_obj_set_style_bg_color(card,
COL_BG, LV_PART_MAIN);
487 lv_obj_set_style_bg_opa(card, LV_OPA_COVER, LV_PART_MAIN);
488 lv_obj_set_style_radius(card, 14, LV_PART_MAIN);
489 lv_obj_clear_flag(card, LV_OBJ_FLAG_SCROLLABLE);
510 lv_obj_t *card =
make_card(lv_scr_act());
515 lv_obj_t *home = lv_obj_create(lv_scr_act());
516 lv_obj_remove_style_all(home);
517 lv_obj_set_size(home, 84, 5);
518 lv_obj_align(home, LV_ALIGN_BOTTOM_MID, 0, -9);
519 lv_obj_set_style_radius(home, LV_RADIUS_CIRCLE, LV_PART_MAIN);
520 lv_obj_set_style_bg_opa(home, LV_OPA_COVER, LV_PART_MAIN);
521 lv_obj_set_style_bg_color(home,
COL_HOME_BAR, LV_PART_MAIN);
534 lv_obj_t *btn = lv_btn_create((parent != NULL) ? parent : lv_scr_act());
537 lv_obj_set_style_bg_opa(btn, LV_OPA_TRANSP, LV_PART_MAIN);
538 lv_obj_set_style_border_width(btn, 0, LV_PART_MAIN);
539 lv_obj_set_style_shadow_width(btn, 0, LV_PART_MAIN);
540 lv_obj_add_event_cb(btn,
btn_event_cb, LV_EVENT_CLICKED,
541 reinterpret_cast<void *
>(
static_cast<intptr_t
>(act)));
542 lv_obj_t *lbl = lv_label_create(btn);
543 lv_label_set_text(lbl, sym);
544 lv_obj_set_style_text_color(lbl,
COL_TEXT, LV_PART_MAIN);
563 lv_obj_t *chip = lv_label_create(lv_scr_act());
564 lv_label_set_text(chip,
"TEST");
565 lv_obj_set_style_text_color(chip,
COL_BG, LV_PART_MAIN);
567 lv_obj_set_style_bg_color(chip,
COL_DANGER, LV_PART_MAIN);
568 lv_obj_set_style_bg_opa(chip, LV_OPA_COVER, LV_PART_MAIN);
569 lv_obj_set_style_pad_hor(chip, 7, LV_PART_MAIN);
570 lv_obj_set_style_pad_ver(chip, 1, LV_PART_MAIN);
571 lv_obj_set_style_radius(chip, LV_RADIUS_CIRCLE, LV_PART_MAIN);
590 lv_obj_t *host = (parent != NULL) ? parent : lv_scr_act();
591 lv_obj_update_layout(host);
592 lv_coord_t hw = lv_obj_get_width(host);
593 if (hw <= 0) { hw =
SCR_W; }
598 const lv_coord_t avail = hw - (2 * gutter);
601 0, LV_TEXT_FLAG_NONE) > avail;
609 lv_obj_set_width(l, avail);
610 lv_label_set_long_mode(l, LV_LABEL_LONG_DOT);
611 lv_obj_set_style_text_align(l, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
655#define SIG_REACH (SIG_R0 + ((SIG_ARCS - 1) * SIG_RSTEP) + (SIG_AW / 2))
656#define SIG_W (2 * SIG_REACH)
657#define SIG_H (SIG_REACH + ((SIG_DOT + 1) / 2))
673 const int lit = !up ? 0 : (rssi >= -60) ? 3 : (rssi >= -70) ? 2 : 1;
674 for (
int i = 0; i <
SIG_ARCS; i++) {
704 if (show) { lv_obj_clear_flag(
s_sig_box, LV_OBJ_FLAG_HIDDEN); }
705 else { lv_obj_add_flag(
s_sig_box, LV_OBJ_FLAG_HIDDEN); }
711 s_sig_box = lv_obj_create(lv_layer_top());
715 lv_obj_clear_flag(
s_sig_box, LV_OBJ_FLAG_SCROLLABLE);
716 lv_obj_clear_flag(
s_sig_box, LV_OBJ_FLAG_CLICKABLE);
721 for (
int i = 0; i <
SIG_ARCS; i++) {
724 lv_obj_remove_style_all(a);
727 lv_obj_set_size(a, d, d);
728 lv_obj_set_pos(a, cx - (d / 2), cy - (d / 2));
732 lv_obj_set_style_arc_width(a,
SIG_AW, LV_PART_MAIN);
735 lv_obj_set_style_arc_rounded(a,
false, LV_PART_MAIN);
736 lv_obj_clear_flag(a, LV_OBJ_FLAG_CLICKABLE);
744 lv_obj_set_style_bg_opa(
s_sig_dot, LV_OPA_COVER, LV_PART_MAIN);
745 lv_obj_set_style_radius(
s_sig_dot, LV_RADIUS_CIRCLE, LV_PART_MAIN);
746 lv_obj_clear_flag(
s_sig_dot, LV_OBJ_FLAG_CLICKABLE);
761 lv_obj_t *sheet = NULL;
798 uint32_t lockout = 450U;
static const pos_asset_t * pos_asset_of(pos_chain_t chain)
The row describing chain.
pos_net_t
A network, as the picker's first step offers it.
const lv_img_dsc_t chip_eth
const lv_img_dsc_t chip_tron
const lv_img_dsc_t icon_eth
const lv_img_dsc_t icon_usdt
const lv_img_dsc_t icon_tron
const lv_img_dsc_t icon_poly
const lv_img_dsc_t icon_usdc
const lv_img_dsc_t chip_poly
int civil_local_offset_min(int64_t utc, int std_off_min, int rule)
Offset from UTC in force at utc, DST included.
lv_font_t font_inter_14_medium
lv_font_t font_pjs_20_medium
lv_font_t font_pjs_20_semibold
bool net_wifi_rssi(int8_t *rssi_out)
Read the RSSI of the currently associated access point.
bool net_wifi_reconnecting(void)
true while a kept network is down and the re-join is running.
pos_chain_t settings_get_chain(void)
Selected chain, or POS_CHAIN_ETH_USDC if never set.
int16_t settings_get_tz_offset_min(void)
The panel clock's standard (winter) offset from UTC, in minutes east.
uint8_t settings_get_tz_dst(void)
The clock's DST rule, a civil_dst_t; CIVIL_DST_NONE when unset.
bool settings_get_mainnet(void)
true when the terminal is on the production networks.
pos_chain_t
Which chain (and therefore which asset) the terminal charges in.
const lv_img_dsc_t tap_icon
void btn_event_cb(lv_event_t *e)
volatile bool s_sheet_pending
lv_obj_t * s_cal_countdown
lv_obj_t * s_amount_cents_label
lv_obj_t * s_fee_prio_lbl
lv_obj_t * s_amount_label
lv_obj_t * s_wifi_eye_lbl
lv_obj_t * s_boot_step_lbl
volatile ui_screen_t s_req_screen
const char * asset_name(pos_chain_t c)
lv_obj_t * s_admin_note_lbl
lv_obj_t * s_wifi_pass_ta
@ UI_SCREEN_WIFI_CONNECTING
void build_admin_set(void)
void build_admin_unlock(void)
void build_settings(void)
void build_touch_cal(void)
uint32_t s_input_block_until
Private to the ui*.cpp files: the state and helpers they share.
void build_wifi_list(void)
void build_wifi_pass(void)
void build_card_wait(void)
void build_tx_status(void)
void build_boot_error(void)
void build_wifi_connecting(void)