ewowi / StarBase

Try things out
GNU General Public License v3.0
6 stars 7 forks source link

Cannot add wifi credentials in the GUI. #55

Open ewowi opened 1 month ago

ewowi commented 1 month ago

Reported by Trackerr At April 21

Noticed the following: when connected to PC using win11+chrome browser: I could not add wifi credentials in the GUI. After filling the fields an pressing connect, it does not connect..

when doing the same on mobile android + chrome , the wifi works as soon as i press connect.

logs attached..

See also: https://discord.com/channels/700041398778331156/1203994211301728296/1231561485495304284

ewowi commented 1 month ago

Log no wifi:

12:49:32][ 13394][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118 [12:49:33]Connected AP clients: 1 6 [12:49:39]:heart:WS client connected client: 1 ...2 q:0 l:0 s:1 (#:1) [12:49:39]send sysInfo{board, nrOfPins, pinTypes} [12:49:42][ 23391][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118 [12:49:47]:heart:WS client connected client: 2 ...2 q:0 l:0 s:1 (#:2) [12:49:47]send sysInfo{board, nrOfPins, pinTypes} [12:49:52][ 33391][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118 [12:49:56]:heart:Not-Found HTTP call: URI: /connecttest.txt [12:49:56]captivePortal 0 1 [12:49:56]Captive portal [12:49:57]Not-Found HTTP call: URI: /connecttest.txt [12:49:57]captivePortal 0 1 [12:49:57]Captive portal [12:50:02][ 43390][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118 [12:50:02]Not-Found HTTP call: URI: /connecttest.txt [12:50:02]captivePortal 0 1 [12:50:02]Captive portal [12:50:05]Not-Found HTTP call: URI: /connecttest.txt [12:50:05]captivePortal 0 1 [12:50:05]Captive portal [12:50:12]:heart:[ 53390][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118 [12:50:13]Not-Found HTTP call: URI: /connecttest.txt [12:50:13]captivePortal 0 1 [12:50:13]Captive portal [12:50:14]Not-Found HTTP call: URI: /connecttest.txt [12:50:14]captivePortal 0 1 [12:50:14]Captive portal [12:50:19]:heart:Not-Found HTTP call: URI: /connecttest.txt [12:50:19]captivePortal 0 1 [12:50:19]Captive portal [12:50:22][ 63390][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118 [12:50:24]Not-Found HTTP call: URI: /connecttest.txt [12:50:24]captivePortal 0 1 [12:50:24]Captive portal [12:50:32]:heart:[ 73391][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118 [12:50:42]:heart:[ 83390][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118 [12:50:46]:heart:Connected AP clients: 2 6 [12:50:47]Webserver: server.on serveIndex csdata 1061168224-22599 (/)captivePortal 0 1 [12:50:47]! [12:50:47]Not-Found HTTP call: URI: /generate_204 [12:50:47]captivePortal 0 1 [12:50:47]Captive portal

ewowi commented 1 month ago

Log Wifi OK:

[12:50:51]Not-Found HTTP call: URI: /favicon.ico [12:50:51]captivePortal 0 1 [12:50:52][ 93399][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118 [12:51:02]:heart:[103399][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118 [12:51:12]:heart:[113399][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118 [12:51:21]:heart:WS event data client: 3 ...4 q:0 l:0 s:1 (#:3) [12:51:21]processJson var ssid[255] {"value":null} -> MYWIFI [12:51:21]setValue changed ssid {"value":null} -> MYWIFI [12:51:21]send ssid{value} [12:51:22][123399][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118 [12:51:31]:heart:WS event data client: 3 ...4 q:0 l:1 s:1 (#:3) [12:51:31]processJson var pw[255] -> pass [12:51:31]setValue changed pw -> pass [12:51:31]send pw{value} [12:51:31]WS event data client: 3 ...4 q:0 l:2 s:1 (#:3) [12:51:31]processJson var connect[255] null -> {} [12:51:31]Connecting to WiFi MYWIFI/ ** [12:51:31]chFun connect = null [12:51:31]send connect{} [12:51:32][133405][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118 [12:51:33]Connected 192.168.0.102 [12:51:33]WS Client disconnected client: 1 ...0 q:0 l:0 s:1 (#:2) [12:51:33]WS Client disconnected client: 2 ...0 q:0 l:0 s:1 (#:1) [12:51:33]WS Client disconnected client: 3 ...0 q:0 l:0 s:1 (#:0) [12:51:33]Access point disabled (handle). [12:51:33]server (re)started [12:51:33]mDNS started FC:B4:67:F6:4F:0C -> star-f64f0c [12:51:39]:heart:uiFun ddpInst = null [12:51:39]uiFun artInst = null

ewowi commented 1 month ago

Additional feedback from Monsoono:

it's possible the device wasn't able to handle incorrectly entered wifi credentials. If this is the case, perhaps it needs to fallback to broadcasting its own hotspot (not sure if it does this already).

Brandon502 commented 1 month ago

Hey @ewowi, still unable to connect WiFi. I deleted the StarLeds repository and reinstalled a clean version and I'm still running into the issue. The gui loads extremely slow for me as well on desktop compared to phone browser. Desktop version cannot submit wifi credentials most of the time. If it does or I used phone to submit it crashes immediately. The logs are below. Probably including a bit more than needed.

send generate{comment}, fixFirst{label}, fixLeds{label}, fixIP{label, comment}, fixPin{label}
WS event data client: 2 ...2 q:0 l:30 s:1 (#:1)
uiFun fixTbl (null)
uiFun fixtureVar (0)
send fixTbl{label, comment}, fixtureVar{label, comment, options}
❤️updateInstance json failed ip:1 e:InvalidInput
[ 78706][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118
WS event data client: 2 ...2 q:0 l:0 s:1 (#:1)
processJson var ssid  -> DNet-Guest
setValue changed ssid  -> DNet-Guest
send ssid{value}
❤️WS event data client: 2 ...2 q:0 l:0 s:1 (#:1)
processJson var pw  -> password
setValue changed pw  -> password
send pw{value}
WS event data client: 2 ...2 q:0 l:1 s:1 (#:1)
processJson var connect null -> {}
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x4008a36d  PS      : 0x00060330  A0      : 0x800e57fc  A1      : 0x3ffdbb30  
A2      : 0x00000000  A3      : 0xfffffffc  A4      : 0x000000ff  A5      : 0x0000ff00
A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x00000000  A9      : 0x3ffdbb14  
A10     : 0x3ffcb8b0  A11     : 0x3ffb9290  A12     : 0x00000064  A13     : 0x00000064
A14     : 0x3ffcbb88  A15     : 0x00000002  SAR     : 0x0000000a  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000000  LBEG    : 0x4008a36d  LEND    : 0x4008a37d  LCOUNT  : 0xffffffff

Backtrace: 0x4008a36a:0x3ffdbb30 0x400e57f9:0x3ffdbb40 0x400e5b43:0x3ffdbbc0 0x400dff09:0x3ffdbbe0 0x400efb37:0x3ffdbc50 0x400f70cb:0x3ffdbe20 0x400f72d9:0x3ffdbeb0 0x4011c35d:0x3ffdbee0 0x4011c569:0x3ffdbf40 0x40117255:0x3ffdbf60 0x40117527:0x3ffdbfc0

  #0  0x4008a36a:0x3ffdbb30 in strlen at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/machine/xtensa/strlen.S:82
  #1  0x400e57f9:0x3ffdbb40 in SysModNetwork::initConnection() at src/Sys/SysModNetwork.cpp:128 (discriminator 3)
  #2  0x400e5b43:0x3ffdbbc0 in std::_Function_handler<unsigned char (ArduinoJson::V703PB2::JsonObject, unsigned char, unsigned char), SysModNetwork::setup()::{lambda(ArduinoJson::V703PB2::JsonObject, unsigned char, unsigned char)#2}>::_M_invoke(std::_Any_data const&, ArduinoJson::V703PB2::JsonObject&&, unsigned char&&, ArduinoJson::V703PB2::JsonObject&&) at src/Sys/SysModNetwork.cpp:49
      (inlined by) _M_invoke at c:\users\brand\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:282     
  #3  0x400dff09:0x3ffdbbe0 in std::function<unsigned char (ArduinoJson::V703PB2::JsonObject, unsigned char, unsigned char)>::operator()(ArduinoJson::V703PB2::JsonObject, unsigned char, unsigned char) const at c:\users\brand\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:687
      (inlined by) SysModUI::callVarFun(ArduinoJson::V703PB2::JsonObject, unsigned char, unsigned char) at src/Sys/SysModUI.h:216
  #4  0x400efb37:0x3ffdbc50 in SysModUI::processJson(ArduinoJson::V703PB2::JsonVariant) at src/Sys/SysModUI.cpp:235
  #5  0x400f70cb:0x3ffdbe20 in SysModWeb::wsEvent(AsyncWebSocket*, AsyncWebSocketClient*, AwsEventType, void*, unsigned char*, unsigned int) at src/Sys/SysModWeb.cpp:311
  #6  0x400f72d9:0x3ffdbeb0 in std::_Function_handler<void (AsyncWebSocket*, AsyncWebSocketClient*, AwsEventType, void*, unsigned char*, unsigned int), SysModWeb::connectedChanged()::{lambda(AsyncWebSocket*, AsyncWebSocketClient*, AwsEventType, void*, unsigned char*, unsigned int)#1}>::_M_invoke(std::_Any_data const&, AsyncWebSocket*&&, AsyncWebSocketClient*&&, AwsEventType&&, void*&&, unsigned char*&&, unsigned int&&) at src/Sys/SysModWeb.cpp:208
      (inlined by) _M_invoke at c:\users\brand\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:297     
  #7  0x4011c35d:0x3ffdbee0 in std::function<void (AsyncWebSocket*, AsyncWebSocketClient*, AwsEventType, void*, unsigned char*, unsigned int)>::operator()(AsyncWebSocket*, AsyncWebSocketClient*, AwsEventType, void*, unsigned char*, unsigned int) const at c:\users\brand\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:687
      (inlined by) AsyncWebSocket::_handleEvent(AsyncWebSocketClient*, AwsEventType, void*, unsigned char*, unsigned int) at .pio/libdeps/esp32dev/ESPAsyncWebServerAircoookie/src/AsyncWebSocket.cpp:866
      (inlined by) AsyncWebSocketClient::_onData(void*, unsigned int) at .pio/libdeps/esp32dev/ESPAsyncWebServerAircoookie/src/AsyncWebSocket.cpp:686     
  #8  0x4011c569:0x3ffdbf40 in std::_Function_handler<void (void*, AsyncClient*, void*, unsigned int), AsyncWebSocketClient::AsyncWebSocketClient(AsyncWebServerRequest*, AsyncWebSocket*)::{lambda(void*, AsyncClient*, void*, unsigned int)#7}>::_M_invoke(std::_Any_data const&, void*&&, AsyncClient*&&, std::_Any_data const&, unsigned int&&) at .pio/libdeps/esp32dev/ESPAsyncWebServerAircoookie/src/AsyncWebSocket.cpp:481
      (inlined by) _M_invoke at c:\users\brand\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:297     
  #9  0x40117255:0x3ffdbf60 in std::function<void (void*, AsyncClient*, void*, unsigned int)>::operator()(void*, AsyncClient*, void*, unsigned int) const at c:\users\brand\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:687
      (inlined by) AsyncClient::_recv(tcp_pcb*, pbuf*, signed char) at .pio/libdeps/esp32dev/AsyncTCP/src/AsyncTCP.cpp:968
  #10 0x40117527:0x3ffdbfc0 in AsyncClient::_s_recv(void*, tcp_pcb*, pbuf*, signed char) at .pio/libdeps/esp32dev/AsyncTCP/src/AsyncTCP.cpp:1247
      (inlined by) _handle_async_event at .pio/libdeps/esp32dev/AsyncTCP/src/AsyncTCP.cpp:166
      (inlined by) _async_service_task at .pio/libdeps/esp32dev/AsyncTCP/src/AsyncTCP.cpp:201

ELF file SHA256: d94e17338bdabdde

Rebooting...
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:13260
load:0x40080400,len:3028
entry 0x400805e4

WARNING - possible crash: (code 4) Software reset due to panic or unhandled exception (SW error). Core#0 (code 12) SW restart; Core#1 (code 12) SW restart.

Ready.

Reading model from /model.json... (deserializeConfigFromFS)
Brandon502 commented 1 month ago

A different attempt. GUI loaded fast this time on desktop and submit button worked.

Not-Found HTTP call: URI: /canonical.html
captivePortal 0 1
Captive portal
updateInstance json failed ip:1 e:InvalidInput
[1590560][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118
Not-Found HTTP call: URI: /204
captivePortal 0 1
Captive portal
Not-Found HTTP call: URI: /canonical.html
captivePortal 0 1
Captive portal
❤️Not-Found HTTP call: URI: /canonical.html
captivePortal 0 1
Captive portal
Not-Found HTTP call: URI: /204
captivePortal 0 1
Captive portal
WS event data client: 3 ...2 q:0 l:0 s:1 (#:1)
processJson var pw  -> password
setValue changed pw  -> password
send pw{value}
Not-Found HTTP call: URI: /canonical.html
captivePortal 0 1
Captive portal
Not-Found HTTP call: URI: /204
captivePortal 0 1
Captive portal
updateInstance json failed ip:1 e:EmptyInput
[1600576][E][WiFiUdp.cpp:185] endPacket(): could not send data: 118
❤️WS event data client: 3 ...2 q:0 l:8 s:1 (#:1)
processJson var connect null -> {}
Connecting to WiFi DNet / ************************************9******

Stack smashing protect failure!

Backtrace: 0x400839ed:0x3ffdbc20 0x4008c321:0x3ffdbc40 0x40082da6:0x3ffdbc60 0x400e5b17:0x3ffdbc80 0x400e5b43:0x3ffdbd00 0x400dff09:0x3ffd002a |<-CORRUPTED

  #0  0x400839ed:0x3ffdbc20 in panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:408
  #1  0x4008c321:0x3ffdbc40 in esp_system_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/esp_system.c:137
  #2  0x40082da6:0x3ffdbc60 in __stack_chk_fail at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/stack_check.c:35
  #3  0x400e5b17:0x3ffdbc80 in SysModNetwork::initConnection() at src/Sys/SysModNetwork.cpp:141
  #4  0x400e5b43:0x3ffdbd00 in std::_Function_handler<unsigned char (ArduinoJson::V703PB2::JsonObject, unsigned char, unsigned char), SysModNetwork::setup()::{lambda(ArduinoJson::V703PB2::JsonObject, unsigned char, unsigned char)#2}>::_M_invoke(std::_Any_data const&, ArduinoJson::V703PB2::JsonObject&&, unsigned char&&, ArduinoJson::V703PB2::JsonObject&&) at src/Sys/SysModNetwork.cpp:49
      (inlined by) _M_invoke at c:\users\brand\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:282     
  #5  0x400dff09:0x3ffd002a in std::function<unsigned char (ArduinoJson::V703PB2::JsonObject, unsigned char, unsigned char)>::operator()(ArduinoJson::V703PB2::JsonObject, unsigned char, unsigned char) const at c:\users\brand\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:687
      (inlined by) SysModUI::callVarFun(ArduinoJson::V703PB2::JsonObject, unsigned char, unsigned char) at src/Sys/SysModUI.h:216

ELF file SHA256: d94e17338bdabdde

Rebooting...
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:13260
load:0x40080400,len:3028
entry 0x400805e4

WARNING - possible crash: (code 4) Software reset due to panic or unhandled exception (SW error). Core#0 (code 12) SW restart; Core#1 (code 12) SW restart.

Ready.

Reading model from /model.json... (deserializeConfigFromFS)
[   577][E][vfs_api.cpp:105] open(): /littlefs/model.json does not exist, no permits for creation
File /model.json open not successful
initVar new appmod var: ->Fixture
dev setValue value removed Fixture null
initVar new checkbox var: Fixture->on
setValue changed on null -> 1
chFun on (null ->1)
ewowi commented 1 month ago

@Brandon502 Regarding:

1 0x400e57f9:0x3ffdbb40 in SysModNetwork::initConnection() at src/Sys/SysModNetwork.cpp:128 (discriminator 3)

This is the related code:

const char * password = mdl->getValue("pw");
char passXXX [32] = "";
for (int i = 0; i < strlen(password); i++) strncat(passXXX, "*", sizeof(passXXX)-1);

So something wrong with strlen(password), I can only imagine that goes wrong if password is nullptr, but that shouldn't be the case. I am preparing a commit where password not nullptr will be checked. Will let you know when available

ewowi commented 1 month ago

Regarding: Connecting to WiFi DNet / ****9**

Looks like a password of 43 bytes while code expects no longer then 31/32 (that 9 at position 37 is a bit strange though)

The code is supposed to limit the max to 32: ui->initPassword(parentVar, "pw", "", 32, false, [](JsonObject var, unsigned8 rowNr, unsigned8 funType) { switch (funType) { //varFun

How long was the password you entered?

(In next commit I will limit the string length of said and password to 31 (1 reserved for string terminator)

Brandon502 commented 1 month ago

Yeah my main Wi-Fi password is stupid long. It's extremely old and I haven't been bothered to update all the devices on it. I thought that was the issue, the first crash report was on a guest WiFi I created with just an 8 digit password.

ewowi commented 1 month ago

Found this via Google https://github.com/arendst/Tasmota/issues/1943

So ssid max 31/32 And password max 63/64

I will change that in next commit and let you know

(just wondering how much fun it is to enter this long password via remote control up/down buttons 🤪)

Brandon502 commented 1 month ago

(just wondering how much fun it is to enter this long password via remote control up/down buttons 🤪)

It is painful when I can't use WPS lol.

I forgot about trying my phone's hotspot, that actually was able to connect. The fixture preview worked while that was connected so I'm assuming it needs internet to work? Now that I at least have that option I can play around with custom effects/fixtures.

ewowi commented 1 month ago

It needs internet the first time, so your client browser will cache the three.js library which does the preview graphics, after that it should run without internet

ewowi commented 1 month ago

@Brandon502 password max length now 63 in latest commit, so please test if that works for you

Brandon502 commented 1 month ago

@Brandon502 password max length now 63 in latest commit, so please test if that works for you

Seems like it fixed it. Thanks!

ewoudwijma commented 1 month ago

@trackerr

Regarding

when connected to PC using win11+chrome browser: I could not add wifi credentials in the GUI

I just tested with a newly flashed device on w11+chrome and it worked smoothly

Could you maybe describe each step you did (or retest with latest commit to see if it is still there)