Skip to content

fix: move WiFi handling after BLE command queue processing#30

Merged
jonasniesner merged 1 commit into
OpenDisplay:mainfrom
sweidinger:fix/ble-command-queue-ordering
May 28, 2026
Merged

fix: move WiFi handling after BLE command queue processing#30
jonasniesner merged 1 commit into
OpenDisplay:mainfrom
sweidinger:fix/ble-command-queue-ordering

Conversation

@sweidinger
Copy link
Copy Markdown
Contributor

Problem

In v1.6, handleWiFiServer() and the WiFi reconnection check were moved to the top of loop(), before BLE command/response queue processing. This can cause BLE commands to sit unprocessed in the queue when handleWiFiServer() blocks or takes a slow path, resulting in BLE timeouts for clients.

Symptoms observed on EE04 (ESP32-S3) + 7.3" Spectra 6

  • BLE READ CONFIG commands queued but never dequeued
  • ESP32: Command queued for processing appears in serial log but ESP32: Processing queued command never follows
  • Home Assistant OpenDisplay integration fails with ble_timeout during device interrogation
  • py-opendisplay image uploads and config reads timeout after 10s
  • Downgrading to v1.3 immediately resolves all issues

Fix

Move handleWiFiServer() and WiFi reconnection check to after the BLE command queue drain and response notification loop, restoring the v1.3 execution order where BLE is always serviced first. WiFi functionality is unchanged — only the ordering within the loop changes.

Testing

  • Built and flashed on Seeed EE04 (XIAO ESP32-S3) with 7.3" Spectra 6 Color display
  • Verified BLE config reads work (py-opendisplay info command)
  • Verified BLE image uploads work (py-opendisplay upload command)
  • Verified Home Assistant OpenDisplay integration v2.0.2 connects and interrogates successfully via ESP32 BLE Proxy
  • Verified encryption (AES-128) works correctly
  • All operations that timed out on unpatched v1.6 now succeed

Co-Authored-By: Oz oz-agent@warp.dev

In v1.6, handleWiFiServer() and the WiFi reconnection check were moved
to the top of loop(), before BLE command/response queue processing.
This can cause BLE commands to sit unprocessed in the queue when
handleWiFiServer() blocks or takes a slow path, resulting in BLE
timeouts for clients (Home Assistant integration, py-opendisplay).

Observed symptoms:
- BLE READ CONFIG commands queued but never processed
- 'ESP32: Command queued for processing' appears in serial log but
  'ESP32: Processing queued command' never follows
- Home Assistant integration fails with 'ble_timeout' during device
  interrogation
- py-opendisplay image uploads timeout after 10s

This commit moves WiFi handling back to after the BLE command queue
drain and response notification loop, restoring the v1.3 execution
order where BLE is always serviced first. WiFi functionality is
preserved — only the ordering within the loop iteration changes.

Co-Authored-By: Oz <oz-agent@warp.dev>
@sweidinger sweidinger requested a review from jonasniesner as a code owner May 28, 2026 05:44
@jonasniesner
Copy link
Copy Markdown
Member

I dont know how this will help, but it looks like it wont have downsides so I will merge it anyways

@jonasniesner jonasniesner merged commit 47fe7ce into OpenDisplay:main May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants