Update CLAUDE.md, module docs, and READMEs to reflect current
architecture and provide clearer guidance for adding new device
implementations. Key changes:
- Add comprehensive DeviceDriver trait documentation with examples
- Document module structure and factory pattern in devices/mod.rs
- Update file path references to reflect crl200s/ organization
- Change configuration example from TOML to JSON format
- Fix minor documentation inconsistencies across READMEs
SangamIO changes:
- Add ProtocolSync command (0x0C) for GD32 wake sequence at boot
- Add CMD_PROTOCOL_SYNC constant and cmd_protocol_sync() builder
- Handle protocol sync ACK in reader loop with logging
- Update COMMANDS.md with full AuxCtrl init sequence from MITM capture
Protocol-MITM changes:
- Simplify log format to CSV for easier parsing and analysis
- Configure PTY slave for raw mode to prevent escape encoding
- Remove verbose packet decoding (now done in post-processing)
- Update documentation with new CSV format specification
Other:
- Add *.log to gitignore
- Remove unused mitm_init.sh script
- Update deployment scripts for simplified workflow
Consolidate protocol specifications into source code, improve GD32 command accuracy based on AuxCtrl reverse engineering, and add comprehensive integration test covering all robot components. This update improves documentation maintainability and code correctness.
This commit adds a complete protocol reverse-engineering toolkit and rewrites
the GD32/lidar drivers based on captured real-world AuxCtrl behavior:
**Protocol MITM Infrastructure** (protocol-mitm/):
- Serial port interception logger in Rust
- Robot-side automation scripts for capturing sessions
- Development tools for log analysis and packet parsing
- Complete session captures showing initialization sequences
**GD32 Driver Improvements**:
- Implement exact AuxCtrl initialization sequence from MITM analysis:
* CMD=0x0C init sync, 0x8D LED, 0x07 version, 0x65 motor type, 0x71 telemetry
* Precise timing: LED burst at T+245ms, wake at T+253ms, brushes at T+280ms
* Heartbeat starts at T+289ms with proper telemetry queries
- Add CMD=0x06 wake command every ~250ms (matches AuxCtrl frequency)
- Enhanced logging for TX/RX packet debugging
- Wait for STATUS_DATA confirmation after init
**Delta-2D Lidar Driver Improvements**:
- Fix packet parsing: wait for complete payload+CRC before reading
- Add detailed logging of bytes available and packet structure
- Implement proper data arrival detection (matches Python reference)
**Example Program Updates** (test_lidar_scenario.rs):
- Complete lidar power-on sequence: mode switch → prep → power → PWM
- Proper initialization delays (1.4s stabilization matches AuxCtrl)
- Graceful shutdown with PWM ramp-down before power-off
**Documentation & Security**:
- Replace hardcoded passwords with $ROBOT_PASSWORD environment variable
- Update all deployment guides with MITM tool references
- Add protocol-mitm/ section to README
**Build Optimizations** (Cargo.toml):
- Enable LTO, strip symbols, single codegen unit, panic=abort
- Reduces binary size significantly for embedded deployment
**Cleanup**:
- Remove obsolete serial_dump.rs (replaced by protocol-mitm tools)
This work enables reliable GD32 and lidar operation by following the exact
command sequences and timing used by the original AuxCtrl firmware.