Skip to content

Commit

Permalink
AP_ExternalAHRS_VectorNav: Update VectorNav sim to respond to receive…
Browse files Browse the repository at this point in the history
…d commands

Aside from the RRG,1 call, the simulation should reply with exactly what was received as a receipt confirmation to allow the driver to proceed past init
  • Loading branch information
lashVN committed Jul 16, 2024
1 parent 9611503 commit a8370f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 7 additions & 5 deletions libraries/SITL/SIM_VectorNav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,13 @@ void VectorNav::update(void)
send_packet2();
}

// Strictly we should send this in responce to the request
// but sending it occasionally acheaves the same thing
if (now - last_type_us >= 1000000) {
last_type_us = now;
nmea_printf("$VNRRG,01,VN-300-SITL");
const ssize_t n = read_from_autopilot(&receive_buf[0], ARRAY_SIZE(receive_buf));
if (n > 0) {
if (strncmp(receive_buf, "$VNRRG,01", 9) == 0) {
nmea_printf("$VNRRG,01,VN-300-SITL");
} else {
nmea_printf("$%s", receive_buf);
}
}

}
Expand Down
2 changes: 2 additions & 0 deletions libraries/SITL/SIM_VectorNav.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class VectorNav : public SerialDevice {
uint32_t last_pkt2_us;
uint32_t last_type_us;

char receive_buf[50];

void send_packet1();
void send_packet2();
void nmea_printf(const char *fmt, ...);
Expand Down

0 comments on commit a8370f3

Please sign in to comment.