|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
#include <TinyGPS++.h>
|
|
|
|
|
#include <SD.h>
|
|
|
|
|
|
|
|
|
|
#include "settings.h"
|
|
|
|
|
#include "random.h"
|
|
|
|
@ -16,7 +17,7 @@ void setup() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gps_begin();
|
|
|
|
|
TinyGPSLocation loc = gps_location();
|
|
|
|
|
TinyGPSPlus gps_data = gps_location();
|
|
|
|
|
gps_end();
|
|
|
|
|
|
|
|
|
|
Serial.print("[main] Location: ("); Serial.print(loc.lat()); Serial.print(", "); Serial.print(loc.lng()); Serial.println(")");
|
|
|
|
@ -26,6 +27,23 @@ void setup() {
|
|
|
|
|
Serial.print("[main] id: ");
|
|
|
|
|
Serial.println(id);
|
|
|
|
|
|
|
|
|
|
store_init();
|
|
|
|
|
store_reading(id, gps_data.location);
|
|
|
|
|
char debug_message[64];
|
|
|
|
|
int chars = snprintf(debug_message, 64, "%d-%d-%d %d:%d:%d | %f %f",
|
|
|
|
|
gps_data.date.year(),
|
|
|
|
|
gps_data.date.month(),
|
|
|
|
|
gps_data.date.day(),
|
|
|
|
|
gps_data.time.hour(),
|
|
|
|
|
gps_data.time.minute(),
|
|
|
|
|
gps_data.time.second(),
|
|
|
|
|
gps_data.location.lat(),
|
|
|
|
|
gps_data.location.lng(),
|
|
|
|
|
);
|
|
|
|
|
store_debug(debug_message, chars);
|
|
|
|
|
store_close();
|
|
|
|
|
|
|
|
|
|
power_off(); // Doesn't return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
|