fix: add BLE write synchronization to prevent dropped commands

Android BLE is asynchronous - writeCharacteristic() only queues the write.
Without waiting for onCharacteristicWrite() callback, subsequent writes
are silently dropped by the BLE stack.

Changes:
- Add CountDownLatch-based synchronization in KotlinRNodeBridge
- Each BLE write now waits for callback confirmation before proceeding
- Add small delays in Python for framebuffer writes (defensive)

This fixes reliability issues with RNode framebuffer commands on BLE.
Note: T114 still won't show framebuffer due to upstream firmware bug
(bt_ssp_pin set at startup, never cleared).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
torlando-tech 2025-12-06 17:25:16 -05:00
parent 5d1cb96e30
commit b6b34603ec
2 changed files with 54 additions and 4 deletions

View file

@ -578,6 +578,8 @@ class ColumbaRNodeInterface:
line_end = line_start + KISS.FB_BYTES_PER_LINE
line_data = bytes(imagedata[line_start:line_end])
self.write_framebuffer(line, line_data)
# Small delay to prevent BLE write throttling
time.sleep(0.015)
RNS.log(f"{self} Sent 64x64 image to RNode framebuffer", RNS.LOG_DEBUG)
@ -587,6 +589,8 @@ class ColumbaRNodeInterface:
try:
from columba_logo import columba_fb_data
self.display_image(columba_fb_data)
# Delay before enable command to ensure framebuffer data is processed
time.sleep(0.05)
self.enable_external_framebuffer()
RNS.log(f"{self} Displayed Columba logo on RNode", RNS.LOG_DEBUG)
except ImportError: