feat(drivers): validate bounded IMU FIFO acquisition

Drain bounded MPU6000 and ICM-42688 FIFO batches. Publish the latest
validated sample only after overflow checks. Reject invalid drains.

Validation: driver, sensor and platform tests plus both ARM release builds
from a fresh build directory.
This commit is contained in:
Onur Özkan committed 2026-11-07 18:12:11 +03:00
1 parent f9a61a086f
commit d32b03c87f
13 files changed
+1303 -833

No files matched your search

+9 -16
View File
@@ -2,28 +2,21 @@
use kaptan_time::Timestamp;
/// Coherent IMU observation in the board body frame.
/// Coherent IMU observation with explicit units.
///
/// Acceleration is milligravity, angular rate is milliradians per second, and
/// temperature is centidegrees Celsius. The board-frame transform is complete
/// before this value is published.
///
/// Current MPU6000 and ICM-42688-P decoders round integer conversions toward
/// zero. Across their configured ranges, decoded acceleration is within
/// ±16,000 mg and angular rate within ±34,871 mrad/s, including mounting sign
/// changes. Temperature is within -22,234..=27,233 cdegC. These are backend
/// representation bounds over every raw i16 value, not physical operating
/// limits or validation performed by this public snapshot type.
/// temperature is centidegrees Celsius. Chip drivers return sensor-frame axes.
/// The platform applies the board mounting transform before publication, so
/// published observations use the body frame. This type does not validate values.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct ImuSnapshot {
/// Host monotonic acquisition-request time, captured immediately before the
/// accepted register read is submitted by the worker. This is neither DRDY
/// ISR entry nor the sensor's physical sampling epoch. Register updates,
/// filtering and deferred/coalesced interrupts prevent that inference.
/// Producer timestamp in the controller's monotonic clock domain.
/// The acquisition source defines its meaning. It need not represent the
/// sensor's physical sampling epoch.
pub timestamp: Timestamp,
/// Body-frame acceleration in milligravity.
/// Acceleration in milligravity, in the producer's frame described above.
pub acceleration_milligravity: [i16; 3],
/// Body-frame angular rate in milliradians per second.
/// Angular rate in milliradians per second, in the same frame as acceleration.
pub angular_rate_milliradians_per_second: [i32; 3],
/// Sensor temperature in centidegrees Celsius.
pub temperature_centidegrees_celsius: i16,