These are chat archives for esp8266/Arduino

3rd
Jan 2017
brutzler
@brutzler
Jan 03 2017 00:26
Just one question to RAM. Free RAM I can see with ESP.getFreeHeap() or?
But, why doesnt the value shrink after a definition of a big array...
  Serial << "free RAM: " << ESP.getFreeHeap()<< endl;
  int value[10000];
  Serial << "free RAM: " << ESP.getFreeHeap()<< endl;
Both times the same value printed.....
Stavros Korokithakis
@skorokithakis
Jan 03 2017 00:52
@chakrihacker what's the error?
@tzapu why does wifimanager not set the flag for saving the config internally? it would be much easier if we could do, after the autoconnect, if (wifiManager.configChanged()) { do stuff }
xbary
@xbary
Jan 03 2017 01:04
@brutzler The array is not used further agrees. Compiler optimizations performed and not reserve memory
Stavros Korokithakis
@skorokithakis
Jan 03 2017 01:07
hmm, i'm trying to store some data in the EEPROM with this code, but saving and then reading it back produces "magic number invalid":
struct Persistent {
    char version[4] = CONFIG_VERSION;
    char stopName[31] = "";
} persistent;


void loadState() {
    if (EEPROM.read(0) != CONFIG_VERSION[0] ||
        EEPROM.read(1) != CONFIG_VERSION[1] ||
        EEPROM.read(2) != CONFIG_VERSION[2]) {
        Serial.println("Magic number invalid, return.");
        return;
    }

    for (unsigned int t=0; t<sizeof(persistent); t++)
        *((char*)&persistent + t) = EEPROM.read(t);

    Serial.println("Loaded state.");
}


void saveState() {
    for (unsigned int t=0; t<sizeof(persistent); t++)
        EEPROM.write(t, *((char*)&persistent + t));
    EEPROM.commit();
    Serial.println("Saved state.");
}
brutzler
@brutzler
Jan 03 2017 01:09
@xbary
but when I write to the array, the value doesnt change too
Serial << "free RAM: " << ESP.getFreeHeap()<< endl;
  int advalue[500];
  for (int i = 0; i < 500; i +=1) {
         advalue [i] = analogRead(A0);
  }
  Serial << "free RAM: " << ESP.getFreeHeap()<< endl;
brutzler
@brutzler
Jan 03 2017 01:47
hmm. my fault. was not so good to define the array local. causes me several reboots on reading out of the array later in the function.
Victor Tseng
@Palatis
Jan 03 2017 01:47
@brutzler depends on where the variable is.
@brutzler ESP.getFreeHeap() returns the heap only
int foo[1000] = { 0 }; // static allocated (.bss section)
void func() {
  static int bar[1000] = { 0 }; // static allocated (.bss section)
  int baz[1000] = { 0 }; // stack (g_cont)
  int *foobar = new int[1000]; // heap (ESP.getFreeHeap())
}
malloc() realloc() are allocated on heap, too.
the maximum stack you can use is defined by CONT_STACKSIZE, default to 4kb.
Victor Tseng
@Palatis
Jan 03 2017 01:53
and your stack is statically allocated...
tzapu
@tzapu
Jan 03 2017 04:54
@skorokithakis love you too man :)
it doesn t save flag internally, but you are right, it probably should
tzapu
@tzapu
Jan 03 2017 05:00
also, for params, you can send complete custom html when you set a param and make it look/act however you want to
i ve been out of touch for a while now, is development on the arduino core for the sdk pretty much stopped nowadays ?
tzapu
@tzapu
Jan 03 2017 05:45
@Palatis if fragmentation is a problem, you could just restart after a successful config (and use an on demand version), then on next boot, wifimanager never gets allocated.
but, this lib is really intended to get you running quickly, simply, but any project as complicated as yours is most likely better off with a custom implementation anyway
Victor Tseng
@Palatis
Jan 03 2017 05:46
i left the WebServer on because there're other applications for it
tzapu
@tzapu
Jan 03 2017 05:46
also, just read about updates to the projects, looking forward to merges and sdk 2.0, thanks everyone
@Palatis yeah, makes more sense to have a your own version then, since you already have a webserver running
it can still work with wifimanager, especially with a restart, but i don t see what gain you could get really
elite59
@elite59
Jan 03 2017 15:45
hi i need help
now i use arduino ide 1.6.10 on 32bit xp
now set all parameter on ide and download esp8266
i use esp8266 d1&mini but not compile
error is #include <bits/c++config.h>
elite59
@elite59
Jan 03 2017 15:51

Arduino: 1.6.13 (Windows XP), Board: "WeMos D1 R2 & mini, 80 MHz, 921600, 4M (3M SPIFFS)"

Build options changed, rebuilding all
In file included from C:\Documents and Settings\ijadi\Desktop\New Folder (4)\arduino-1.6.13\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/ESP8266WiFiGeneric.h:27:0,

             from C:\Documents and Settings\ijadi\Desktop\New Folder (4)\arduino-1.6.13\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.h:28,

             from C:\Documents and Settings\ijadi\Desktop\New Folder (4)\arduino-1.6.13\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/ESP8266WiFi.h:34,

             from C:\Documents and Settings\ijadi\Desktop\New Folder (4)\arduino-1.6.13\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\examples\WiFiWebServer\WiFiWebServer.ino:10:

c:\documents and settings\ijadi\desktop\new folder (4)\arduino-1.6.13\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2\functional:48:28: fatal error: bits/c++config.h: No such file or directory

include <bits/c++config.h>

                        ^

compilation terminated.

exit status 1
Error compiling for board WeMos D1 R2 & mini.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

plz help me
brutzler
@brutzler
Jan 03 2017 16:23
Then activate this option. ( more information during compilation....)
brutzler
@brutzler
Jan 03 2017 16:51
or perhaps look here: esp8266/Arduino#1631
http://www.esp8266.com/viewtopic.php?f=26&t=8268
Mehrdad K
@mkeyno
Jan 03 2017 20:10
hi guys , my module contently disconnected ad try to reconnect again , does anyone can decipher following debug repot
bcn_timout,ap_probe_send_start
ap_probe_send over, rest wifi status to disassoc
state: 5 -> 0 (1)
rm 0
pm close 7
WS [2] Disconnected!
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 2
cnt 
state: 5 -> 2 (fc0)
rm 0
reconnect
state: 2 -> 0 (0)
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 2
cnt 

connected with keyno, channel 1
dhcp client start...
ip:192.168.1.150,mask:255.255.255.0,gw:192.168.1.1
pm open,type:2 0