Hi!
Hardware details: Pixhawk, Teensy (Arduino)
Query:
Below I attached a fragment of my code and there is an issue that the fix type is displaying with delay on the serial monitor. All over my code there is no delay and I just print “millis()” to check the delay and it is varying between 1 to 3 seconds. So, I also get the GPS raw data with the same delay. Is there any solution to fix it?
while (Serial1.available()) {
uint8_t c = Serial1.read();
//Get new message
if (mavlink_parse_char(MAVLINK_COMM_0, c, &msg, &status)) {
//Handle new message from autopilot
switch (msg.msgid) {
case MAVLINK_MSG_ID_GPS_RAW_INT:
{
mavlink_gps_raw_int_t packet;
mavlink_msg_gps_raw_int_decode(&msg, &packet);
gps_raw_lat = packet.lat;
// Serial.println(gps_raw_lat);
gps_lat1 = gps_raw_lat * 0.0000001L;
//Serial.println(gps_lat1, 5);
gps_raw_lon = packet.lon;
gps_lon1 = gps_raw_lon * 0.0000001L;
fix = packet.fix_type;
Serial.println(millis()):
}