Skip to content

Commit 94cb201

Browse files
committed
drivers/gps: warn if gps_inject_data publications have been missed
1 parent 216fd85 commit 94cb201

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/drivers/gps/gps.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,17 @@ void GPS::handleInjectDataTopic()
601601
}
602602
}
603603

604-
updated = _orb_inject_data_sub[_selected_rtcm_instance].update(&msg);
604+
auto &gps_inject_data_sub = _orb_inject_data_sub[_selected_rtcm_instance];
605+
606+
const unsigned last_generation = gps_inject_data_sub.get_last_generation();
607+
608+
updated = gps_inject_data_sub.update(&msg);
609+
610+
if (updated) {
611+
if (gps_inject_data_sub.get_last_generation() != last_generation + 1) {
612+
PX4_WARN("gps_inject_data lost, generation %u -> %u", last_generation, gps_inject_data_sub.get_last_generation());
613+
}
614+
}
605615

606616
} while (updated && num_injections < max_num_injections);
607617
}

0 commit comments

Comments
 (0)