CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_DAL/AP_DAL_Baro.cpp
Views: 1798
1
#include "AP_DAL_Baro.h"
2
3
#include <AP_Logger/AP_Logger.h>
4
#include "AP_DAL.h"
5
6
AP_DAL_Baro::AP_DAL_Baro()
7
{
8
for (uint8_t i=0; i<BARO_MAX_INSTANCES; i++) {
9
_RBRI[i].instance = i;
10
}
11
}
12
13
void AP_DAL_Baro::start_frame()
14
{
15
const auto &baro = AP::baro();
16
17
const log_RBRH old_RBRH = _RBRH;
18
_RBRH.primary = baro.get_primary();
19
_RBRH.num_instances = baro.num_instances();
20
WRITE_REPLAY_BLOCK_IFCHANGED(RBRH, _RBRH, old_RBRH);
21
22
for (uint8_t i=0; i<_RBRH.num_instances; i++) {
23
log_RBRI &RBRI = _RBRI[i];
24
log_RBRI old = RBRI;
25
RBRI.last_update_ms = baro.get_last_update(i);
26
RBRI.healthy = baro.healthy(i);
27
RBRI.altitude = baro.get_altitude(i);
28
WRITE_REPLAY_BLOCK_IFCHANGED(RBRI, _RBRI[i], old);
29
}
30
}
31
32
void AP_DAL_Baro::update_calibration()
33
{
34
AP::baro().update_calibration();
35
}
36
37