Skip to content

Commit b341228

Browse files
committed
Check for spaces. Decrement selectedCoords on delete
1 parent e073a0e commit b341228

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

Firmware/RTK_Everywhere/menuBase.ino

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -580,25 +580,20 @@ bool menuCommonBaseCoords()
580580
char *ptr = newCoords;
581581
if ((getUserInputString(newCoords, sizeof(newCoords)) == INPUT_RESPONSE_VALID) && (strlen(newCoords) > 0))
582582
{
583-
if (settings.fixedBaseCoordinateType == COORD_TYPE_GEODETIC)
583+
double latx;
584+
double lony;
585+
double altz;
586+
char baseName[100];
587+
if ((sscanf(ptr,"%[^,],%lf,%lf,%lf", baseName, &latx, &lony, &altz) == 4)
588+
&& (strlen(baseName) > 0)
589+
&& (strstr(baseName, " ") == nullptr)) // Check for spaces
584590
{
585-
double lat;
586-
double lon;
587-
double alt;
588-
char baseName[100];
589-
if (sscanf(ptr,"%[^,],%lf,%lf,%lf", baseName, &lat, &lon, &alt) == 4)
591+
if (settings.fixedBaseCoordinateType == COORD_TYPE_GEODETIC)
590592
{
591593
recordLineToSD(stationCoordinateGeodeticFileName, newCoords);
592594
recordLineToLFS(stationCoordinateGeodeticFileName, newCoords);
593595
}
594-
}
595-
else
596-
{
597-
double x;
598-
double y;
599-
double z;
600-
char baseName[100];
601-
if (sscanf(ptr,"%[^,],%lf,%lf,%lf", baseName, &x, &y, &z) == 4)
596+
else
602597
{
603598
recordLineToSD(stationCoordinateECEFFileName, newCoords);
604599
recordLineToLFS(stationCoordinateECEFFileName, newCoords);
@@ -618,6 +613,9 @@ bool menuCommonBaseCoords()
618613
removeLineFromSD(stationCoordinateECEFFileName, selectedCoords);
619614
removeLineFromLFS(stationCoordinateECEFFileName, selectedCoords);
620615
}
616+
617+
if (selectedCoords > 0)
618+
selectedCoords -= 1;
621619
}
622620
else if (incoming == 'l')
623621
{

0 commit comments

Comments
 (0)