AP_GPS: constrain rate_ms from 5Hz to 20Hz

This commit is contained in:
Andrew Tridgell 2018-11-20 11:58:25 +11:00
parent 7a4b8d76c1
commit 685771c145
1 changed files with 2 additions and 1 deletions

View File

@ -264,7 +264,8 @@ void AP_GPS_Backend::check_new_itow(uint32_t itow, uint32_t msg_length)
_last_rate_ms = dt_ms; _last_rate_ms = dt_ms;
} }
if (_rate_ms == 0) { if (_rate_ms == 0) {
_rate_ms = gps.get_rate_ms(state.instance); // only allow 5Hz to 20Hz in user config
_rate_ms = constrain_int16(gps.get_rate_ms(state.instance), 50, 200);
} }
// round to calculated message rate // round to calculated message rate