|
@@ -204,13 +204,37 @@ void task_mediciones(void *pvParameters) {
|
|
|
File file = SD.open(filename, FILE_APPEND);
|
|
File file = SD.open(filename, FILE_APPEND);
|
|
|
if (file) {
|
|
if (file) {
|
|
|
//Crear la string para escribir en el archivo
|
|
//Crear la string para escribir en el archivo
|
|
|
- String frase = '\t\t\t<trkpt> lat="' + String(datosAntiguos.latitude,6) +
|
|
|
|
|
- '" lon="' + String(datosAntiguos.longitude,6) + '">\n\t\t\t\t<ele>'+
|
|
|
|
|
- String(datosAntiguos.altura) + '</ele>\n\t\t\t\t<time>'+
|
|
|
|
|
- datosAntiguos.tiempo+'</time>\n\t\t\t\t<extensions>\n\t\t\t\t\t<gpxtpx:TrackPointExtension>\n\t\t\t\t\t\t<gpxtpx:atemp>'+
|
|
|
|
|
- String(datosAntiguos.temperature)+'</gpxtpx:atemp>\n\t\t\t\t\t</gpxtpx:TrackPointExtension>\n\t\t\t\t\t<custom:humidity>'+
|
|
|
|
|
- String(datosAntiguos.humidity)+'</custom:humidity>\n\t\t\t\t\t<custom:pressure>'+String(datosAntiguos.pressure)+
|
|
|
|
|
- '</custom:pressure>\n\t\t\t\t</extensions>\n\t\t\t</trkpt>';
|
|
|
|
|
|
|
+ file.print(F("\t\t\t<trkpt lat=\""));
|
|
|
|
|
+ file.print(datosAntiguos.latitude, 6);
|
|
|
|
|
+ file.print(F("\" lon=\""));
|
|
|
|
|
+ file.print(datosAntiguos.longitude, 6);
|
|
|
|
|
+ file.println(F("\">"));
|
|
|
|
|
+
|
|
|
|
|
+ file.print(F("\t\t\t\t<ele>"));
|
|
|
|
|
+ file.print(datosAntiguos.altura);
|
|
|
|
|
+ file.println(F("</ele>"));
|
|
|
|
|
+
|
|
|
|
|
+ file.print(F("\t\t\t\t<time>"));
|
|
|
|
|
+ file.print(datosAntiguos.tiempo);
|
|
|
|
|
+ file.println(F("</time>"));
|
|
|
|
|
+
|
|
|
|
|
+ file.println(F("\t\t\t\t<extensions>"));
|
|
|
|
|
+ file.println(F("\t\t\t\t\t<gpxtpx:TrackPointExtension>"));
|
|
|
|
|
+ file.print(F("\t\t\t\t\t\t<gpxtpx:atemp>"));
|
|
|
|
|
+ file.print(datosAntiguos.temperature);
|
|
|
|
|
+ file.println(F("</gpxtpx:atemp>"));
|
|
|
|
|
+ file.println(F("\t\t\t\t\t</gpxtpx:TrackPointExtension>"));
|
|
|
|
|
+
|
|
|
|
|
+ file.print(F("\t\t\t\t\t<custom:humidity>"));
|
|
|
|
|
+ file.print(datosAntiguos.humidity);
|
|
|
|
|
+ file.println(F("</custom:humidity>"));
|
|
|
|
|
+
|
|
|
|
|
+ file.print(F("\t\t\t\t\t<custom:pressure>"));
|
|
|
|
|
+ file.print(datosAntiguos.pressure);
|
|
|
|
|
+ file.println(F("</custom:pressure>"));
|
|
|
|
|
+
|
|
|
|
|
+ file.println(F("\t\t\t\t</extensions>"));
|
|
|
|
|
+ file.println(F("\t\t\t</trkpt>"));
|
|
|
|
|
|
|
|
// Escribir datos en el archivo
|
|
// Escribir datos en el archivo
|
|
|
file.println(frase);
|
|
file.println(frase);
|
|
@@ -231,10 +255,17 @@ void crear_archivo(){
|
|
|
|
|
|
|
|
File file = SD.open(filename, FILE_WRITE);
|
|
File file = SD.open(filename, FILE_WRITE);
|
|
|
if (file) {
|
|
if (file) {
|
|
|
- file.println('<?xml version="1.0" encoding="UTF-8"?>\n<gpx creator="ESP32 GPS LOGGER" version="1.1"\n\txmlns="http://www.topografix.com/GPX/1/1"\n\t
|
|
|
|
|
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n\txmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v2"\n\t
|
|
|
|
|
- xmlns:gpxdata="http://www.cluetrust.com/XML/GPXDATA/1/0"\n\txsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">\n\t<trk>\n\t\t
|
|
|
|
|
- <name>Rutita</name>\n\t\t<type>hiking</type>\n\t\t<trkseg>');
|
|
|
|
|
|
|
+ file.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
|
|
|
|
+ "<gpx creator=\"ESP32 GPS LOGGER\" version=\"1.1\"\n"
|
|
|
|
|
+ "\txmlns=\"http://www.topografix.com/GPX/1/1\"\n"
|
|
|
|
|
+ "\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
|
|
|
|
|
+ "\txmlns:gpxtpx=\"http://www.garmin.com/xmlschemas/TrackPointExtension/v2\"\n"
|
|
|
|
|
+ "\txmlns:gpxdata=\"http://www.cluetrust.com/XML/GPXDATA/1/0\"\n"
|
|
|
|
|
+ "\txsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\">\n"
|
|
|
|
|
+ "\t<trk>\n"
|
|
|
|
|
+ "\t\t<name>Rutita</name>\n"
|
|
|
|
|
+ "\t\t<type>hiking</type>\n"
|
|
|
|
|
+ "\t\t<trkseg>");
|
|
|
file.close();
|
|
file.close();
|
|
|
} else {
|
|
} else {
|
|
|
OLED_print("Error","creando archivo");
|
|
OLED_print("Error","creando archivo");
|
|
@@ -244,7 +275,7 @@ void crear_archivo(){
|
|
|
void cerrar_archivo() {
|
|
void cerrar_archivo() {
|
|
|
File file = SD.open(filename, FILE_APPEND);
|
|
File file = SD.open(filename, FILE_APPEND);
|
|
|
if (file){
|
|
if (file){
|
|
|
- file.print('\t\t</trkseg>\n\t</trk>\n</gpx>');
|
|
|
|
|
|
|
+ file.print("\t\t</trkseg>\n\t</trk>\n</gpx>");
|
|
|
file.close();
|
|
file.close();
|
|
|
}
|
|
}
|
|
|
int num = 1;
|
|
int num = 1;
|