Browse Source

remove faulty movementdependant GPS updates

master
noerw 1 year ago
parent
commit
d8c730f363
1 changed files with 6 additions and 20 deletions
  1. 6
    20
      sdcard-gps/sdcard-gps.ino

+ 6
- 20
sdcard-gps/sdcard-gps.ino View File

@@ -32,8 +32,7 @@
32 32
 #define DEBUG_OUT Serial2
33 33
 #define SD_CHIPSELECT 4
34 34
 
35
-#define MEASURE_INTERVAL 30000
36
-#define GPSIDLE_INTERVAL 300000
35
+#define MEASURE_INTERVAL 15000
37 36
 
38 37
 //Load sensors
39 38
 SDS011 sds(Serial);
@@ -45,7 +44,6 @@ String logfile_path;
45 44
 uint32_t cyclestart = 0;
46 45
 double lastLat = 0;
47 46
 double lastLng = 0;
48
-long gpsupdate_scheduled = 0;
49 47
 
50 48
 //measurement variables
51 49
 float temperature = 0, humidity = 0, pm10 = 0, pm25 = 0;
@@ -254,25 +252,13 @@ void setup() {
254 252
 void loop(void) {
255 253
   cyclestart = millis();
256 254
 
257
-  // TODO: only update fix, if accelerometer indicates movement?
258
-  // TODO: check battery voltage & blink LED if low?
259
-  if (millis() >= gpsupdate_scheduled) {
260
-    if (!updateLocation()) {
261
-      return DEBUG_OUT.println("couldnt get fix");
262
-    }
263
-
264
-    // determine, how far we moved. if less than 20m, reduce update interval
265
-    if (gps.distanceBetween(lastLat, lastLng, gps.location.lat(), gps.location.lng()) > 20) {
266
-      gpsupdate_scheduled = cyclestart + MEASURE_INTERVAL;
267
-    } else {
268
-      gpsupdate_scheduled = cyclestart + GPSIDLE_INTERVAL;
269
-      //digitalWrite(GPS_ENABLE, LOW); // save energy for longer interval
270
-    }
271
-
272
-    lastLat = gps.location.lat();
273
-    lastLng = gps.location.lng();
255
+  if (!updateLocation()) {
256
+    return DEBUG_OUT.println("couldnt get fix");
274 257
   }
275 258
 
259
+  lastLat = gps.location.lat();
260
+  lastLng = gps.location.lng();
261
+
276 262
 
277 263
   //-----Temperature-----//
278 264
   temperature = HDC.getTemp();

Loading…
Cancel
Save