|
1 | 1 | # Architecture Refactoring: Clean Core Layer |
2 | 2 |
|
3 | | -**Date**: 2025-01-XX |
| 3 | +**Date**: 2025-11-01 (Completed) |
4 | 4 | **Goal**: Eliminate platform dependencies from `core/` modules using dependency injection and command pattern. |
5 | 5 |
|
6 | 6 | --- |
@@ -243,12 +243,25 @@ For existing modules that need HAL: |
243 | 243 |
|
244 | 244 | ## Summary |
245 | 245 |
|
246 | | -**Before**: 4 files in `core/` had platform dependencies |
| 246 | +**Before**: 6 files in `core/` had platform dependencies |
| 247 | +- `ground_safety.cpp` - Arduino.h, millis() |
| 248 | +- `arm_calibration.cpp` - Arduino.h, imu.h, nvs_cal.h, millis(), micros() |
| 249 | +- `mixer_table.cpp` - platform/arduino/assert.h |
| 250 | +- `safety.cpp` - Arduino.h, millis() |
| 251 | +- `imu_mapping.cpp` - platform/arduino/assert.h |
| 252 | +- `accel_cal_validation.cpp` - wrong namespace for isfinite/fabs |
| 253 | + |
247 | 254 | **After**: 100% platform-independent (except logger utility) |
248 | 255 |
|
| 256 | +**Additional Fixes**: |
| 257 | +- Renamed `platform/arduino/assert.h` → `runtime_assert.h` (avoid system header conflict) |
| 258 | +- Fixed include paths in platform files (nvs_cal.cpp, radio.cpp, telemetry.cpp) |
| 259 | +- Added missing config.h includes (rc_packet.cpp, input_processor.cpp, test files) |
| 260 | + |
249 | 261 | **Key Techniques**: |
250 | | -- Dependency Injection (timing) |
251 | | -- Command Pattern (HAL operations) |
| 262 | +- Dependency Injection (timing via parameters) |
| 263 | +- Command Pattern (HAL operations return commands) |
252 | 264 | - Clean interfaces (no leaky abstractions) |
253 | 265 |
|
254 | 266 | **Result**: Core business logic is now fully testable, portable, and maintainable. |
| 267 | +**Build Status**: ✅ All tests pass, ESP32 builds successfully |
0 commit comments