From 77caedcda2af85dda6bcc1be653e9df752b66b07 Mon Sep 17 00:00:00 2001 From: "Konstantin Sharlaimov (DigitalEntity)" Date: Thu, 26 Nov 2015 22:41:05 +1000 Subject: [PATCH] Limit I2C GPS retry rate to 1/500ms. Prevent I2C bus from being flooded by failed I2C transactions when no I2C-GPS is present --- src/main/io/gps.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/io/gps.c b/src/main/io/gps.c index 62e3d22803..bfffdd0627 100755 --- a/src/main/io/gps.c +++ b/src/main/io/gps.c @@ -402,6 +402,13 @@ bool gpsDetectI2C(void) void gpsInitI2C(void) { + static uint32_t lastRetryMillis = 0; + + if ((millis() - lastRetryMillis) < 500) + return; + + lastRetryMillis = millis(); + switch(gpsData.state) { case GPS_INITIALIZING: case GPS_CHANGE_BAUD: