#pragma once
#include <AP_Baro/AP_Baro.h>
#include <AP_Logger/LogStructure.h>
class AP_DAL_Baro {
public:
uint8_t get_primary() const {
return _RBRH.primary;
}
uint8_t num_instances() const {
return _RBRH.num_instances;
}
bool healthy(uint8_t sensor_id) const {
return _RBRI[sensor_id].healthy;
}
uint32_t get_last_update(uint8_t sensor_id) const {
return _RBRI[sensor_id].last_update_ms;
}
uint32_t get_last_update() const {
return get_last_update(get_primary());
}
float get_altitude(uint8_t sensor_id) const {
return _RBRI[sensor_id].altitude;
}
float get_altitude() const {
return get_altitude(get_primary());
}
void update_calibration();
AP_DAL_Baro();
void start_frame();
void handle_message(const log_RBRH &msg) {
_RBRH = msg;
}
void handle_message(const log_RBRI &msg) {
_RBRI[msg.instance] = msg;
}
private:
struct log_RBRH _RBRH;
struct log_RBRI _RBRI[BARO_MAX_INSTANCES];
};