Skip to content

Commit 09378c8

Browse files
committed
Gracefully exit base data entry with timeout or 'x'
1 parent 18d7e1f commit 09378c8

File tree

1 file changed

+34
-24
lines changed

1 file changed

+34
-24
lines changed

Firmware/RTK_Surveyor/menuBase.ino

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -94,39 +94,49 @@ void menuBase()
9494

9595
Serial.print(F("ECEF X in meters (ex: -1280182.920): "));
9696
double fixedEcefX = getDouble(menuTimeout); //Timeout after x seconds
97-
settings.fixedEcefX = fixedEcefX;
9897

99-
Serial.print(F("\nECEF Y in meters (ex: -4716808.5807): "));
100-
double fixedEcefY = getDouble(menuTimeout);
101-
settings.fixedEcefY = fixedEcefY;
102-
103-
Serial.print(F("\nECEF Z in meters (ex: 4086669.6393): "));
104-
double fixedEcefZ = getDouble(menuTimeout);
105-
settings.fixedEcefZ = fixedEcefZ;
106-
107-
Serial.printf("\nX: %f\n", settings.fixedEcefX);
108-
Serial.printf("Y: %f\n", settings.fixedEcefY);
109-
Serial.printf("Z: %f\n", settings.fixedEcefZ);
98+
//Progress with additional prompts only if the user enters valid data
99+
if (fixedEcefX != STATUS_GETNUMBER_TIMEOUT && fixedEcefX != STATUS_PRESSED_X)
100+
{
101+
settings.fixedEcefX = fixedEcefX;
102+
103+
Serial.print(F("\nECEF Y in meters (ex: -4716808.5807): "));
104+
double fixedEcefY = getDouble(menuTimeout);
105+
if (fixedEcefY != STATUS_GETNUMBER_TIMEOUT && fixedEcefY != STATUS_PRESSED_X)
106+
{
107+
settings.fixedEcefY = fixedEcefY;
108+
109+
Serial.print(F("\nECEF Z in meters (ex: 4086669.6393): "));
110+
double fixedEcefZ = getDouble(menuTimeout);
111+
if (fixedEcefZ != STATUS_GETNUMBER_TIMEOUT && fixedEcefZ != STATUS_PRESSED_X)
112+
settings.fixedEcefZ = fixedEcefZ;
113+
}
114+
}
110115
}
111116
else if (settings.fixedBaseCoordinateType == COORD_TYPE_GEOGRAPHIC)
112117
{
113118
Serial.println(F("Enter the fixed Lat/Long/Altitude coordinates that will be used in Base mode:"));
114119

115120
Serial.print(F("Lat in degrees (ex: -105.184774720): "));
116121
double fixedLat = getDouble(menuTimeout); //Timeout after x seconds
117-
settings.fixedLat = fixedLat;
118-
119-
Serial.print(F("\nLong in degrees (ex: 40.090335429): "));
120-
double fixedLong = getDouble(menuTimeout);
121-
settings.fixedLong = fixedLong;
122-
123-
Serial.print(F("\nAltitude in meters (ex: 1560.2284): "));
124-
double fixedAltitude = getDouble(menuTimeout);
125-
settings.fixedAltitude = fixedAltitude;
126122

127-
Serial.printf("\nlat: %f\n", settings.fixedLat);
128-
Serial.printf("long: %f\n", settings.fixedLong);
129-
Serial.printf("altitude: %f\n", settings.fixedAltitude);
123+
//Progress with additional prompts only if the user enters valid data
124+
if (fixedLat != STATUS_GETNUMBER_TIMEOUT && fixedLat != STATUS_PRESSED_X)
125+
{
126+
settings.fixedLat = fixedLat;
127+
128+
Serial.print(F("\nLong in degrees (ex: 40.090335429): "));
129+
double fixedLong = getDouble(menuTimeout);
130+
if (fixedLong != STATUS_GETNUMBER_TIMEOUT && fixedLong != STATUS_PRESSED_X)
131+
{
132+
settings.fixedLong = fixedLong;
133+
134+
Serial.print(F("\nAltitude in meters (ex: 1560.2284): "));
135+
double fixedAltitude = getDouble(menuTimeout);
136+
if (fixedAltitude != STATUS_GETNUMBER_TIMEOUT && fixedAltitude != STATUS_PRESSED_X)
137+
settings.fixedAltitude = fixedAltitude;
138+
}
139+
}
130140
}
131141
}
132142
else if (settings.fixedBase == false && incoming == 2)

0 commit comments

Comments
 (0)