2017-04-12 08:17:19 -03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "AP_Baro_Backend.h"
|
|
|
|
|
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
|
|
|
#include <SITL/SITL.h>
|
|
|
|
#include <AP_Math/vectorN.h>
|
|
|
|
|
|
|
|
class AP_Baro_SITL : public AP_Baro_Backend {
|
|
|
|
public:
|
|
|
|
AP_Baro_SITL(AP_Baro &);
|
|
|
|
|
|
|
|
void update() override;
|
|
|
|
|
2017-07-12 02:03:33 -03:00
|
|
|
protected:
|
|
|
|
|
|
|
|
void update_healthy_flag(uint8_t instance) override { _frontend.sensors[instance].healthy = true; }
|
|
|
|
|
2017-04-12 08:17:19 -03:00
|
|
|
private:
|
2017-07-24 05:57:05 -03:00
|
|
|
uint8_t _instance;
|
2017-07-24 08:00:36 -03:00
|
|
|
SITL::SITL *_sitl;
|
2017-04-12 08:17:19 -03:00
|
|
|
|
|
|
|
// barometer delay buffer variables
|
|
|
|
struct readings_baro {
|
|
|
|
uint32_t time;
|
|
|
|
float data;
|
|
|
|
};
|
2017-07-24 08:00:36 -03:00
|
|
|
uint8_t _store_index;
|
|
|
|
uint32_t _last_store_time;
|
|
|
|
static const uint8_t _buffer_length = 50;
|
|
|
|
VectorN<readings_baro, _buffer_length> _buffer;
|
2017-04-12 08:17:19 -03:00
|
|
|
|
2017-04-12 19:49:08 -03:00
|
|
|
// adjust for simulated board temperature
|
|
|
|
void temperature_adjustment(float &p, float &T);
|
2017-06-21 11:58:39 -03:00
|
|
|
|
|
|
|
void _timer();
|
|
|
|
bool _has_sample;
|
|
|
|
uint32_t _last_sample_time;
|
|
|
|
float _recent_temp;
|
|
|
|
float _recent_press;
|
|
|
|
|
2017-04-12 08:17:19 -03:00
|
|
|
};
|
2017-07-24 05:57:21 -03:00
|
|
|
#endif // CONFIG_HAL_BOARD
|