Skip to content

Commit

Permalink
AP_ExternalAHRS_VectorNav: Resolve SITL failures
Browse files Browse the repository at this point in the history
Fix bug causing pointer to stack variable to be maintained
  • Loading branch information
lashVN committed Jul 19, 2024
1 parent 657c982 commit f733110
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions libraries/AP_ExternalAHRS/AP_ExternalAHRS_VectorNav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ void AP_ExternalAHRS_VectorNav::process_ins_ekf_packet(const uint8_t *b) {
const struct VN_INS_ekf_packet &pkt = *(struct VN_INS_ekf_packet *)b;

last_pkt2_ms = AP_HAL::millis();
latest_ins_ekf_packet = &pkt;
*latest_ins_ekf_packet = pkt;

state.quat = Quaternion{pkt.quaternion[3], pkt.quaternion[0], pkt.quaternion[1], pkt.quaternion[2]};
state.have_quaternion = true;
Expand Down Expand Up @@ -670,7 +670,7 @@ void AP_ExternalAHRS_VectorNav::process_ins_gnss_packet(const uint8_t *b) {


last_pkt3_ms = AP_HAL::millis();
latest_ins_gnss_packet = &pkt;
*latest_ins_gnss_packet = pkt;

// get ToW in milliseconds
gps.gps_week = pkt.timeGps / (AP_MSEC_PER_WEEK * 1000000ULL);
Expand Down
6 changes: 3 additions & 3 deletions libraries/AP_ExternalAHRS/AP_ExternalAHRS_VectorNav.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ class AP_ExternalAHRS_VectorNav : public AP_ExternalAHRS_backend {
uint16_t pktoffset;
uint16_t bufsize;

struct VN_imu_packet const *latest_imu_packet = nullptr;
struct VN_INS_ekf_packet const *latest_ins_ekf_packet = nullptr;
struct VN_INS_gnss_packet const *latest_ins_gnss_packet = nullptr;
struct VN_imu_packet *latest_imu_packet = nullptr;
struct VN_INS_ekf_packet *latest_ins_ekf_packet = nullptr;
struct VN_INS_gnss_packet *latest_ins_gnss_packet = nullptr;

uint32_t last_pkt1_ms = UINT32_MAX;
uint32_t last_pkt2_ms = UINT32_MAX;
Expand Down

0 comments on commit f733110

Please sign in to comment.