Add live capture visuals: progress bar, blinking active targets, per-network state

- Progress bar under status line shows captured/total WPA targets
- Three visual states per network:
  Green (pending) -> Orange blinking (active target) -> Red + checkmark (captured)
- Active targets show live info: client count during observation,
  EAPOL progress during capture (e.g. " NetworkName 1/2")
- Status line shows channel number and phase context
- LVGL symbols: lightning bolt for active, checkmark for captured
- Title updated to " Capture" with WiFi icon

Made-with: Cursor
This commit is contained in:
drjones
2026-03-17 22:25:46 -07:00
parent 09f1a7969e
commit ec3e0449a1
3 changed files with 154 additions and 24 deletions

View File

@@ -8,6 +8,8 @@ static lv_obj_t *list_label = nullptr;
static lv_obj_t *network_container = nullptr;
static lv_obj_t *network_labels[20] = {nullptr};
static int network_count = 0;
static lv_obj_t *progress_bar = nullptr;
static lv_obj_t *progress_label = nullptr;
void Ui_SetWifiStatus(const char *text) {
if (status_label != nullptr) {
@@ -51,6 +53,32 @@ void Ui_SetNetworkText(int index, const char* text) {
lv_label_set_text(network_labels[index], text);
}
void Ui_SetProgress(int current, int total) {
if (progress_bar == nullptr) return;
if (total <= 0) {
lv_bar_set_value(progress_bar, 0, LV_ANIM_OFF);
if (progress_label) lv_label_set_text(progress_label, "");
return;
}
int pct = (current * 100) / total;
lv_bar_set_value(progress_bar, pct, LV_ANIM_ON);
char buf[16];
snprintf(buf, sizeof(buf), "%d/%d", current, total);
if (progress_label) lv_label_set_text(progress_label, buf);
}
void Ui_ShowProgress(bool visible) {
if (progress_bar == nullptr) return;
if (visible) {
lv_obj_clear_flag(progress_bar, LV_OBJ_FLAG_HIDDEN);
if (progress_label) lv_obj_clear_flag(progress_label, LV_OBJ_FLAG_HIDDEN);
} else {
lv_obj_add_flag(progress_bar, LV_OBJ_FLAG_HIDDEN);
if (progress_label) lv_obj_add_flag(progress_label, LV_OBJ_FLAG_HIDDEN);
}
}
void Lvgl_Display_LCD(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p) {
LCD_addWindow(area->x1, area->y1, area->x2, area->y2, (uint16_t*)&color_p->full);
lv_disp_flush_ready(disp_drv);
@@ -88,21 +116,46 @@ void Lvgl_Init(void) {
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_black(), 0);
lv_obj_set_style_bg_opa(lv_scr_act(), LV_OPA_COVER, 0);
// Title
lv_obj_t *title = lv_label_create(lv_scr_act());
lv_obj_set_style_text_color(title, lv_palette_main(LV_PALETTE_GREEN), 0);
lv_obj_set_style_text_font(title, &lv_font_montserrat_16, 0);
lv_label_set_text(title, "WiFi Networks");
lv_obj_align(title, LV_ALIGN_TOP_LEFT, 10, 8);
lv_label_set_text(title, LV_SYMBOL_WIFI " Capture");
lv_obj_align(title, LV_ALIGN_TOP_LEFT, 10, 6);
// Status line
status_label = lv_label_create(lv_scr_act());
lv_obj_set_style_text_color(status_label, lv_palette_lighten(LV_PALETTE_GREEN, 2), 0);
lv_obj_set_style_text_font(status_label, &lv_font_montserrat_12, 0);
lv_label_set_text(status_label, "Starting...");
lv_obj_align(status_label, LV_ALIGN_TOP_LEFT, 10, 30);
lv_obj_align(status_label, LV_ALIGN_TOP_LEFT, 10, 28);
// Progress bar (hidden until capture starts)
progress_bar = lv_bar_create(lv_scr_act());
lv_obj_set_size(progress_bar, 114, 6);
lv_obj_align(progress_bar, LV_ALIGN_TOP_LEFT, 10, 44);
lv_bar_set_range(progress_bar, 0, 100);
lv_bar_set_value(progress_bar, 0, LV_ANIM_OFF);
lv_obj_set_style_bg_color(progress_bar, lv_color_make(25, 25, 25), LV_PART_MAIN);
lv_obj_set_style_bg_opa(progress_bar, LV_OPA_COVER, LV_PART_MAIN);
lv_obj_set_style_bg_color(progress_bar, lv_palette_main(LV_PALETTE_GREEN), LV_PART_INDICATOR);
lv_obj_set_style_bg_opa(progress_bar, LV_OPA_COVER, LV_PART_INDICATOR);
lv_obj_set_style_radius(progress_bar, 2, LV_PART_MAIN);
lv_obj_set_style_radius(progress_bar, 2, LV_PART_INDICATOR);
lv_obj_add_flag(progress_bar, LV_OBJ_FLAG_HIDDEN);
// Progress count label (right of bar)
progress_label = lv_label_create(lv_scr_act());
lv_obj_set_style_text_color(progress_label, lv_palette_main(LV_PALETTE_GREEN), 0);
lv_obj_set_style_text_font(progress_label, &lv_font_montserrat_12, 0);
lv_label_set_text(progress_label, "");
lv_obj_align(progress_label, LV_ALIGN_TOP_LEFT, 130, 41);
lv_obj_add_flag(progress_label, LV_OBJ_FLAG_HIDDEN);
// Network list panel
lv_obj_t *list_panel = lv_obj_create(lv_scr_act());
lv_obj_set_size(list_panel, 164, 260);
lv_obj_align(list_panel, LV_ALIGN_TOP_LEFT, 4, 52);
lv_obj_set_size(list_panel, 164, 254);
lv_obj_align(list_panel, LV_ALIGN_TOP_LEFT, 4, 54);
lv_obj_set_style_bg_color(list_panel, lv_color_black(), 0);
lv_obj_set_style_bg_opa(list_panel, LV_OPA_TRANSP, 0);
lv_obj_set_style_border_width(list_panel, 1, 0);