SparkFun_RTK_Firmware icon indicating copy to clipboard operation
SparkFun_RTK_Firmware copied to clipboard

Fatal error: configure via WiFi AP while running PVT server

Open DavidBerschauer opened this issue 5 months ago • 2 comments

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

  • RTK Express running version 4.0
  • No Problem running version 3.9

Steps to reproduce

  1. Enable the PVT server via serial or AP configuration
  2. Let it restart and attempt to connect to a network
  3. Prevent a connection to the configured networks (wrong password, AP shutdown, ...)
  4. Switch to config mode

Everything works fine and as expected, when the device connects to an available WiFi network.

Expected behavior

  1. The AP starts
  2. The PVT server is disabled
  3. The configuration page is served on port 80

Actual behavior

  1. The AP starts
  2. The PVT server shutsdown resulting in a fatal error: HALTED: Network user PVT Server is already idle
  3. 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()

DavidBerschauer avatar Jan 15 '24 15:01 DavidBerschauer