Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "sl-controls/gyro-calibration"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
On every boot, before the main loop enters,
mpu6000_calibrate()samples 1000 gyro readings over ~1s with the board held still, computes the per-axis mean offset in sensor-frame raw LSBs, and stores it. All subsequentmpu6000_read()calls subtract the bias before the CW270 axis transform and scale — so all three axes (pitch rate, roll rate, yaw rate) are corrected.Changes
src/mpu6000.c:mpu6000_calibrate()— LED1+LED2 solid ON during 1s window, int32 accumulation (avoids float error), resets filter state to zero after;mpu6000_is_calibrated()gate; bias subtraction before axis transforminclude/mpu6000.h: declares the two new functions with doc commentssrc/main.c: callsmpu6000_calibrate()immediately aftermpu6000_init()(beforesafety_init()so IWDG is not yet running); gates arming and USB streaming onmpu6000_is_calibrated()include/config.h:GYRO_CAL_SAMPLES=1000No flash storage — bias recalibrated fresh each boot (temperature-dependent).
Test plan
Closes #21, #23.
🤖 Generated with Claude Code
Flash-tested all 3 together. Gyro cal eliminates yaw drift, LEDs solid, I2C probe clean.