atanisoft / ESP32CommandStation

An ESP32 based DCC Command Station with integrated OpenLCB (LCC) --- NOTE: this project is not under active development.
https://atanisoft.github.io/ESP32CommandStation/
GNU General Public License v3.0
90 stars 34 forks source link

Uplink should not be starting until the STA connect completes #76

Closed TrainzLuvr closed 1 year ago

TrainzLuvr commented 3 years ago
[Hub] Starting TCP/IP listener on port 12021
Listening on port 12021, fd 48
[mDNS] Failed to advertise _open☺cb-can._tcp:12021 due to: ESP_ERR_INVALID_ARG (258)
[TWAI] RX:0 (pending:0,overrun:0,discard:0) TX:17 (pending:17,suc:0,fail:0) bus (arb-err:0,err:0,state:Running)
[WiFi] Lost connection to SSID: *********** (reason:200)
[WiFi] Attempting to reconnect to SSID: *************.
[mDNS] Removing advertisement of _open☺cb-can._tcp.
[Hub] Shutting down TCP/IP listener
Shutdown listening socket 12021.
[Uplink] Disconnecting from uplink.
[WiFi] Connected to SSID: *************
[WiFi] IP address is 192.168.X.X, starting hub (if enabled) and uplink
.....
[Hub] Starting TCP/IP listener on port 12021
Listening on port 12021, fd 48
[mDNS] Advertising _open☺cb-can._tcp:12021.
E (1459751) MDNS: Cannot allocate memory (line: 1209, free heap: 2248 bytes)
E (1460051) MDNS: Cannot allocate memory (line: 1209, free heap: 2220 bytes)
E (1460351) MDNS: Cannot allocate memory (line: 1209, free heap: 2248 bytes)
E (1460651) MDNS: Cannot allocate memory (line: 1209, free heap: 2248 bytes)
E (1460951) MDNS: Cannot allocate memory (line: 1209, free heap: 2220 bytes)
[TWAI] RX:0 (pending:0,overrun:0,discard:0) TX:17 (pending:17,suc:0,fail:0) bus (arb-err:0,err:0,state:Running)
E (1463854) MDNS: Cannot allocate memory (line: 1209, free heap: 2260 bytes)
.....
[TWAI] RX:0 (pending:0,overrun:0,discard:0) TX:17 (pending:17,suc:0,fail:0) bus (arb-err:0,err:0,state:Running)
[httpd] Shutting down HTTP listener
[WiFi] Connected to SSID: *************
[WiFi] IP address is 192.168.X.X, starting hub (if enabled) and uplink
Shutdown listening socket 80.
[mDNS] Removing advertisement of _http._tcp.
[httpd] Shutting down HTTP listener
[TWAI] RX:0 (pending:0,overrun:0,discard:0) TX:17 (pending:17,suc:0,fail:0) bus (arb-err:0,err:0,state:Running)
[TWAI] RX:0 (pending:0,overrun:0,discard:0) TX:17 (pending:17,suc:0,fail:0) bus (arb-err:0,err:0,state:Running)
[TWAI] RX:0 (pending:0,overrun:0,discard:0) TX:17 (pending:17,suc:0,fail:0) bus (arb-err:0,err:0,state:Running)
[TWAI] RX:0 (pending:0,overrun:0,discard:0) TX:17 (pending:17,suc:0,fail:0) bus (arb-err:0,err:0,state:Running)
atanisoft commented 3 years ago

Another snippet from your log showing uplink starting too early:

[SoftAP] MAC Address: XX:XX:XX:XX:XX:XX
[SoftAP] Setting ESP32 hostname to "esp32cs_05010101xx00".
[httpd] Starting DNS listener
[httpd] Starting HTTP listener on port 80
[dnsd] Listening on port 53, fd 49, using 192.168.4.1 for local IP
ESP_ERROR_CHECK_WITHOUT_ABORT failed: esp_err_t 0x103 (ESP_ERR_INVALID_STATE) at 0x40087edf
0x40087edf: _esp_error_check_failed_without_abort at C:/espressif/esp-idf/components/esp_common/src/esp_err.c:40

file: "../components/OpenMRNLite/src/freertos_drivers/esp32/Esp32WiFiManager.cpp" line 1740
func: int mdns_lookup(const char*, addrinfo*, addrinfo**)
expression: mdns_query_ptr(service_name.c_str(), protocol_name.c_str(), MDNS_QUERY_TIMEOUT, MDNS_MAX_RESULTS, &results)
Listening on port 80, fd 50
Allocating new alias 0A1 for node 05010101xx00

This looks like a bit of a race condition where the SoftAP is UP but the Station connection is still in-progress. In the case of SoftAP+Station it needs to wait until both are UP before starting the uplink process.

I'm not 100% certain on the proper behavior for SoftAP only mode.