All modules and core of the app was created

This commit is contained in:
2024-01-11 22:47:53 +07:00
parent 3c2889b8f7
commit 5dd404d44b
18 changed files with 647 additions and 128 deletions

View File

@@ -10,23 +10,28 @@ struct MpuData {
float ax, ay, az;
float gx, gy, gz;
float yaw, pitch, roll;
float gravityZ;
float gravity;
float zInertial;
};
class Sensors {
public:
Sensors(Barometer &barometer, MPU &mpu, Kalman2DFilter &filter, BatteryController &battery, bool loop_on_fail = true);
Sensors(Barometer *barometer, MPU *mpu, Kalman2DFilter *filter, BatteryController *battery, bool loop_on_fail = true);
~Sensors();
void measureBaseAltitudeSync(void);
void measureBaseAltitudeAsync(void);
float rawFlightHeight(void);
float flightHeight(void);
void onMeasuaringAltitudeFinished(OnMeasuringFinishedCb callback);
float rawFlightHeight(void) const;
float flightHeight(void) const;
MpuData mpuData(void);
void startMpuCalibration();
void onMpuCalibrationFinished(OnCalibrationFinishedCb callback);
int batteryCharge(void); // [%]
MpuData mpuData(void) const;
int batteryCharge(void) const; // [%]
bool tick(void);
@@ -39,7 +44,7 @@ class Sensors {
/* cached filtered values */
float _flightHeightFromBarometer = NAN;
float _zVelocityAltitude = NAN;
MpuData _mpuData = { NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN };
MpuData _mpuData = { NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN };
static constexpr const char *_tag = "Sensors";