When switching to AP config mode while the PVT server is running and not connected to any WiFi, a fatal error occurs and a hard reset is required.
Your workbench
RTK Express running version 4.0
No Problem running version 3.9
Steps to reproduce
Enable the PVT server via serial or AP configuration
Let it restart and attempt to connect to a network
Prevent a connection to the configured networks (wrong password, AP shutdown, ...)
Switch to config mode
Everything works fine and as expected, when the device connects to an available WiFi network.
Expected behavior
The AP starts
The PVT server is disabled
The configuration page is served on port 80
Actual behavior
The AP starts
The PVT server shutsdown resulting in a fatal error: HALTED: Network user PVT Server is already idle
The configuration page is served, but changes can't be saved
Complete log with all debug messages enabled:
15:16:57.337 -> STATE_ROVER_NO_FIX --> STATE_DISPLAY_SETUP, 2024-01-15 14:16:56.324
15:16:59.901 -> STATE_DISPLAY_SETUP --> STATE_WIFI_CONFIG_NOT_STARTED, 2024-01-15 14:16:58.856
15:17:00.399 -> Web Server Stopped
15:17:00.399 -> WiFi AP Started with IP: 192.168.4.1
15:17:00.545 -> newSettings len: 3233
15:17:00.545 -> newSettings: platformPrefix,Express, ...
15:17:00.819 -> Web Server Started
15:17:00.819 -> STATE_WIFI_CONFIG_NOT_STARTED --> STATE_WIFI_CONFIG, 2024-01-15 14:16:59.793
15:17:00.852 -> Shutdown pvtServer (mode 128, state 1) (Added in PvtServer.ino:L351)
15:17:00.852 -> Stopping PVT server in state PVT_SERVER_STATE_NETWORK_STARTED (Added in PvtServer.ino:L292)
15:17:00.896 -> HALTED: Network user PVT Server is already idle
It seems to me, that the PVT server calls networkUserClose() while the network is shutdown, because no WiFi is available.
I thing it is related to this change.
This error also occurs with the PVT UDP server, because it shares the same logic and code in pvtUdpServerUpdate()
Subject of the issue
When switching to AP config mode while the PVT server is running and not connected to any WiFi, a fatal error occurs and a hard reset is required.
Your workbench
Steps to reproduce
Everything works fine and as expected, when the device connects to an available WiFi network.
Expected behavior
Actual behavior
Complete log with all debug messages enabled: 15:16:57.337 -> STATE_ROVER_NO_FIX --> STATE_DISPLAY_SETUP, 2024-01-15 14:16:56.324 15:16:59.901 -> STATE_DISPLAY_SETUP --> STATE_WIFI_CONFIG_NOT_STARTED, 2024-01-15 14:16:58.856 15:17:00.399 -> Web Server Stopped 15:17:00.399 -> WiFi AP Started with IP: 192.168.4.1 15:17:00.545 -> newSettings len: 3233 15:17:00.545 -> newSettings: platformPrefix,Express, ... 15:17:00.819 -> Web Server Started 15:17:00.819 -> STATE_WIFI_CONFIG_NOT_STARTED --> STATE_WIFI_CONFIG, 2024-01-15 14:16:59.793 15:17:00.852 -> Shutdown pvtServer (mode 128, state 1) (Added in PvtServer.ino:L351) 15:17:00.852 -> Stopping PVT server in state PVT_SERVER_STATE_NETWORK_STARTED (Added in PvtServer.ino:L292) 15:17:00.896 -> HALTED: Network user PVT Server is already idle
It seems to me, that the PVT server calls networkUserClose() while the network is shutdown, because no WiFi is available. I thing it is related to this change.
This error also occurs with the PVT UDP server, because it shares the same logic and code in pvtUdpServerUpdate()