Open cmarrin opened 4 years ago
Do a full erase and update your esp lib
Also try staging, I had alot of crashes in 2.6.x
It looks like it is getting way past your callback, I mean there is not much going on in there..
Do you have serial logs? Do you have any special settings for cp ?
wifi_softap_start
pvPortMalloc
<-- is that your debug mem print?
Might be an environment thing, I use pio standalone and it works,
Although it wont compile with that capture for some reason.
/Users/shawn/projects/microcontrollers/dev/libraries/WiFiManager/examples/Tests/AnonymousCB.ino:9:29: error: invalid use of 'this' in non-member function wifiManager.setAPCallback([this](WiFiManager* wifiManager) {
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
bool _enteredConfigMode = false;
void setup(){
Serial.begin(115200);
WiFiManager wifiManager;
wifiManager.setAPCallback([](WiFiManager* wifiManager) {
Serial.printf("Entered config mode:ip=%s, ssid='%s'\n",
WiFi.softAPIP().toString().c_str(),
wifiManager->getConfigPortalSSID().c_str());
_enteredConfigMode = true;
});
wifiManager.resetSettings();
if (!wifiManager.autoConnect()) {
Serial.printf("*** Failed to connect and hit timeout\n");
ESP.reset();
delay(1000);
}
}
void loop(){}
*WM: [1] resetSettings
*WM: [3] WiFi station enable
*WM: [3] enableSTA PERSISTENT ON
*WM: [1] SETTINGS ERASED
*WM: [1] AutoConnect
*WM: [1] No Credentials are Saved, skipping connect
*WM: [2] Starting Config Portal
*WM: [3] WiFi station enable
*WM: [2] Disabling STA
*WM: [2] Enabling AP
*WM: [1] StartAP with SSID: ESP_3C188C
*WM: [2] AP has anonymous access!
*WM: [1] SoftAP Configuration
*WM: [1] --------------------
*WM: [1] ssid: ESP_3C188C
*WM: [1] password:
*WM: [1] ssid_len: 10
*WM: [1] channel: 1
*WM: [1] authmode:
*WM: [1] ssid_hidden:
*WM: [1] max_connection: 4
*WM: [1] country: CN
*WM: [1] beacon_interval: 100(ms)
*WM: [1] --------------------
*WM: [1] AP IP address: 192.168.4.1
Entered config mode:ip=192.168.4.1, ssid='ESP_3C188C'
*WM: [3] setupConfigPortal
*WM: [1] Starting Web Portal
*WM: [3] dns server started with ip: 192.168.4.1
*WM: [2] HTTP server started
*WM: [2] WiFi Scan completed in 2184 ms
*WM: [2] Config Portal Running, blocking, waiting for clients...
My setup is pretty "custom" right now. I'm using the development version of WiFiManager. I'm also using a 5.2 version of the toolchain so I can compile c++14 and I'm compiling debug with gdb_init in place. With that I've added some extra log messages to WiFiManager and the Arduino WiFi libraries. Here's the log output:
00 excvaddr:0x00000000 depc:0x00000000'
*WM: [1] <form action='/wifi' method='get'><button>Configure WiFi</button></form><br/>
<form action='/info' method='get'><button>Info</button></form><br/>
<form action='/exit' method='get'><button>Exit</button></form><br/>
Free heap: 37304
*WM: [1] AutoConnect
*WM: [1] No Credentials are Saved, skipping connect
*WM: [2] Starting Config Portal
*WM: [3] WIFI station disconnect
*WM: [3] WiFi station enable
del if0
usl
mode : null
*WM: [2] Disabling STA
*WM: [2] Enabling AP
*WM: [1] StartAP with SSID: ESP_AD5703
****************************** enableAP:enter
****************************** enableAP:1
****************************** enableAP:2
****************************** mode:1
****************************** mode:1=5
****************************** mode:6
****************************** mode:7
****************************** mode:8
****************************** mode:12
****************************** mode:14
modewifi evt: 8
: softAP(86:0d:8e:ad:57:03)
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
$T0b#e6
I added the "mode:14" message to ESP8266WiFiGenericClass::mode() just before the call to wifi_set_opmode_current(). I also have "-DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI" turned on which I think is what is showing some of these diagnostics.
The final "$T0b#e6z" is the system trying to connect with GDB after the crash. I've turned that off and that's where I got the crashdump stack trace from the original message.
I've also tried turning everything off, using the stock toolchain and just building the auto connect example in a new project and it still happens. So if definitely seems like some sort of build environment issue.
Do a full erase and update your esp lib
Also try staging, I had alot of crashes in 2.6.x
Sorry, but my PlatformIO knowledge is not great.
Is adding:
platform_packages =
framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git
to platformio.ini what you mean by trying staging?
When I do that with my simple test app, it first updates a bunch stuff, then builds and uploads and fails in the same way
@tablatronix when you say " I use pio standalone and it works," do you mean you build and upload from the command line? I tried:
platformio run -t upload
and the same thing happens
Well I mean my platformio IDE is not vscode, but its still pio..
staging is github master.
platform = https://github.com/platformio/platform-espressif8266.git#feature/stage
Are you using esp IDF arduino toolchain ? I use straight arduino..
@tablatronix When I try the platform URL you sent, I get:
Error: VCS: Could not process command ['git', 'clone', '--recursive', '--depth', '1', '--branch', 'feature/stage', 'https://github.com/platformio/platform-espressif8266.git', '/Users/cmarrin/.platformio/platforms/_tmp_installing-0iQvME-package']
I don't see any feature branch in that repo. Just master, develop and a release branch
Should have given the simpler part of the error message:
warning: Could not find remote branch feature/stage to clone.
fatal: Remote branch feature/stage not found in upstream origin
Thats in my platormio.ini env Not sure how vscode env works, or how you pull in github repos.
What happens if you use a callback function and not a lambda ?
My example right now doesn't set the callback at all. The AutoConnect sample doesn't do it so I assumed it was an ok thing to do.
I was think it could be crashing in malloc because the ssid length was not set so it way trying to allocate an enormous buffer. But I've tried not giving it an SSID and just letting it pick one on its own and the same thing happens.
One thing for sure. I was thinking the code I had around all this was somehow corrupting memory. But since it happens in the most basic example, that's not the case.
One other tidbit. I have another project I'm building in the Arduino IDE. It is using the same development version of WiFiManager and it's working fine. This for sure has to do specifically with starting the AP mode. When I was first testing this project after adding WiFiManager support everything was working fine. That was because I replaced some older code that hardcoded the SSID, so WiFiManager was just picking up those setting and turning on STA mode. When I did resetSettings to test the config portal I started having this problem
Always erase flash for problems with crashes, it gets corrupt when changing versions after updates etc.
So the callback above is not related? You removed it?
I'm running the development build of WiFiManager, mostly so I can use function pointers for the setAPCallback() method. I'm using this same version in another project that is build in the Arduino IDE. But I'm building this project in VSCode using PlatformIO, still with the Arduino SDK.
I have a dead simple case of:
This is in setup(). I'm running this on a Wemos D1 Mini.
I decorated the coredump and it showed me:
So it looks like its getting a memory corruption or something. I print out the heap just before calling this code and it's at 38KB, so I don't think I'm running out of memory.
One more detail is that I'm building with C++14, so I fear I may be getting some core libraries from the wrong place or something.
Has anyone seen any issues like this?