Skip to content

Commit 0bb0c5e

Browse files
committed
Limit Main Menu while in configureViaEthernet mode
1 parent 0dbaadc commit 0bb0c5e

File tree

2 files changed

+187
-137
lines changed

2 files changed

+187
-137
lines changed

Firmware/RTK_Everywhere/menuMain.ino

Lines changed: 185 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -45,160 +45,210 @@ void menuMain()
4545
return;
4646
}
4747

48-
while (1)
48+
if (configureViaEthernet)
4949
{
50-
systemPrintln();
51-
char versionString[21];
52-
getFirmwareVersion(versionString, sizeof(versionString), true);
53-
systemPrintf("SparkFun RTK %s %s\r\n", platformPrefix, versionString);
54-
55-
#ifdef COMPILE_BT
56-
57-
if (settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP_AND_BLE)
58-
systemPrint("** Bluetooth SPP and BLE broadcasting as: ");
59-
else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP)
60-
systemPrint("** Bluetooth SPP broadcasting as: ");
61-
else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_BLE)
62-
systemPrint("** Bluetooth Low-Energy broadcasting as: ");
63-
systemPrint(deviceName);
64-
systemPrintln(" **");
65-
#else // COMPILE_BT
66-
systemPrintln("** Bluetooth Not Compiled **");
67-
#endif // COMPILE_BT
68-
69-
systemPrintln("Menu: Main");
70-
71-
systemPrintln("1) Configure GNSS Receiver");
72-
73-
systemPrintln("2) Configure GNSS Messages");
74-
75-
systemPrintln("3) Configure Base");
76-
77-
if (productVariant != RTK_TORCH) // Torch does not have external ports
78-
systemPrintln("4) Configure Ports");
79-
80-
if (productVariant != RTK_TORCH) // Torch does not have logging
81-
systemPrintln("5) Configure Logging");
82-
83-
#ifdef COMPILE_WIFI
84-
systemPrintln("6) Configure WiFi");
85-
#else // COMPILE_WIFI
86-
systemPrintln("6) **WiFi Not Compiled**");
87-
#endif // COMPILE_WIFI
88-
89-
#if COMPILE_NETWORK
90-
systemPrintln("7) Configure TCP/UDP");
91-
#else // COMPILE_NETWORK
92-
systemPrintln("7) **TCP/UDP Not Compiled**");
93-
#endif // COMPILE_NETWORK
94-
95-
#ifdef COMPILE_ETHERNET
96-
if (present.ethernet_ws5500 == true)
97-
systemPrintln("e) Configure Ethernet");
98-
#endif // COMPILE_ETHERNET
99-
100-
systemPrintln("f) Firmware Update");
101-
102-
systemPrintln("i) Configure Corrections Priorities");
103-
104-
#ifdef COMPILE_ETHERNET
105-
if (present.ethernet_ws5500 == true)
106-
systemPrintln("n) Configure NTP");
107-
#endif // COMPILE_ETHERNET
108-
109-
systemPrintln("p) Configure PointPerfect");
50+
while (1)
51+
{
52+
systemPrintln();
53+
char versionString[21];
54+
getFirmwareVersion(versionString, sizeof(versionString), true);
55+
systemPrintf("SparkFun RTK %s %s\r\n", platformPrefix, versionString);
11056

111-
#ifdef COMPILE_ESPNOW
112-
systemPrintln("r) Configure Radios");
113-
#else // COMPILE_ESPNOW
114-
systemPrintln("r) **ESP-Now Not Compiled**");
115-
#endif // COMPILE_ESPNOW
57+
systemPrintln("\r\n** Configure Via Ethernet Mode **\r\n");
11658

117-
systemPrintln("s) Configure System");
59+
systemPrintln("Menu: Main");
11860

119-
if (present.imu_im19 == true)
120-
systemPrintln("t) Configure Tilt Compensation");
61+
systemPrintln("r) Restart Base");
12162

122-
systemPrintln("u) Configure User Profiles");
63+
systemPrintln("x) Exit");
12364

124-
if (btPrintEcho)
125-
systemPrintln("b) Exit Bluetooth Echo mode");
65+
byte incoming = getUserInputCharacterNumber();
12666

127-
systemPrintln("+) Enter Command line mode");
67+
if (incoming == 'r')
68+
{
69+
displayConfigViaEthNotStarted(1000);
12870

129-
systemPrintln("x) Exit");
71+
ethernetWebServerStopESP32W5500();
13072

131-
byte incoming = getUserInputCharacterNumber();
73+
settings.updateGNSSSettings = false; // On the next boot, no need to update the GNSS on this profile
74+
settings.lastState = STATE_BASE_NOT_STARTED; // Record the _next_ state for POR
75+
recordSystemSettings();
13276

133-
if (incoming == 1)
134-
menuGNSS();
135-
else if (incoming == 2)
136-
gnssMenuMessages();
137-
else if (incoming == 3)
138-
menuBase();
139-
else if (incoming == 4 && productVariant != RTK_TORCH) // Torch does not have external ports
140-
menuPorts();
141-
else if (incoming == 5 && productVariant != RTK_TORCH) // Torch does not have logging
142-
menuLog();
143-
else if (incoming == 6)
144-
menuWiFi();
145-
else if (incoming == 7)
146-
menuTcpUdp();
147-
else if (incoming == 'e' && (present.ethernet_ws5500 == true))
148-
menuEthernet();
149-
else if (incoming == 'f')
150-
menuFirmware();
151-
else if (incoming == 'i')
152-
menuCorrectionsPriorities();
153-
else if (incoming == 'n' && (present.ethernet_ws5500 == true))
154-
menuNTP();
155-
else if (incoming == 'u')
156-
menuUserProfiles();
157-
else if (incoming == 'p')
158-
menuPointPerfect();
159-
#ifdef COMPILE_ESPNOW
160-
else if (incoming == 'r')
161-
menuRadio();
162-
#endif // COMPILE_ESPNOW
163-
else if (incoming == 's')
164-
menuSystem();
165-
else if (incoming == 't' && (present.imu_im19 == true))
166-
menuTilt();
167-
else if (incoming == 'b' && btPrintEcho == true)
168-
{
169-
printEndpoint = PRINT_ENDPOINT_SERIAL;
170-
systemPrintln("BT device has exited echo mode");
171-
btPrintEcho = false;
172-
break; // Exit config menu
77+
ESP.restart();
78+
}
79+
else if (incoming == 'x')
80+
break;
81+
else if (incoming == INPUT_RESPONSE_GETCHARACTERNUMBER_EMPTY)
82+
break;
83+
else if (incoming == INPUT_RESPONSE_GETCHARACTERNUMBER_TIMEOUT)
84+
break;
85+
else
86+
printUnknown(incoming);
17387
}
174-
else if (incoming == '+')
175-
menuCommands();
176-
else if (incoming == 'x')
177-
break;
178-
else if (incoming == INPUT_RESPONSE_GETCHARACTERNUMBER_EMPTY)
179-
break;
180-
else if (incoming == INPUT_RESPONSE_GETCHARACTERNUMBER_TIMEOUT)
181-
break;
182-
else
183-
printUnknown(incoming);
18488
}
18589

