From d8c730f363f101e1449cb449408804c8b5a55231 Mon Sep 17 00:00:00 2001 From: noerw Date: Mon, 25 Sep 2017 10:01:57 +0200 Subject: [PATCH] remove faulty movementdependant GPS updates --- sdcard-gps/sdcard-gps.ino | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/sdcard-gps/sdcard-gps.ino b/sdcard-gps/sdcard-gps.ino index e82df7d..2b31f64 100644 --- a/sdcard-gps/sdcard-gps.ino +++ b/sdcard-gps/sdcard-gps.ino @@ -32,8 +32,7 @@ #define DEBUG_OUT Serial2 #define SD_CHIPSELECT 4 -#define MEASURE_INTERVAL 30000 -#define GPSIDLE_INTERVAL 300000 +#define MEASURE_INTERVAL 15000 //Load sensors SDS011 sds(Serial); @@ -45,7 +44,6 @@ String logfile_path; uint32_t cyclestart = 0; double lastLat = 0; double lastLng = 0; -long gpsupdate_scheduled = 0; //measurement variables float temperature = 0, humidity = 0, pm10 = 0, pm25 = 0; @@ -254,25 +252,13 @@ void setup() { void loop(void) { cyclestart = millis(); - // TODO: only update fix, if accelerometer indicates movement? - // TODO: check battery voltage & blink LED if low? - if (millis() >= gpsupdate_scheduled) { - if (!updateLocation()) { - return DEBUG_OUT.println("couldnt get fix"); - } - - // determine, how far we moved. if less than 20m, reduce update interval - if (gps.distanceBetween(lastLat, lastLng, gps.location.lat(), gps.location.lng()) > 20) { - gpsupdate_scheduled = cyclestart + MEASURE_INTERVAL; - } else { - gpsupdate_scheduled = cyclestart + GPSIDLE_INTERVAL; - //digitalWrite(GPS_ENABLE, LOW); // save energy for longer interval - } - - lastLat = gps.location.lat(); - lastLng = gps.location.lng(); + if (!updateLocation()) { + return DEBUG_OUT.println("couldnt get fix"); } + lastLat = gps.location.lat(); + lastLng = gps.location.lng(); + //-----Temperature-----// temperature = HDC.getTemp();