- Wed May 13, 2015 3:28 am
#17294
Hi Sming developers!
First of all, this project is really great!
Nevertheless, I'm trying to use it and I'm struggling with few things - I'll be really greatful for some help and/or answers
TL;DR: don't know how to make it shorter, just make yourself a coffee and try reading
1) Can we use
Spiffy to build spiffs image and flash it directly, without starting the FTP server? If yes, what is the correct address to flash spiffs image to?
2) Does anyone have a good explanaition/link/description of what ICACHE_FLASH_ATTR actually does? As far as i understand, it maps some part of RAM addresses into the flash chip space, so there is an impression, that esp8266 has more RAM for code. But why is also (nearly) everyone using "static" for all functions and variables? Is there any rationale to do that? As far as I read here, sming uses ICACHE_FLASH_ATTR for all methods and I have to specify IRAM_ATTR when I want somethig put really in RAM. Should I also put a callback for WifiStation.scan callback to RAM with that attribute? I'm asking, because I have some strange behaviour when trying to write a web network configuration GUI (just like the one you commited yesterday
, only without FTP server)
3) Can someone please write a few words about memory management? For example, a BssList list in scan callback - should I delete it or deallocate memory it has reserved for SSID strings internally? I'm asking, because I'm having a lot of "critical exceptions" when testing my software: the chip just writes about a critical exception, writes out a serios of 0x000000 registers and resets by watchdog. I don't have an axample right now, but I can post one later, if it helps.
4) WDT specification - what is the default timeout of watchdog?
5) I have a strange problem with memory when trying to format a JSON reply with scan results. The code is like:
Code: Select allvoid onAjaxGetScan(HttpRequest &request, HttpResponse &response)
{
debug_print("Got get scan request\r\n");
JsonObjectStream* stream = new JsonObjectStream();
JsonObject& json = stream->getRoot();
json["scanInProgress"] = scanInProgress;
if (scanInProgress)
{
debug_print ("scan in progress, finishing\r\n")
response.sendJsonObject(stream);
return;
}
JsonArray & arr = json.createNestedArray("networks");
for (int i = 0; i < scanResult->count(); i++)
{
BssInfo bss = scanResult->elementAt(i);
Serial.println ("JSONing for ssid %s " + bss.ssid);
JsonObject & obj = arr.createNestedObject();
obj ["authName"] = bss.getAuthorizationMethodName();
obj ["open"] = bss.isOpen();
obj ["channel"] = bss.channel;
obj ["hidden"] = bss.hidden;
obj ["rssi"] = bss.rssi;
obj ["ssid"] = bss.ssid;
}
response.sendJsonObject(stream);
}
The debug code, which writes SSIDs on serial, works as expected -- all networks are correctly displayed. But in the return JSON there's total havoc - SSIDs show random strings form memory, like parts of the HTTP response - it looks like the memory used by obj ["ssid"] = bss.ssid; is also used by someone else or freed to early. What am I doing wrong?
Thanks in advance for any help!