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_Airspeed.cpp
Views: 1798
1
#include "AP_DAL_Airspeed.h"
2
#include "AP_DAL.h"
3
4
#include <AP_Logger/AP_Logger.h>
5
6
AP_DAL_Airspeed::AP_DAL_Airspeed()
7
{
8
#if AP_AIRSPEED_ENABLED
9
for (uint8_t i=0; i<ARRAY_SIZE(_RASI); i++) {
10
_RASI[i].instance = i;
11
}
12
#endif
13
}
14
15
void AP_DAL_Airspeed::start_frame()
16
{
17
#if AP_AIRSPEED_ENABLED
18
const auto *airspeed = AP::airspeed();
19
if (airspeed == nullptr) {
20
return;
21
}
22
23
const log_RASH old = _RASH;
24
_RASH.num_sensors = airspeed->get_num_sensors();
25
_RASH.primary = airspeed->get_primary();
26
WRITE_REPLAY_BLOCK_IFCHANGED(RASH, _RASH, old);
27
28
for (uint8_t i=0; i<ARRAY_SIZE(_RASI); i++) {
29
log_RASI &RASI = _RASI[i];
30
log_RASI old_RASI = RASI;
31
RASI.last_update_ms = airspeed->last_update_ms(i);
32
RASI.healthy = airspeed->healthy(i);
33
RASI.use = airspeed->use(i);
34
RASI.airspeed = airspeed->get_airspeed(i);
35
WRITE_REPLAY_BLOCK_IFCHANGED(RASI, RASI, old_RASI);
36
}
37
#endif
38
}
39
40