Meck P4 v0.4 Pre-release: WiFi companion app support
Pre-release
Pre-release
Feature release building on v0.3.8, adding WiFi companion app support, companion protocol compatibility, power optimisation, and stability improvements.
WiFi Companion Support
- Full WiFi companion transport via ESP32-C6 AT commands over SDIO. Connect the MeshCore app to your T-Display P4 over your local WiFi network (TCP port 5000).
- WiFi SSID and password configuration from the device Settings screen.
- WiFi IP address displayed on the home screen and settings page with live refresh.
- WiFi-aware sleep: when WiFi is active, the display dims to zero brightness instead of entering light sleep (which would kill the SDIO bus and TCP connection). Touch or boot button wakes the screen.
Companion Protocol
Extensive companion protocol implementation for MeshCore app compatibility:
- CMD_DEVICE_QUERY (22): Full device info response including firmware version, build date, model, path hash mode.
- CMD_APP_START (1): Identity, radio params, and position shared with the app on connection.
- CMD_GET_CONTACTS (4): Full contact iteration with streaming and incremental sync (since timestamp).
- CMD_SEND_CHANNEL_TXT_MSG (3): Send channel messages from the app, with own-echo detection so the app shows "Heard X Repeats".
- CMD_SET_ADVERT_NAME (8): Set node name from the app.
- CMD_SET_RADIO_PARAMS (11): Set frequency, bandwidth, spreading factor, coding rate (reboot to apply).
- CMD_SET_RADIO_TX_POWER (12): Set TX power.
- CMD_SET_ADVERT_LATLON (14): Set position for adverts.
- CMD_REMOVE_CONTACT (15): Delete contacts from the app.
- CMD_EXPORT_PRIVATE_KEY (23): Export identity for config backup.
- CMD_IMPORT_PRIVATE_KEY (24): Import identity for config restore.
- CMD_GET_CONTACT_BY_KEY (30): Look up contact by public key (required for app-side delete).
- CMD_SET_CHANNEL (32): Import/update channel name and secret from the app.
- CMD_SET_OTHER_PARAMS (38): Set manual add, advert location policy, multi-acks.
- CMD_GET_CUSTOM_VARS (40): Returns GPS state, interval, latitude, longitude for the app's Position Settings page.
- CMD_SET_CUSTOM_VAR (41): Toggle GPS on/off, set latitude/longitude from the app.
- CMD_GET_ADVERT_PATH (42): Returns cached advert path hashes so the app can display route details with repeater names.
- CMD_SET_FLOOD_SCOPE_KEY (54): Acknowledged (stub).
- CMD_SET_PATH_HASH_MODE (61): Set path hash size (1-byte, 2-byte, or 3-byte) from the app's Experimental Settings.
- CMD_SET_DEFAULT_FLOOD_SCOPE (63): Set/clear default region scope from the app.
- CMD_GET_DEFAULT_FLOOD_SCOPE (64): Returns current scope name and key.
- Push notifications: Channel messages, DM messages, send confirmations (acks), new adverts, and path updates are all pushed to the app in real time.
Channel Expansion
- Channel support expanded from 12 to 40 (
MAX_GROUP_CHANNELS). - Channel notification preferences array expanded to match (41 slots: 40 channels + 1 DM).
- Channel picker UI updated to support all 40 channels.
- Stack-local channel record arrays moved to heap allocation to prevent stack overflow.
Power Optimisation
- ICM20948 IMU: Put to sleep after init (~3mA saved).
- ES8311 audio codec: DAC, ADC, and PGA powered down after init. I2S channels disabled to release APB_FREQ_MAX PM locks. Woken on demand before playback, slept after stop (~5-10mA saved).
- I2S PM lock management: Added
disable_channels()/enable_channels()to Hardware_Iis class so I2S driver PM locks are only held during active audio playback. - DFS investigation: PM stats task added (enable via sdkconfig). Confirmed DSI display driver holds CPU_FREQ_MAX lock 97% of the time while screen is on, making CPU frequency reduction ineffective. ~172mA baseline is the hardware floor with display active.
UI Improvements
- Path display: Incoming message routes and outgoing heard-by lists reformatted as numbered vertical lists for clarity.
- Blue flash fix: Active screen background set to black before Meck UI init to prevent LVGL's default theme colour showing during screen transition.
- Touch sensitivity fix: Removed
pressure_value != 0check from touch input callback (LilyGo's touch driver on some units reports zero pressure for valid touches). - Advert sent confirmation: Visual feedback when manual advert is sent.
- Clock position: Shifted for node names that extend above the default position.
Security
- WiFi passwords masked in serial debug logs (both outgoing AT commands and C6 echoes now show
****instead of the actual password). - BLE PIN masked in boot log output.
Bug Fixes
- CWJAP watchdog: Increased yield time during slow AT commands (CWJAP) from 5ms to 100ms to prevent task watchdog triggers during WiFi association.
- WiFi IP fetch: Added retry logic (3 attempts with 500ms gaps) for CIFSR when the C6 is still flushing async WiFi events.
- WiFi connection settle: 200ms delay after AT+CWMODE=1 before CWJAP to prevent "busy p..." errors.
- WiFi enable status:
meck_apply_pending_wifinow checksisEnabled()before logging success. - CIPSEND error handling: Failed sends now retry with backoff (3 attempts) instead of immediately disconnecting.
- savePrefs diagnostic: Added caller return address to savePrefs log for tracking spurious saves.
- Channel message repeat acks in the app: Implemented the
logRxRawhook to stream received raw packets to the companion app (PUSH_CODE_LOG_RX_DATA), matching stock MeshCore behaviour. The app now resolves "Heard X Repeats" with repeater names, SNR, and hop counts for channel messages sent from the app. The on-screen heard counter is updated independently via flood-echo detection.
Known Limitations
- BLE companion support is compiled out by default (
MECK_BLE_ENABLED=0). WiFi is the primary companion transport for this release. - Max contacts displayed as 510 in the app due to the companion protocol's single-byte field (protocol limitation, not firmware).
- Per-echo SNR display in the device's heard-by popup requires a struct change (deferred to next release).
MECK_BUILD_EPOCHonly updates onidf.py reconfigure, not incremental builds.
Files Changed
18 files changed, 3,414 additions, 52 deletions.