- Date Created: 2025-12-06
- Last Modified: 2025-12-06
Progress Log: Text Command Response Format Standardization¶
Task Description¶
Standardized response format across text command handlers to improve consistency and simplicity. Main changes include:
- GET_UPTIME Simplification: Removed complex time conversion (days, hours, minutes, seconds) and return only raw
uptime_ms - RTC_TIME Standardization: Added missing
"type":"response"field and unified field names (rtc_timestamp) - Format Verification: Confirmed all 19 text command handlers follow unified response format
Outcome¶
✅ Completed Successfully
Changes Made¶
- Commit 1 (6c86a90): GET_UPTIME simplification
- Removed time decomposition logic
- Response now:
{"type":"response","status":"ok","uptime_ms":value} -
Saves ~30 bytes Flash, ~120 bytes JSON payload
-
Commit 2 (2c1778b): RTC_TIME standardization
- Added
"type":"response"to SET_RTC_TIME (line 825) - Added
"type":"response"to GET_RTC_TIME (line 857) - Unified field names to
"rtc_timestamp" -
Response format:
{"type":"response","status":"ok","rtc_timestamp":value} -
Documentation
- Updated CLAUDE.md (line 341): GET_UPTIME description
- Created v1.10.6 release notes with detailed breaking changes
Verification¶
✅ All 19 text command handlers confirmed to have "type":"response" field:
- SET_POLL_COUNT, SET_THRESHOLD, GET_THRESHOLD
- GET_VERSION, RESET, SET_DEADTIME
- GET_STATUS, TEST_LED, GET_UPTIME
- GET_MAC_ADDRESS, GET_HELP
- SET_STREAM, GET_STREAM
- GET_QUEUE_STATS (conditional)
- SET_RTC_TIME, GET_RTC_TIME (conditional)
- SET_WIFI_SSID, SET_WIFI_ENABLE, GET_WIFI_STATUS (conditional)
Files Modified¶
src/text_command_handlers.cpp(2 commits, 8 lines changed)CLAUDE.md(1 line updated)docs/releases/v1.10.6.md(created, new file)
Learnings¶
1. Consistency as Design Principle¶
Standardizing response format across all commands:
- Makes client parsing predictable
- Reduces implementation bugs on client side
- Sets pattern for future commands
2. Firmware Optimization Trade-offs¶
Removing time conversion from GET_UPTIME:
- Saves firmware size and runtime overhead
- Delegates responsibility to client (appropriate for embedded systems)
- Client libraries can implement custom formatting
3. Breaking Changes Require Clear Documentation¶
RTC_TIME field renaming from timestamp/time to rtc_timestamp:
- Improves clarity (matches uptime_ms pattern)
- Requires explicit versioning and migration guide
- Worth the one-time breaking change for long-term consistency
Next Steps¶
- Testing: Validate JSON parsing with actual serial output
- Client Migration: Update any existing client code using GET_UPTIME/RTC_TIME
- Release: Tag v1.10.6 and publish release notes
- Future: Consider Phase 1 of response layer refactoring using these standardized patterns