Skip to content

Commit f535b12

Browse files
committed
Add Add Current Coordinates
1 parent b341228 commit f535b12

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

Firmware/RTK_Everywhere/menuBase.ino

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,10 @@ bool menuCommonBaseCoords()
554554
numCoords++;
555555
}
556556

557-
systemPrintln("a) Add");
558-
systemPrintln("d) Delete");
559-
systemPrintln("l) Load");
557+
systemPrintln("a) Add Coordinates");
558+
systemPrintln("c) Add Current Coordinates");
559+
systemPrintln("d) Delete Coordinates");
560+
systemPrintln("l) Load Coordinates into Fixed Base");
560561
systemPrintln("x) Exit");
561562

562563
byte incoming = getUserInputCharacterNumber();
@@ -601,6 +602,36 @@ bool menuCommonBaseCoords()
601602
}
602603
}
603604
}
605+
else if (incoming == 'c')
606+
{
607+
char newCoords[100];
608+
struct tm timeinfo = rtc.getTimeStruct();
609+
char timestamp[30];
610+
strftime(timestamp, sizeof(timestamp), "%Y-%m-%d_%H:%M:%S", &timeinfo);
611+
if (settings.fixedBaseCoordinateType == COORD_TYPE_GEODETIC)
612+
{
613+
snprintf(newCoords, sizeof(newCoords), "%s,%.8lf,%.8lf,%.4lf",
614+
timestamp,
615+
gnss->getLatitude(),
616+
gnss->getLongitude(),
617+
gnss->getAltitude() - ((settings.antennaHeight_mm + settings.antennaPhaseCenter_mm) / 1000.0));
618+
recordLineToSD(stationCoordinateGeodeticFileName, newCoords);
619+
recordLineToLFS(stationCoordinateGeodeticFileName, newCoords);
620+
}
621+
else
622+
{
623+
double ecefX = 0;
624+
double ecefY = 0;
625+
double ecefZ = 0;
626+
geodeticToEcef(gnss->getLatitude(), gnss->getLongitude(),
627+
gnss->getAltitude() - ((settings.antennaHeight_mm + settings.antennaPhaseCenter_mm) / 1000.0),
628+
&ecefX, &ecefY, &ecefZ);
629+
snprintf(newCoords, sizeof(newCoords), "%s,%.4lf,%.4lf,%.4lf",
630+
timestamp, ecefX, ecefY, ecefZ);
631+
recordLineToSD(stationCoordinateECEFFileName, newCoords);
632+
recordLineToLFS(stationCoordinateECEFFileName, newCoords);
633+
}
634+
}
604635
else if (incoming == 'd')
605636
{
606637
if (settings.fixedBaseCoordinateType == COORD_TYPE_GEODETIC)

0 commit comments

Comments
 (0)