Skip to content

Commit e40a86b

Browse files
committed
Add Current Coordinates with Timestamp
1 parent f535b12 commit e40a86b

File tree

1 file changed

+60
-25
lines changed

1 file changed

+60
-25
lines changed

Firmware/RTK_Everywhere/menuBase.ino

Lines changed: 60 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ bool menuCommonBaseCoords()
558558
systemPrintln("c) Add Current Coordinates");
559559
systemPrintln("d) Delete Coordinates");
560560
systemPrintln("l) Load Coordinates into Fixed Base");
561+
systemPrintln("t) Add Current Coordinates with Timestamp");
561562
systemPrintln("x) Exit");
562563

563564
byte incoming = getUserInputCharacterNumber();
@@ -604,32 +605,36 @@ bool menuCommonBaseCoords()
604605
}
605606
else if (incoming == 'c')
606607
{
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
608+
systemPrintln("Enter the name for these coordinates:");
609+
char coordsName[50];
610+
if ((getUserInputString(coordsName, sizeof(coordsName)) == INPUT_RESPONSE_VALID)
611+
&& (strlen(coordsName) > 0)
612+
&& (strstr(coordsName, " ") == nullptr))
622613
{
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);
614+
char newCoords[100];
615+
if (settings.fixedBaseCoordinateType == COORD_TYPE_GEODETIC)
616+
{
617+
snprintf(newCoords, sizeof(newCoords), "%s,%.8lf,%.8lf,%.4lf",
618+
coordsName,
619+
gnss->getLatitude(),
620+
gnss->getLongitude(),
621+
gnss->getAltitude() - ((settings.antennaHeight_mm + settings.antennaPhaseCenter_mm) / 1000.0));
622+
recordLineToSD(stationCoordinateGeodeticFileName, newCoords);
623+
recordLineToLFS(stationCoordinateGeodeticFileName, newCoords);
624+
}
625+
else
626+
{
627+
double ecefX = 0;
628+
double ecefY = 0;
629+
double ecefZ = 0;
630+
geodeticToEcef(gnss->getLatitude(), gnss->getLongitude(),
631+
gnss->getAltitude() - ((settings.antennaHeight_mm + settings.antennaPhaseCenter_mm) / 1000.0),
632+
&ecefX, &ecefY, &ecefZ);
633+
snprintf(newCoords, sizeof(newCoords), "%s,%.4lf,%.4lf,%.4lf",
634+
coordsName, ecefX, ecefY, ecefZ);
635+
recordLineToSD(stationCoordinateECEFFileName, newCoords);
636+
recordLineToLFS(stationCoordinateECEFFileName, newCoords);
637+
}
633638
}
634639
}
635640
else if (incoming == 'd')
@@ -687,6 +692,36 @@ bool menuCommonBaseCoords()
687692
}
688693
}
689694
}
695+
else if (incoming == 't')
696+
{
697+
char newCoords[100];
698+
struct tm timeinfo = rtc.getTimeStruct();
699+
char timestamp[30];
700+
strftime(timestamp, sizeof(timestamp), "%Y-%m-%d_%H:%M:%S", &timeinfo);
701+
if (settings.fixedBaseCoordinateType == COORD_TYPE_GEODETIC)
702+
{
703+
snprintf(newCoords, sizeof(newCoords), "%s,%.8lf,%.8lf,%.4lf",
704+
timestamp,
705+
gnss->getLatitude(),
706+
gnss->getLongitude(),
707+
gnss->getAltitude() - ((settings.antennaHeight_mm + settings.antennaPhaseCenter_mm) / 1000.0));
708+
recordLineToSD(stationCoordinateGeodeticFileName, newCoords);
709+
recordLineToLFS(stationCoordinateGeodeticFileName, newCoords);
710+
}
711+
else
712+
{
713+
double ecefX = 0;
714+
double ecefY = 0;
715+
double ecefZ = 0;
716+
geodeticToEcef(gnss->getLatitude(), gnss->getLongitude(),
717+
gnss->getAltitude() - ((settings.antennaHeight_mm + settings.antennaPhaseCenter_mm) / 1000.0),
718+
&ecefX, &ecefY, &ecefZ);
719+
snprintf(newCoords, sizeof(newCoords), "%s,%.4lf,%.4lf,%.4lf",
720+
timestamp, ecefX, ecefY, ecefZ);
721+
recordLineToSD(stationCoordinateECEFFileName, newCoords);
722+
recordLineToLFS(stationCoordinateECEFFileName, newCoords);
723+
}
724+
}
690725
else if (incoming == 'x')
691726
break;
692727
else if (incoming == INPUT_RESPONSE_GETCHARACTERNUMBER_EMPTY)

0 commit comments

Comments
 (0)