Fix BLE UI log area overlapping bottom buttons.
Constrain log to a scroll box above the button bar. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
name: CYD BLE (cyd)
|
||||
git: 8baea73
|
||||
git: e987685
|
||||
date: 2026-10-23
|
||||
board: ESP32-2432S028R (ILI9341)
|
||||
features: NimBLE Nordic UART, LVGL status UI, SoftSPI touch
|
||||
@@ -12,5 +12,5 @@ offsets:
|
||||
sha256:
|
||||
bootloader.bin 3D234A7471F67B013686DABD4DEE7C1FA915C9928463616A94BC9297ACF1ABF8
|
||||
boot_app0.bin F94C5D786A7A8FAB06AC5D10E33BF37711A6697636DC037559EA19CC410A17F0
|
||||
firmware.bin BE8534B98EDF84B1147E04B0A3D56372A877957D34BB245458B511E8E3D66EF0
|
||||
firmware.bin 9261E7E8139BF7795FCF03CBBD007C5C83F782FE238345E8280BC06559AD7704
|
||||
partitions.bin 0A8B5720E7B77FF11F1462458C3A509DEE79224E5279898F26D6A2E3AE0517B7
|
||||
|
||||
Binary file not shown.
@@ -76,6 +76,7 @@ static void append_log(const char *line) {
|
||||
}
|
||||
if (lbl_log) {
|
||||
lv_label_set_text(lbl_log, g_log);
|
||||
lv_obj_scroll_to_view(lbl_log, LV_ANIM_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,34 +225,47 @@ void ble_ui_create() {
|
||||
lv_obj_set_pos(lbl_echo, 10, 114);
|
||||
|
||||
lv_obj_t *hint = lv_label_create(scr);
|
||||
lv_label_set_text(hint, "Phone: nRF Connect / Serial BT Terminal");
|
||||
lv_label_set_text(hint, "App: nRF Connect / Serial BT");
|
||||
lv_obj_set_style_text_color(hint, lv_color_hex(COL_MUTED), 0);
|
||||
lv_obj_set_style_text_font(hint, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_pos(hint, 10, 134);
|
||||
|
||||
lbl_log = lv_label_create(scr);
|
||||
lv_label_set_text(lbl_log, g_log);
|
||||
lv_label_set_long_mode(lbl_log, LV_LABEL_LONG_WRAP);
|
||||
lv_obj_set_width(lbl_log, UI_HOR_RES - 20);
|
||||
lv_obj_set_style_text_color(lbl_log, lv_color_hex(COL_INK), 0);
|
||||
lv_obj_set_style_text_font(lbl_log, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_pos(lbl_log, 10, 156);
|
||||
|
||||
const int bw = 72;
|
||||
const int bh = 36;
|
||||
const int y = UI_VER_RES - bh - 8;
|
||||
const int btn_y = UI_VER_RES - bh - 8;
|
||||
const int log_y = 154;
|
||||
const int log_h = btn_y - log_y - 6; // 不侵入底部按钮带
|
||||
|
||||
lv_obj_t *log_box = lv_obj_create(scr);
|
||||
lv_obj_set_pos(log_box, 8, log_y);
|
||||
lv_obj_set_size(log_box, UI_HOR_RES - 16, log_h);
|
||||
lv_obj_set_style_bg_color(log_box, lv_color_hex(0x121A24), 0);
|
||||
lv_obj_set_style_bg_opa(log_box, LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_border_width(log_box, 0, 0);
|
||||
lv_obj_set_style_radius(log_box, 6, 0);
|
||||
lv_obj_set_style_pad_all(log_box, 6, 0);
|
||||
lv_obj_set_scroll_dir(log_box, LV_DIR_VER);
|
||||
lv_obj_clear_flag(log_box, LV_OBJ_FLAG_SCROLL_ELASTIC);
|
||||
|
||||
lbl_log = lv_label_create(log_box);
|
||||
lv_label_set_text(lbl_log, g_log);
|
||||
lv_label_set_long_mode(lbl_log, LV_LABEL_LONG_WRAP);
|
||||
lv_obj_set_width(lbl_log, UI_HOR_RES - 36);
|
||||
lv_obj_set_style_text_color(lbl_log, lv_color_hex(COL_INK), 0);
|
||||
lv_obj_set_style_text_font(lbl_log, &lv_font_montserrat_14, 0);
|
||||
|
||||
btn_adv = make_btn(scr, "Stop Adv", COL_BTN_ACC, on_adv, bw, bh);
|
||||
lbl_adv = lv_obj_get_child(btn_adv, 0);
|
||||
lv_obj_set_pos(btn_adv, 8, y);
|
||||
lv_obj_set_pos(btn_adv, 8, btn_y);
|
||||
|
||||
lv_obj_t *btn_echo = make_btn(scr, "Echo", COL_BTN, on_echo, bw, bh);
|
||||
lv_obj_set_pos(btn_echo, 8 + bw + 6, y);
|
||||
lv_obj_set_pos(btn_echo, 8 + bw + 6, btn_y);
|
||||
|
||||
lv_obj_t *btn_ping = make_btn(scr, "Ping", COL_BTN_ACC, on_ping, bw, bh);
|
||||
lv_obj_set_pos(btn_ping, 8 + 2 * (bw + 6), y);
|
||||
lv_obj_set_pos(btn_ping, 8 + 2 * (bw + 6), btn_y);
|
||||
|
||||
lv_obj_t *btn_clear = make_btn(scr, "Clear", COL_BTN_WARN, on_clear, bw, bh);
|
||||
lv_obj_set_pos(btn_clear, 8 + 3 * (bw + 6), y);
|
||||
lv_obj_set_pos(btn_clear, 8 + 3 * (bw + 6), btn_y);
|
||||
|
||||
refresh_static();
|
||||
refresh_state();
|
||||
|
||||
Reference in New Issue
Block a user