sle118 / squeezelite-esp32

ESP32 Music streaming based on Squeezelite, with support for multi-room sync, AirPlay, Bluetooth, Hardware buttons, display and more
1.19k stars 108 forks source link

Bug when changing wifi data #369

Open hackintoshlover opened 10 months ago

hackintoshlover commented 10 months ago

It seems to me that there is a bug when changing wifi. I moved my hardware to another location (another wifi), I got the page 192.168.4.1 and I was able to configure the new wifi. It worked. When I came home with it, I wanted to put the old wifi back on. The page 192.168.4.1 is there, I was able to choose my wifi, the connection is made but when I reboot it still tries to connect to the previous wifi. Weird thing:

When scanning the previous wifi appears in the list even though it is not present where I am staying. The backup access point is still visible when connected to my home network and both are accessible. I was able to unblock it by doing "wifi_erase_config -la" in the console.

In the logs, the only abnormal thing I see is:

E (97215) network: network manager Unhandled Event NETWORK_WIFI_CONFIGURING_ACTIVE_STATE(WIFI_CONFIGURING_STATE) [EN_CONNECTED] E (99285) network: network manager Unhandled Event NETWORK_WIFI_CONFIGURING_ACTIVE_STATE(WIFI_CONFIGURING_STATE) [EN_GOT_IP]

I have the impression that it cannot overwrite old wifi data. Using ESP32A1S audio board. esp-web-tools-logs.txt

sle118 commented 10 months ago

FYI, I spend the little spare time I have on the next generation/refactored platform for the project so I might not have a chance to get to this in a while. In the new platform, one of the main requirements for wifi will be multi access points configuration.

hackintoshlover commented 9 months ago

I will wait for the same. Till then i will try not to move the device from one network to the other. Also eagerly waiting for line-in. Thanks.

sle118 commented 9 months ago

I will wait for the same. Till then i will try not to move the device from one network to the other. Also eagerly waiting for line-in. Thanks.

Line in is on the horizon, but will take some time given the effort needed for the refactoring. Embedded development is full of surprises and this is no exception.

I intend to bake multiple WiFi credentials from the beginning here.

hackintoshlover commented 9 months ago

That is totally fine with me. I'll be waiting eagerly. Since this project simplifies everything for me. Earlier i was using raspberry pi connected to my speaker whose memory card would go corrupt. With your project it's just simple, cheap, easy and efficient. And for me till date it has not failed and no sound lag when using multiple of these devices with LMS.

legolas136 commented 5 months ago

I have also problems after changing wifi credetials. the first change (from home wifi to mobile hotspot worked as it should. when trying to revert to home wifi, using esp32 hotspot 192.168.4.1 and so on, i got this:

please note the one bold line within the log

I (3034) wifi:wifi driver task: 3ffdfad0, prio:23, stack:6656, core=0
I (3044) wifi:wifi firmware version: 9ec65ef
I (3044) wifi:wifi certification version: v7.0
I (3044) wifi:config NVS flash: enabled
I (3044) wifi:config nano formating: disabled
I (3054) wifi:Init data frame dynamic rx buffer num: 40
I (3054) wifi:Init management frame dynamic rx buffer num: 40
I (3064) wifi:
Init management short buffer num: 32
I (3074) wifi:Init static tx buffer num: 12
I (3074) wifi:Init tx cache buffer num: 32
I (3074) wifi:Init static rx buffer size: 1600Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.

I (3094) wifi:Init static rx buffer num: 12
I (3094) wifi:Init dynamic rx buffer num: 40
To automatically execute lines at startup:
        Set NVS variable autoexec (U8) = 1 to enable, 0 to disable automatic execution.
        Set NVS variable autoexec[1~9] (string)to a command that should be executed automatically
I (3104) wifi_init: tcpip mbox: 32
I (3124) wifi_init: udp mbox: 32

I (3134) wifi_init: tcp mbox: 32
I (3134) wifi_init: tcp tx win: 8192
I (3134) wifi_init: tcp rx win: 32768

****************************
Your terminal application does not support escape sequences.
Line editing and history features are disabled.
On Windows, try using Putty instead.
****************************
I (3144) wifi_init: tcp mss: 1440
W (3154) console: Processing autoexec commands while network manager active.  Wifi related commands will be ignored.
I (3164) wifi_init: WiFi/LWIP prefer SPIRAM
I (3174) console: autoexec is set to perform auto-process
I (3184) network_wifi: Starting wifi
I (3194) console: Running command autoexec1 = squeezelite  -o i2s  -s  lms.linyo.de -b  500:2000 -C  30 -r  44100
I (3194) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
W (3204) config: Value not found for key autoexec2
I (3204) squeezelite_cmd: Calling squeezelite
squeezelite-esp32> [00:00:01.683] sb_controls_init:249 initializing audio (buttons/rotary/ir) controls (raw:0)
[00:00:01.695] sb_displayer_init:327 no display or led visualizer for LMS
W (3234) DAC core: DAC does not use i2c
I (3234) DAC external: DAC on I2C @0
W (3244) DAC external: no i2c controlset found
[00:00:01.710] output_init_i2s:359 invalid MCK gpio -1
I (3254) I2S: DMA Malloc info, datalen=blocksize=4088, dma_buf_count=12
I (3264) I2S: APLL: Req RATE: 44100, real rate: 44099.988, BITS: 32, CLKM: 1, BCK_M: 8, MCLK: 22579194.000, SCLK: 2822399.250000, diva: 1, divb: 0
[00:00:01.736] equalizer_set_samplerate:123 no equalizer with 32 bits samples
I (3284) BTDM_INIT: BT controller compile version [2c56073]
W (3284) BT_AV: BT Sink pin code is: [1234]
I (3304) wifi:mode : sta (b4:e6:2d:8d:dd:51)
I (3304) wifi:enable tsf
I (3614) network_handlers: Existing wifi config found. Attempting to connect.
I (3624) network: Starting DHCP client
I (3634) network_wifi: Wifi Connecting to LSD...
I (3664) BT_AV: Bluetooth Init complete

W (5324) network_wifi: WIFI_EVENT_STA_DISCONNECTED. From BSSID: 00:00:00:00:00:00, reason code: 201 (WIFI_REASON_NO_AP_FOUND)

W (5324) wifi:Haven't to connect to a suitable AP now!
I (5334) network_wifi: Configuring Access Point.
I (5334) network: Stopping DHCP server
I (5334) network: Starting DHCP server
I (5354) network_wifi: AP SSID: squeezelite-8ddd51
I (5354) network_wifi: AP Password: squeezelite
I (5364) wifi:mode : sta (b4:e6:2d:8d:dd:51) + softAP (b4:e6:2d:8d:dd:52)
I (5364) wifi:Total power save buffer number: 6
I (5374) wifi:Init max length of beacon: 752/752
I (5374) wifi:Init max length of beacon: 752/752
I (5964) wifi:Total power save buffer number: 6
I (5964) wifi:Total power save buffer number: 6
I (5964) wifi:Set ps type: 1

I (5964) network_wifi: Initiating wifi network scan
I (5964) dns_server: DNS Server listening on 53/udp
E (18634) network: network manager Unhandled Event NETWORK_WIFI_CONFIGURING_ACTIVE_STATE(WIFI_CONFIGURING_STATE) [EN_TIMER]
legolas136 commented 5 months ago

Workaround used: use the hotspot of the esp32 and get into recovery mode (so the system wont restart over and over) AND I think this makes the difference, that the system will keep the new wifi credentials. then connect to the desired network.

-> no error messages in console, working again :)