2 Commits

Author SHA1 Message Date
0207c29d8c fix: Resolve all 7 compile errors and 4 linker errors (Issue #337)
COMPILE FIXES:
1. battery.c: Added #include <stdbool.h> for bool type
2. main.c: Updated buzzer_play() to buzzer_play_melody(MELODY_STARTUP)
3. main.c: Replaced bno055_active with bno055_is_ready() calls
4. servo.c: Removed duplicate ServoState typedef from .c file
5. ultrasonic.c: Added forward declaration for HAL_TIM_IC_Init_Compat
6. fan.c: Fixed HAL_TIM_PWM_Start to use handle &htim1 instead of register
7. watchdog.c: Created static IWDG_HandleTypeDef and updated refresh call

LINKER FIXES:
1. i2c1.h/c: Added i2c1_write() and i2c1_read() function implementations
2. servo.c: servo_tick() already exists (verified)
3. bno055.h/c: Added bno055_calibrated() function
4. main.c: Added imu_calibrated() wrapper for bno055_calibrated()
5. crsf.h/c: Added crsf_is_active() function

All 11 errors fixed. Build should now succeed.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-03 11:26:27 -05:00
87b45e1b97 feat(firmware): BNO055 NDOF IMU driver on I2C1 (Issue #135)
Auto-detected alongside MPU6000. Acts as balance primary when MPU6000
fails, or provides NDOF-fused yaw/pitch when both sensors are present.

- include/bno055.h: full API — bno055_init/read/is_ready/calib_status/
  temperature/save_offsets/restore_offsets
- src/bno055.c: I2C1 driver; probes 0x28/0x29, resets via SYS_TRIGGER,
  enters NDOF mode; 2-burst 12-byte reads (gyro+euler, LIA+gravity);
  Euler/gyro/accel scaling (÷16, ÷16, ÷100); auto-saves offsets to
  RTC backup regs BKP0R–BKP6R on first full cal; restores on boot
  (bno055_is_ready() returns true immediately); temperature updated 1Hz
- include/config.h: BNO055_BKP_MAGIC = 0xB055CA10
- src/main.c: bno055_init() in I2C probe block (before IWDG); imu_calibrated()
  macro dispatches mpu6000_is_calibrated() vs bno055_is_ready();
  BNO055 read deferred inside balance gate to avoid stalling main loop;
  USB JSON reports bno_cs (calib status) and bno_t (temperature)
- test/test_bno055_data.py: 43 pytest tests (43/43 pass) — calib status
  bit extraction, Euler/gyro/accel scaling, burst parsing, offset
  round-trip packing, temperature signed-byte encoding

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 09:40:18 -05:00