diff options
Diffstat (limited to 'src/sensor/calibration.hpp')
-rw-r--r-- | src/sensor/calibration.hpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/sensor/calibration.hpp b/src/sensor/calibration.hpp index a808fe9..a2da58b 100644 --- a/src/sensor/calibration.hpp +++ b/src/sensor/calibration.hpp @@ -28,6 +28,18 @@ constexpr uint32_t CALIBRATION_TIMEOUT = 120000; // Milliseconds constexpr unsigned int SENSOR_READ_CNT = 20; constexpr float SENSOR_VAL_ADJUST = 0.05; +class SensorCalibratorValues +{ +public: + double accel_x = 0; + double accel_y = 0; + double accel_z = 0; + + double gyro_x = 0; + double gyro_y = 0; + double gyro_z = 0; +}; + /** * Sensor calibrator. */ @@ -52,22 +64,13 @@ public: bool calibrate(unsigned int throttle_time); private: - void _resetValues(); - void _updateValues(); - void _adjustValues(); - bool _isValuesInRange() const; + void _updateValues(SensorCalibratorValues &values); + void _adjustCalibrationWithValues(const SensorCalibratorValues &values); - void _adjustCalibration(); + static void _adjustValues(SensorCalibratorValues &values); + static bool _isValuesInRange(const SensorCalibratorValues &values); UniquePtr<Sensor> _sensor; SerialStream _sout; - - double _accel_x = 0; - double _accel_y = 0; - double _accel_z = 0; - - double _gyro_x = 0; - double _gyro_y = 0; - double _gyro_z = 0; }; |