Files
docs/reference/ui/screen-inventory.md
ClearGrow Agent f0e86d6920 docs: document automatic pairing retry feature (CG-19)
Updated documentation for the automatic retry logic added to code-based
probe pairing:

- guides/user/getting-started/pairing-probes.md: Added "Automatic Retries"
  section explaining retry behavior and Skip Retry button
- reference/firmware/controller/thread-br.md: Added comprehensive
  "Automatic Pairing Retry" section with configuration, API, events, and
  UI integration details
- reference/ui/screen-inventory.md: Updated PAIRING_PROGRESS entry with
  retry UI changes
- reference/architecture/controller/event-system.md: Added
  CLEARGROW_EVENT_PAIRING_RETRY and CLEARGROW_EVENT_PAIRING_SKIP_RETRY
  events, updated probe pairing flow diagram

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 06:56:33 -07:00

6.3 KiB

title, version
title version
Screen Inventory 1.0

Screen Inventory

Complete list of ClearGrow UI screens with navigation paths.

Screen IDs

All screens are defined in cg_screen_mgr.h:

typedef enum {
    CG_SCREEN_BOOT,
    CG_SCREEN_WIZARD,
    CG_SCREEN_DASHBOARD,
    CG_SCREEN_ZONE_LIST,
    CG_SCREEN_ZONE_DETAIL,
    CG_SCREEN_ZONE_EDIT,
    CG_SCREEN_PROBE_DETAIL,
    CG_SCREEN_HISTORY,
    CG_SCREEN_ALERTS,
    CG_SCREEN_SETTINGS,
    CG_SCREEN_SETTINGS_DISPLAY,
    CG_SCREEN_SETTINGS_ALERTS,
    CG_SCREEN_SETTINGS_SYSTEM,
    CG_SCREEN_AUTOMATION,
    CG_SCREEN_AUTOMATION_DETAIL,
    CG_SCREEN_AUTOMATION_CREATE,
    CG_SCREEN_PAIRING_CODE,
    CG_SCREEN_PAIRING_DISCOVERY,
    CG_SCREEN_PAIRING_PROGRESS,
    CG_SCREEN_PAIRING_SUCCESS,
    CG_SCREEN_PAIRING_ERROR,
    CG_SCREEN_COUNT
} cg_screen_id_t;

Navigation Map

                    ┌─────────────┐
                    │    BOOT     │
                    └──────┬──────┘
                           │
              ┌────────────┴────────────┐
              │                         │
       ┌──────▼──────┐          ┌───────▼───────┐
       │   WIZARD    │          │   DASHBOARD   │◄─── Tab Bar Home
       └─────────────┘          └───────┬───────┘
                                        │
                    ┌───────────────────┼───────────────────┐
                    │                   │                   │
             ┌──────▼──────┐     ┌──────▼──────┐     ┌──────▼──────┐
             │  ZONE_LIST  │◄──► │   HISTORY   │◄──► │   ALERTS    │
             └──────┬──────┘     └─────────────┘     └─────────────┘
                    │
             ┌──────▼──────┐
             │ ZONE_DETAIL │
             └──────┬──────┘
              ┌─────┴─────┐
       ┌──────▼──────┐ ┌──▼───────────┐
       │  ZONE_EDIT  │ │ PROBE_DETAIL │
       └─────────────┘ └──────────────┘

Screen Details

Tab Bar Screens

Screen Tab Purpose
DASHBOARD Home Main view with probe tiles
ZONE_LIST Zones Zone management
HISTORY History Historical charts
ALERTS Alerts Alert configuration
SETTINGS Settings System settings

Detail/Edit Screens

Screen From Purpose
ZONE_DETAIL ZONE_LIST View single zone
ZONE_EDIT ZONE_DETAIL Edit zone settings
PROBE_DETAIL Dashboard/Zone View single probe
AUTOMATION_DETAIL AUTOMATION View rule details
AUTOMATION_CREATE AUTOMATION Create new rule

Settings Submenus

Screen From Purpose
SETTINGS_DISPLAY SETTINGS Display options
SETTINGS_ALERTS SETTINGS Alert options
SETTINGS_SYSTEM SETTINGS System options

Pairing Flow

Screen Sequence Purpose
PAIRING_CODE 1 Enter pairing code
PAIRING_DISCOVERY 2 Searching for probe
PAIRING_PROGRESS 3 Commissioning (with automatic retry)
PAIRING_SUCCESS 4a Success confirmation
PAIRING_ERROR 4b Error handling

Updated 2025-12-11 (CG-19): The PAIRING_PROGRESS screen now supports automatic retry:

  • Shows "Attempt X of Y" label during retries
  • Displays "Skip Retry" button when retries are available
  • Responds to CLEARGROW_EVENT_PAIRING_RETRY events
  • Default: 3 total attempts (1 initial + 2 retries)

Updated 2025-12-10: The PAIRING_DISCOVERY screen now uses active probe discovery via probe_discovery_start(). Probes are discovered through:

  1. Device registry query (immediate)
  2. Thread child table enumeration (via Spinel)
  3. CoAP multicast discovery (repeated every 3 seconds)

Discovery timeout defaults to 30 seconds with progress updates every 500ms.

Special Screens

Screen Purpose
BOOT Startup animation
WIZARD Initial setup flow

Navigation API

Push Screen

cg_screen_mgr_push(CG_SCREEN_ZONE_DETAIL, zone_id);

Pop Screen

cg_screen_mgr_pop();

Replace Screen

cg_screen_mgr_replace(CG_SCREEN_DASHBOARD, NULL);

Go Home

cg_screen_mgr_go_home();

Screen Lifecycle

Each screen implements:

Function When Called
scr_*_create() Screen pushed to stack
scr_*_on_show() Screen becomes visible
scr_*_on_hide() Screen hidden by push
scr_*_destroy() Screen popped from stack

Cleanup Pattern

As of 2025-12-09, all screens follow a consistent cleanup pattern in their destroy functions:

void scr_my_screen_destroy(void) {
    if (s_screen_ptr != NULL) {
        lv_obj_del(s_screen_ptr);
        s_screen_ptr = NULL;  // Always null after deletion
    }
}

This pattern ensures:

  • Safe double-destroy protection (NULL check before deletion)
  • Proper memory cleanup (LVGL object deletion)
  • Clear state indication (NULL pointer after cleanup)

Screen Files

Screen Source File
Boot screens/scr_boot.c
Wizard screens/scr_wizard.c
Dashboard screens/scr_dashboard.c
Zone List screens/scr_zone_list.c
Zone Detail screens/scr_zone_detail.c
Zone Edit screens/scr_zone_edit.c
Probe Detail screens/scr_probe_detail.c
History screens/scr_history.c
Alerts screens/scr_alerts.c
Settings screens/scr_settings.c
Automation screens/scr_automation.c
Pairing screens/scr_pairing_*.c