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