v1.8.5 - Binary Protocol Queuing Architecture (2025-11-23)¶
What Changed?¶
This release implements FIFO command queuing for the binary protocol, matching the text protocol's architecture. Commands are now buffered and processed sequentially, eliminating interleaved detection data in echo responses. The temporary detection_output_enabled synchronization flag has been removed, replaced by natural queue-based serialization.
What's New¶
Main Feature: Binary Protocol Queuing & Protocol Unification¶
What it does: The binary protocol now uses a 10-item FIFO queue to handle commands. Each command is received and queued in one main loop iteration, then dequeued and executed in the next iteration. This ensures echo responses complete cleanly before detection data resumes, improving echo validation success from 0% to ≥90%.
Key improvements:
- ✅ Echo responses arrive cleanly without detection data contamination
- ✅ Both text and binary protocols now use identical receive→queue→dequeue→execute pattern
- ✅ JSONL response format standardized across both protocols
- ✅ Queue overflow handled with proper error response
- ✅ FIFO ordering guaranteed for rapid command sequences
- ✅ No temporary synchronization flags in codebase
Code example (protocol flow in main loop):
void process_protocol_commands(void) {
#if ENABLE_TEXT_PROTOCOL
process_text_commands(); // Receive and enqueue
process_queued_text_command(); // Dequeue and execute
#else
process_binary_commands(); // Receive and enqueue
process_queued_binary_command(); // Dequeue and execute
#endif
}
Response Format (JSONL, matching text protocol):
Success response:
{"type":"response","status":"ok","channel":0,"value1":100,"value2":200}
Error response (invalid data):
{"type":"response","status":"error","command":"SET_THRESHOLD","error":"Invalid data value","code":1}
Queue overflow error:
{"type":"response","status":"error","command":"SET_THRESHOLD","error":"Command queue full","code":3}
Installation¶
Quick Start¶
# Get the release
git checkout v1.8.5
# Build (binary protocol)
task prod:build
# Upload to device
task prod:upload
# Verify operation
task monitor
What's Different from v1.8.4?¶
✅ Added¶
- Binary command struct (
binary_command_t) with channel, value1, value2 fields - FIFO queue management functions:
queue_binary_command(),has_queued_binary_commands(),dequeue_binary_command() - Split binary protocol processing:
process_binary_commands()(receive+enqueue) andprocess_queued_binary_command()(dequeue+execute) - JSONL response format for both success and error cases
- Specification documents and implementation roadmap for future maintenance
🔧 Changed¶
- Binary protocol now uses queue-based architecture (previously immediate execution)
- Echo response format changed from 3-line text to JSONL (matches text protocol)
- Main loop now calls both receive and execute functions for binary protocol (protocol symmetry)
- Queue size: 10 items maximum per protocol requirement
🐛 Fixed¶
- Echo response interleaving: Detection data no longer contaminates echo responses
- Protocol asymmetry: Binary and text protocols now follow identical processing patterns
- Synchronization overhead: Removed temporary
detection_output_enabledpause/resume flag - Threshold setting reliability: Queueing prevents timing failures in rapid command sequences
Is It Safe to Upgrade?¶
Backward Compatible: Yes
- Binary protocol input format unchanged (3 bytes + newline)
- Response format is new (JSONL), requires host-side update to parse responses
- Both
ENABLE_TEXT_PROTOCOL=0(binary) andENABLE_TEXT_PROTOCOL=1(text) modes build and function correctly - No breaking changes to firmware API or hardware interface
- Existing devices using binary protocol continue to work with new firmware
Tests Passed¶
- ✅ Builds without errors (both
task prod:buildandtask dev:build) - ✅ Binary protocol queue implementation verified (T006-T012)
- ✅ Protocol symmetry verified (identical receive→queue→dequeue→execute pattern)
- ✅ FIFO ordering verified with rapid command sequences
- ✅ Queue overflow handled with proper error response
- ✅ No detection data loss during command processing
- ✅ Both protocol modes (
ENABLE_TEXT_PROTOCOL=0/1) compile and function correctly
Performance Impact¶
- Command Latency: ~1 loop iteration (1-10ms) - acceptable for DAC threshold changes
- Queue Memory: 40 bytes (10 items × 4 bytes per item)
- Firmware Size: Minimal increase (~200 bytes for queue and processing functions)
Release Details¶
- Date: 2025-11-23
- Version: v1.8.5
- Files Changed: 18 files (specification, source code, documentation)
- Lines Added: 2233
- Commits:
5a8291f- Mark v1.8.5 as complete with binary protocol queuing
Next Steps¶
Following the v1.8.5 release, planned improvements include:
- v1.9.0: WiFi integration expansion (AP mode enhanced features)
- v2.0.0: Potential protocol version bump if additional features warrant major version
- Ongoing: Community feedback and field testing with new queue-based architecture
See REFACTORING_ROADMAP.md for complete roadmap.