ardupilot/libraries/AP_DAL/AP_DAL_Baro.cpp

36 lines
858 B
C++
Raw Normal View History

#include "AP_DAL_Baro.h"
#include <AP_Logger/AP_Logger.h>
#include "AP_DAL.h"
AP_DAL_Baro::AP_DAL_Baro()
{
for (uint8_t i=0; i<BARO_MAX_INSTANCES; i++) {
_RBRI[i].instance = i;
}
}
void AP_DAL_Baro::start_frame()
{
const auto &baro = AP::baro();
const log_RBRH old_RBRH = _RBRH;
_RBRH.primary = baro.get_primary();
_RBRH.num_instances = baro.num_instances();
2020-11-07 17:29:45 -04:00
WRITE_REPLAY_BLOCK_IFCHANGED(RBRH, _RBRH, old_RBRH);
2020-11-07 17:29:45 -04:00
for (uint8_t i=0; i<_RBRH.num_instances; i++) {
log_RBRI &RBRI = _RBRI[i];
log_RBRI old = RBRI;
2020-11-09 04:49:27 -04:00
RBRI.last_update_ms = baro.get_last_update(i);
RBRI.healthy = baro.healthy(i);
RBRI.altitude = baro.get_altitude(i);
2020-11-07 17:29:45 -04:00
WRITE_REPLAY_BLOCK_IFCHANGED(RBRI, _RBRI[i], old);
}
}
void AP_DAL_Baro::update_calibration()
{
AP::baro().update_calibration();
}