Button / RTC-Wakeup Capture and Upload Flow
Full Flow Chart
Key Functions
Button capture path
- device_service.c:
single_press_callback()- button callback while running - system_service.c:
handle_wakeup_event(WAKEUP_SOURCE_BUTTON)- button handling on wakeup - system_service.c:
default_capture_callback(CAPTURE_TRIGGER_BUTTON)- button-triggered callback
RTC wakeup capture path
- system_service.c:
system_service_process_wakeup_event()- process wakeup events - system_service.c:
handle_wakeup_event(WAKEUP_SOURCE_RTC)- RTC wakeup handling - system_service.c:
wakeup_task_async()- asynchronous wakeup task
Unified upload flow
- system_service.c:
system_service_capture_and_upload_mqtt()- core upload function- Step 1: capture (fast / standard)
- Step 1.1: SD card storage (optional)
- Step 2: prepare metadata
- Step 3: prepare AI result (optional)
- Step 3.1: check MQTT network connection
- Step 4: MQTT upload (single / chunked)
- Step 5: release buffers
- Step 6: wait for publish confirmation
Parameter Differences
| Trigger | enable_ai | chunk_size | store_to_sd | Capture API |
|---|---|---|---|---|
| Button capture (while running) | configurable | configurable | configurable | standard |
| Button capture (from wakeup) | TRUE | 0 | TRUE | fast |
| RTC wakeup capture | TRUE | 0 | TRUE | fast |