Day40 - Learning Log¶
📌 Summary¶
Refactored the driver control plane from parameter-driven behavior to a mode-based architecture.
🧠 Key Learnings¶
1. Mode vs Parameter¶
- Mode defines behavior
- Parameters define configuration
2. Staged Configuration¶
- Parameters can be set before activation
- Applied only when entering active modes
3. Deterministic State¶
- Avoid patching previous config
- Always build final hardware state explicitly
4. Compatibility Design¶
- Keep legacy attributes (fifo_enable)
- Internally redirect to new control model
5. Safe Control Plane¶
- Reject changes when buffer is active
- Prevent race conditions
⚠️ Issues Encountered¶
- mutex unlock bug in watermark path
- rollback handling for staged parameters
- config carry-over risk (fixed by explicit build)
✅ Result¶
Driver behavior is now:
- predictable
- extendable
- aligned with real sensor design patterns
🚀 Next¶
- one-shot mode design
- IRQ policy separation
- STM32 register redesign