ardupilot/libraries/AP_DAL/AP_DAL_Airspeed.cpp

39 lines
970 B
C++
Raw Normal View History

#include "AP_DAL_Airspeed.h"
#include "AP_DAL.h"
#include <AP_Logger/AP_Logger.h>
AP_DAL_Airspeed::AP_DAL_Airspeed()
{
2021-11-01 05:18:15 -03:00
#if AP_AIRSPEED_ENABLED
for (uint8_t i=0; i<ARRAY_SIZE(_RASI); i++) {
_RASI[i].instance = i;
}
2021-11-01 05:18:15 -03:00
#endif
}
void AP_DAL_Airspeed::start_frame()
{
2021-11-01 05:18:15 -03:00
#if AP_AIRSPEED_ENABLED
const auto *airspeed = AP::airspeed();
if (airspeed == nullptr) {
return;
}
const log_RASH old = _RASH;
_RASH.num_sensors = airspeed->get_num_sensors();
_RASH.primary = airspeed->get_primary();
2020-11-07 17:29:45 -04:00
WRITE_REPLAY_BLOCK_IFCHANGED(RASH, _RASH, old);
for (uint8_t i=0; i<ARRAY_SIZE(_RASI); i++) {
log_RASI &RASI = _RASI[i];
log_RASI old_RASI = RASI;
2020-11-06 23:41:33 -04:00
RASI.last_update_ms = airspeed->last_update_ms(i);
RASI.healthy = airspeed->healthy(i);
RASI.use = airspeed->use(i);
RASI.airspeed = airspeed->get_airspeed(i);
2020-11-07 17:29:45 -04:00
WRITE_REPLAY_BLOCK_IFCHANGED(RASI, RASI, old_RASI);
}
2021-11-01 05:18:15 -03:00
#endif
}