navigator: geofence with global pos: reduce update rate

This commit is contained in:
Thomas Gubler 2014-09-21 18:04:11 +02:00
parent 31a17ce29a
commit e3cac1999a
1 changed files with 5 additions and 1 deletions

View File

@ -386,9 +386,13 @@ Navigator::task_main()
/* global position updated */
if (fds[0].revents & POLLIN) {
global_position_update();
if (_geofence.getSource() == Geofence::GF_SOURCE_GLOBALPOS) {
static int gposcounter = 0;
if (_geofence.getSource() == Geofence::GF_SOURCE_GLOBALPOS &&
gposcounter % 10 == 0) {
/* Geofence is checked only every 10th gpos update */
have_geofence_position_data = true;
}
gposcounter++;
}
/* Check geofence violation */