|
cryptnox-pos 1.0.0
Standalone USDC payment terminal firmware (ESP32 + Cryptnox smart card)
|
The settings page, touch calibration and the admin-code screens. More...
#include "ui_internal.h"Go to the source code of this file.
Macros | |
| #define | OTA_GAP 8 |
| #define | OTA_CARD_PAD 8 /* open_modal()'s pad_all */ |
| #define | PICK_W 206 |
| #define | ADMIN_PENALTY_MAX_S 3600U |
| Wait imposed after repeated wrong admin codes. | |
Functions | |
| void | settings_persist (void) |
| static void | brightness_event_cb (lv_event_t *e) |
| static void | settings_bottom_bar (uint16_t tab) |
| static void | tab_change_cb (lv_event_t *e) |
| void | build_settings (void) |
| static void | cal_target (lv_coord_t cx, lv_coord_t cy) |
| static bool | cal_apply (void) |
| void | build_touch_cal (void) |
| void | touch_cal_poll (void) |
| void | close_modal (void) |
| lv_obj_t * | open_modal (lv_coord_t w, lv_coord_t h) |
| void | open_reset_confirm (void) |
| lv_obj_t * | ota_text (lv_obj_t *card, lv_obj_t *above, const char *txt, lv_color_t col, const lv_font_t *font) |
| void | ota_fit_card (lv_obj_t *card, lv_obj_t *last, lv_coord_t buttons_h) |
| void | open_portal_window (void) |
| void | open_ota_gone (void) |
| void | build_ota_confirm (void) |
| static void | pill_disable (lv_obj_t *p) |
| void | open_network_picker (void) |
| void | open_coin_picker (pos_net_t net) |
| uint32_t | admin_penalty_ms (uint8_t fails) |
| static void | wait_text (char *out, size_t n, uint32_t secs) |
| static uint32_t | admin_lock_remaining_s (void) |
| static void | admin_set_note (const char *msg) |
| static void | admin_submit (void) |
| static void | admin_kbd_cb (lv_event_t *e) |
| static void | build_admin_screen (const char *title, bool allow_cancel, const char *hint) |
| void | build_admin_set (void) |
| void | build_admin_unlock (void) |
Variables | |
| static lv_obj_t * | s_modal = NULL |
| bool | s_portal_modal = false |
| static const BtnAction | NET_ACT [POS_NET__COUNT] |
The settings page, touch calibration and the admin-code screens.
Definition in file ui_admin.cpp.
| #define ADMIN_PENALTY_MAX_S 3600U |
Wait imposed after repeated wrong admin codes.
Free for the first three tries, then doubling — 1 s, 2 s, 4 s ... — and still doubling past a minute, up to an hour per attempt from the fifteenth wrong code on. The count is in NVS, so a power cycle restarts the current wait rather than resetting it. Never a permanent lock: the code gates the factory reset too, so locking for good would leave no way back in short of a USB reflash.
Definition at line 738 of file ui_admin.cpp.
Referenced by admin_penalty_ms().
| #define OTA_CARD_PAD 8 /* open_modal()'s pad_all */ |
Definition at line 474 of file ui_admin.cpp.
Referenced by ota_fit_card().
| #define OTA_GAP 8 |
Definition at line 473 of file ui_admin.cpp.
Referenced by ota_fit_card(), and ota_text().
| #define PICK_W 206 |
Definition at line 634 of file ui_admin.cpp.
Referenced by open_coin_picker(), and open_network_picker().
|
static |
Definition at line 872 of file ui_admin.cpp.
References admin_submit(), and s_admin_ta.
Referenced by build_admin_screen().
|
static |
Definition at line 756 of file ui_admin.cpp.
References s_admin_lock_ms, and s_admin_lock_start.
Referenced by admin_submit().
| uint32_t admin_penalty_ms | ( | uint8_t | fails | ) |
Definition at line 739 of file ui_admin.cpp.
References ADMIN_PENALTY_MAX_S.
Referenced by admin_submit(), open_admin_entry(), and ui_show_prov_auth().
|
static |
Definition at line 766 of file ui_admin.cpp.
References s_admin_note, and s_admin_note_lbl.
Referenced by admin_submit().
|
static |
Definition at line 774 of file ui_admin.cpp.
References ADMIN_CODE_MAX, ADMIN_CODE_MIN, ADMIN_CODE_MIN_STORED, admin_lock_remaining_s(), admin_penalty_ms(), admin_set_note(), prov_auth_resolve(), prov_mode(), PROV_MODE_WIZARD, request_screen(), s_admin_confirming, s_admin_first, s_admin_for_portal, s_admin_lock_ms, s_admin_lock_start, s_admin_note, s_admin_ta, s_cb, s_req_screen, s_view_chain, set_wifi_progress(), settings_admin_fail_count(), settings_check_admin_code(), settings_get_chain(), settings_set_admin_code(), UI_EVENT_ADMIN_SET, UI_SCREEN_ADMIN_SET, UI_SCREEN_PROV, UI_SCREEN_SETTINGS, UI_SCREEN_WIFI_CONNECTING, and wait_text().
Referenced by admin_kbd_cb().
|
static |
Definition at line 23 of file ui_admin.cpp.
References backlight_set_pct(), and s_brightness.
Referenced by build_settings().
|
static |
Definition at line 888 of file ui_admin.cpp.
References ACT_ADMIN_CANCEL, ACT_ADMIN_REVEAL, ADMIN_CODE_MAX, admin_kbd_cb(), build_page(), CODE_KBD_W, COL_DANGER, font_inter_14, make_card(), make_code_row(), make_icon_button(), make_label(), make_numeric_keypad(), make_title(), paint_page(), PAY_STEP_NONE, s_admin_eye_lbl, s_admin_note, s_admin_note_lbl, s_admin_ta, and s_sheet.
Referenced by build_admin_set(), and build_admin_unlock().
| void build_admin_set | ( | void | ) |
Definition at line 922 of file ui_admin.cpp.
References build_admin_screen(), and s_admin_confirming.
Referenced by render_requested_screen().
| void build_admin_unlock | ( | void | ) |
Definition at line 929 of file ui_admin.cpp.
References build_admin_screen(), prov_pair_code(), and s_admin_for_portal.
Referenced by render_requested_screen().
| void build_ota_confirm | ( | void | ) |
Definition at line 593 of file ui_admin.cpp.
References ACT_OTA_NO, ACT_OTA_OK, COL_ACTION, COL_BG, COL_DANGER, COL_DIM, COL_TEXT, font_inter_14, font_pjs_20_medium, font_pjs_20_semibold, font_pjs_28_semibold, make_button(), open_modal(), OTA_CARD_W, ota_fit_card(), ota_running_version(), ota_staged(), ota_text(), OTA_TEXT_W, ota_version_display(), OTA_VERSION_SHOWN_MAX, and s_portal_modal.
Referenced by ui_task().
| void build_settings | ( | void | ) |
Definition at line 64 of file ui_admin.cpp.
References ACT_BTN_H, ACT_BTN_Y, ACT_CLOSE, ACT_NET_PICK, ACT_PORTAL, ACT_RESET, ACT_TOUCH_CAL, asset_caption(), asset_name(), asset_network(), brightness_event_cb(), clear_screen(), COIN_SZ, COL_ACCENT, COL_ACTION, COL_BG, COL_BORDER, COL_DANGER, COL_DIM, COL_TEXT, font_inter_14, font_inter_14_medium, font_pjs_20_medium, font_pjs_20_semibold, make_asset_badge(), make_button(), make_field(), make_glyph_disc(), make_label(), make_pill(), net_wifi_rssi(), ota_last_update_failed(), ota_running_version(), ota_version_display(), OTA_VERSION_SHOWN_MAX, PILL_ICON_X, pos_chain_is_tron(), s_addr_dest, s_addr_usdc, s_brightness, s_close_btn, s_fee_max_lbl, s_fee_prio_lbl, s_reset_btn, s_settings_tab, s_view_chain, SCR_H, SCR_W, settings_bottom_bar(), settings_get_max_fee_gwei(), settings_get_priority_fee_gwei(), settings_get_wifi(), settings_has_payout(), tab_change_cb(), TAB_PAD, TAB_W, and ui_refresh_addresses_for().
Referenced by render_requested_screen().
| void build_touch_cal | ( | void | ) |
Definition at line 331 of file ui_admin.cpp.
References ACT_BTN_H, ACT_BTN_Y, ACT_CAL_CANCEL, ACT_CAL_SAVE, build_header(), cal_apply(), CAL_INSET, cal_target(), CAL_VERIFY_MS, clear_screen(), COL_ACTION, COL_BG, COL_DANGER, COL_DIM, COL_TEXT, font_inter_14, font_pjs_20_medium, font_pjs_20_semibold, make_button(), make_label(), s_cal_countdown, s_cal_deadline, s_cal_step, SCR_H, and SCR_W.
Referenced by render_requested_screen().
|
static |
Definition at line 320 of file ui_admin.cpp.
References CAL_INSET, s_cal_raw, s_cal_xmax, s_cal_xmin, s_cal_ymax, s_cal_ymin, SCR_H, SCR_W, touch_cal_from_corners(), touch_cal_t::x_max, touch_cal_t::x_min, touch_cal_t::y_max, and touch_cal_t::y_min.
Referenced by build_touch_cal().
|
static |
Definition at line 302 of file ui_admin.cpp.
References COL_DANGER.
Referenced by build_touch_cal().
| void close_modal | ( | void | ) |
Definition at line 424 of file ui_admin.cpp.
References s_modal, and s_portal_modal.
Referenced by btn_event_cb(), open_modal(), render_requested_screen(), and ui_task().
| void open_coin_picker | ( | pos_net_t | net | ) |
Step 2 — the coin on the network chosen in step 1.
Definition at line 692 of file ui_admin.cpp.
References ACT_CHAIN_OF, ACT_NET_PICK, pos_asset_t::chain, COL_DIM, COL_SURFACE, COL_TEXT, font_inter_14, font_pjs_20_semibold, make_asset_badge(), make_button(), make_label(), make_pill(), pos_asset_t::net, open_modal(), PICK_W, PILL_H, PILL_ICON_X, POS_ASSET_COUNT, POS_ASSETS, pos_net_info(), pos_asset_t::standard, and pos_asset_t::ticker.
Referenced by btn_event_cb().
| lv_obj_t * open_modal | ( | lv_coord_t | w, |
| lv_coord_t | h ) |
Definition at line 434 of file ui_admin.cpp.
References close_modal(), COL_BG, COL_BORDER, s_modal, SCR_H, and SCR_W.
Referenced by build_ota_confirm(), build_prov_confirm(), open_coin_picker(), open_network_picker(), open_ota_gone(), open_portal_window(), and open_reset_confirm().
| void open_network_picker | ( | void | ) |
Definition at line 656 of file ui_admin.cpp.
References ACT_MODAL_CLOSE, COL_DIM, COL_SURFACE, COL_TEXT, font_inter_14, font_pjs_20_semibold, make_button(), make_label(), make_net_badge(), make_pill(), pos_net_info_t::name, NET_ACT, open_modal(), PICK_W, pill_disable(), PILL_H, PILL_ICON_X, POS_NET__COUNT, pos_net_info(), POS_NET_TRON, settings_has_payout(), settings_net_str(), pos_net_info_t::sub_main, and pos_net_info_t::sub_test.
Referenced by btn_event_cb().
| void open_ota_gone | ( | void | ) |
Accept or refuse firmware that the update page has uploaded.
The upload is already verified (SHA-256, and the signature on a signed build), so this asks whether the person holding the terminal wants this version, which a browser cannot answer. A downgrade is called out: it is properly signed too, and returning to firmware with a known fault is something to be talked into. Install was tapped and there was nothing left to install.
Says so, so a terminal that stayed on the old firmware does not look updated.
Definition at line 581 of file ui_admin.cpp.
References ACT_MODAL_CLOSE, COL_ACTION, COL_BG, COL_TEXT, font_inter_14, font_pjs_20_semibold, make_button(), open_modal(), OTA_CARD_W, ota_fit_card(), ota_text(), and OTA_TEXT_W.
Referenced by btn_event_cb().
| void open_portal_window | ( | void | ) |
Definition at line 510 of file ui_admin.cpp.
References ACT_MODAL_CLOSE, ACT_PORTAL_CLOSE, COL_ACTION, COL_BG, COL_DIM, COL_TEXT, font_inter_14, font_inter_14_medium, font_pjs_20_semibold, make_button(), open_modal(), OTA_CARD_W, ota_fit_card(), ota_text(), OTA_TEXT_W, prov_ap_pass(), prov_ap_ssid(), PROV_MODE_ADMIN, prov_qr_payload(), prov_start(), prov_window_left_min(), s_cb, and s_portal_modal.
Referenced by btn_event_cb().
| void open_reset_confirm | ( | void | ) |
Definition at line 457 of file ui_admin.cpp.
References ACT_MODAL_CLOSE, ACT_RESET_CONFIRM, COL_ACTION, COL_BG, COL_DANGER, COL_TEXT, font_inter_14, font_pjs_20_semibold, make_button(), make_label(), and open_modal().
Referenced by btn_event_cb().
| void ota_fit_card | ( | lv_obj_t * | card, |
| lv_obj_t * | last, | ||
| lv_coord_t | buttons_h ) |
Resize the card to the text it ended up with, leaving room for the buttons.
buttons_h is how far the button block reaches up from the content bottom — 42 for one 40 px button at -2, 86 for two. Clamped to the screen, so a pathological string elides off the bottom rather than drawing a card taller than the panel.
Definition at line 502 of file ui_admin.cpp.
References OTA_CARD_PAD, OTA_GAP, and SCR_H.
Referenced by build_ota_confirm(), build_prov_confirm(), open_ota_gone(), and open_portal_window().
| lv_obj_t * ota_text | ( | lv_obj_t * | card, |
| lv_obj_t * | above, | ||
| const char * | txt, | ||
| lv_color_t | col, | ||
| const lv_font_t * | font ) |
Wrapped, centred body text stacked under above (or the card top).
Definition at line 477 of file ui_admin.cpp.
References make_label(), OTA_GAP, and OTA_TEXT_W.
Referenced by build_ota_confirm(), build_prov_confirm(), open_ota_gone(), and open_portal_window().
|
static |
Grey a row out and make it inert.
For a network whose payout address nobody has set. Shown rather than hidden, so the dimmed row tells the operator what to go and do.
Definition at line 642 of file ui_admin.cpp.
References COL_DIM.
Referenced by open_network_picker().
|
static |
Definition at line 38 of file ui_admin.cpp.
References ACT_BTN_Y, s_close_btn, s_reset_btn, and TAB_ABOUT.
Referenced by build_settings(), and tab_change_cb().
| void settings_persist | ( | void | ) |
Definition at line 19 of file ui_admin.cpp.
References s_brightness, and settings_set_brightness().
Referenced by btn_event_cb().
|
static |
Definition at line 55 of file ui_admin.cpp.
References s_settings_tab, settings_bottom_bar(), and SETTINGS_TAB_COUNT.
Referenced by build_settings().
| void touch_cal_poll | ( | void | ) |
Definition at line 397 of file ui_admin.cpp.
References request_screen(), s_cal_last_x, s_cal_last_y, s_cal_pressed, s_cal_raw, s_cal_step, touch_raw(), and UI_SCREEN_TOUCH_CAL.
Referenced by ui_task().
|
static |
Definition at line 750 of file ui_admin.cpp.
Referenced by admin_submit().
|
static |
Step 1 — the network.
Definition at line 653 of file ui_admin.cpp.
Referenced by open_network_picker().
|
static |
Definition at line 418 of file ui_admin.cpp.
Referenced by close_modal(), and open_modal().
| bool s_portal_modal = false |
Definition at line 423 of file ui_admin.cpp.
Referenced by build_ota_confirm(), close_modal(), open_portal_window(), and ui_task().