186-
// Reboot as base only if currently operating as a base station
187-
if (restartBase && inBaseMode() == true)
90+
else
18891
{
189-
restartBase = false;
190-
requestChangeState(STATE_BASE_NOT_STARTED); // Restart base upon exit for latest changes to take effect
92+
while (1)
93+
{
94+
systemPrintln();
95+
char versionString[21];
96+
getFirmwareVersion(versionString, sizeof(versionString), true);
97+
systemPrintf("SparkFun RTK %s %s\r\n", platformPrefix, versionString);
98+
99+
#ifdef COMPILE_BT
100+
101+
if (settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP_AND_BLE)
102+
systemPrint("** Bluetooth SPP and BLE broadcasting as: ");
103+
else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP)
104+
systemPrint("** Bluetooth SPP broadcasting as: ");
105+
else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_BLE)
106+
systemPrint("** Bluetooth Low-Energy broadcasting as: ");
107+
systemPrint(deviceName);
108+
systemPrintln(" **");
109+
#else // COMPILE_BT
110+
systemPrintln("** Bluetooth Not Compiled **");
111+
#endif // COMPILE_BT
112+
113+
systemPrintln("Menu: Main");
114+
115+
systemPrintln("1) Configure GNSS Receiver");
116+
117+
systemPrintln("2) Configure GNSS Messages");
118+
119+
systemPrintln("3) Configure Base");
120+
121+
if (productVariant != RTK_TORCH) // Torch does not have external ports
122+
systemPrintln("4) Configure Ports");
123+
124+
if (productVariant != RTK_TORCH) // Torch does not have logging
125+
systemPrintln("5) Configure Logging");
126+
127+
#ifdef COMPILE_WIFI
128+
systemPrintln("6) Configure WiFi");
129+
#else // COMPILE_WIFI
130+
systemPrintln("6) **WiFi Not Compiled**");
131+
#endif // COMPILE_WIFI
132+
133+
#if COMPILE_NETWORK
134+
systemPrintln("7) Configure TCP/UDP");
135+
#else // COMPILE_NETWORK
136+
systemPrintln("7) **TCP/UDP Not Compiled**");
137+
#endif // COMPILE_NETWORK
138+
139+
#ifdef COMPILE_ETHERNET
140+
if (present.ethernet_ws5500 == true)
141+
systemPrintln("e) Configure Ethernet");
142+
#endif // COMPILE_ETHERNET
143+
144+
systemPrintln("f) Firmware Update");
145+
146+
systemPrintln("i) Configure Corrections Priorities");
147+
148+
#ifdef COMPILE_ETHERNET
149+
if (present.ethernet_ws5500 == true)
150+
systemPrintln("n) Configure NTP");
151+
#endif // COMPILE_ETHERNET
152+
153+
systemPrintln("p) Configure PointPerfect");
154+
155+
#ifdef COMPILE_ESPNOW
156+
systemPrintln("r) Configure Radios");
157+
#else // COMPILE_ESPNOW
158+
systemPrintln("r) **ESP-Now Not Compiled**");
159+
#endif // COMPILE_ESPNOW
160+
161+
systemPrintln("s) Configure System");
162+
163+
if (present.imu_im19 == true)
164+
systemPrintln("t) Configure Tilt Compensation");
165+
166+
systemPrintln("u) Configure User Profiles");
167+
168+
if (btPrintEcho)
169+
systemPrintln("b) Exit Bluetooth Echo mode");
170+
171+
systemPrintln("+) Enter Command line mode");
172+
173+
systemPrintln("x) Exit");
174+
175+
byte incoming = getUserInputCharacterNumber();
176+
177+
if (incoming == 1)
178+
menuGNSS();
179+
else if (incoming == 2)
180+
gnssMenuMessages();
181+
else if (incoming == 3)
182+
menuBase();
183+
else if (incoming == 4 && productVariant != RTK_TORCH) // Torch does not have external ports
184+
menuPorts();
185+
else if (incoming == 5 && productVariant != RTK_TORCH) // Torch does not have logging
186+
menuLog();
187+
else if (incoming == 6)
188+
menuWiFi();
189+
else if (incoming == 7)
190+
menuTcpUdp();
191+
else if (incoming == 'e' && (present.ethernet_ws5500 == true))
192+
menuEthernet();
193+
else if (incoming == 'f')
194+
menuFirmware();
195+
else if (incoming == 'i')
196+
menuCorrectionsPriorities();
197+
else if (incoming == 'n' && (present.ethernet_ws5500 == true))
198+
menuNTP();
199+
else if (incoming == 'u')
200+
menuUserProfiles();
201+
else if (incoming == 'p')
202+
menuPointPerfect();
203+
#ifdef COMPILE_ESPNOW
204+
else if (incoming == 'r')
205+
menuRadio();
206+
#endif // COMPILE_ESPNOW
207+
else if (incoming == 's')
208+
menuSystem();
209+
else if (incoming == 't' && (present.imu_im19 == true))
210+
menuTilt();
211+
else if (incoming == 'b' && btPrintEcho == true)
212+
{
213+
printEndpoint = PRINT_ENDPOINT_SERIAL;
214+
systemPrintln("BT device has exited echo mode");
215+
btPrintEcho = false;
216+
break; // Exit config menu
217+
}
218+
else if (incoming == '+')
219+
menuCommands();
220+
else if (incoming == 'x')
221+
break;
222+
else if (incoming == INPUT_RESPONSE_GETCHARACTERNUMBER_EMPTY)
223+
break;
224+
else if (incoming == INPUT_RESPONSE_GETCHARACTERNUMBER_TIMEOUT)
225+
break;
226+
else
227+
printUnknown(incoming);
228+
}
191229
}
192230

193-
if (restartRover == true)
231+
if (!configureViaEthernet)
194232
{
195-
restartRover = false;
196-
requestChangeState(STATE_ROVER_NOT_STARTED); // Restart rover upon exit for latest changes to take effect
197-
}
198233

199-
gnssSaveConfiguration();
234+
// Reboot as base only if currently operating as a base station
235+
if (restartBase && inBaseMode() == true)
236+
{
237+
restartBase = false;
238+
requestChangeState(STATE_BASE_NOT_STARTED); // Restart base upon exit for latest changes to take effect
239+
}
240+
241+
if (restartRover == true)
242+
{
243+
restartRover = false;
244+
requestChangeState(STATE_ROVER_NOT_STARTED); // Restart rover upon exit for latest changes to take effect
245+
}
246+
247+
gnssSaveConfiguration();
248+
249+
recordSystemSettings(); // Once all menus have exited, record the new settings to LittleFS and config file
200250

201-
recordSystemSettings(); // Once all menus have exited, record the new settings to LittleFS and config file
251+
}
202252

203253
if (settings.debugGnss == true)
204254
{

Firmware/RTK_Everywhere/menuPP.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,8 +1591,8 @@ void updateLBand()
15911591
// Skip if in configure-via-ethernet mode
15921592
if (configureViaEthernet)
15931593
{
1594-
if (settings.debugCorrections == true)
1595-
systemPrintln("configureViaEthernet: skipping updateLBand");
1594+
//if (settings.debugCorrections == true)
1595+
// systemPrintln("configureViaEthernet: skipping updateLBand");
15961596
return;
15971597
}
15981598

0 commit comments

Comments
 (0)