These are chat archives for esp8266/Arduino

4th
Mar 2016
Victor Tseng
@Palatis
Mar 04 2016 11:06
hello, how do i forget the persistent wifi config? that automatically saved by the wifi framework?
tzapu
@tzapu
Mar 04 2016 11:08
WiFi.disconnect()
should do it
Victor Tseng
@Palatis
Mar 04 2016 11:09
ohh cool
tzapu
@tzapu
Mar 04 2016 11:09
also, if you don t want persistance
i believe you can do
Victor Tseng
@Palatis
Mar 04 2016 11:09
i just hit the reboot button instead of doing WiFi.disconnect()......
tzapu
@tzapu
Mar 04 2016 11:09
WiFi.persistent(false)
before setting credentials,\connectin, etc
Victor Tseng
@Palatis
Mar 04 2016 11:10
yeah i know, i just want to do some sort of "factory reset"
tzapu
@tzapu
Mar 04 2016 11:10
you can also try
ESP.eraseSettings();
ESP.reset();
Victor Tseng
@Palatis
Mar 04 2016 11:11
does this erase eeprom?
tzapu
@tzapu
Mar 04 2016 11:11
no
Victor Tseng
@Palatis
Mar 04 2016 11:11
k, thx.
tzapu
@tzapu
Mar 04 2016 11:11
wifi calibration and settings
as far as i m aware
disconnect removed for sure ssid/pass if the above doesn t work completly
Victor Tseng
@Palatis
Mar 04 2016 11:12
how do i get the recalibrate after that?
do i call sdk functions to do it?
tzapu
@tzapu
Mar 04 2016 11:19
neah, does it by itself
newer sdk magic sauce or something
Victor Tseng
@Palatis
Mar 04 2016 11:23
disconnect shoud be enough for me.
Aaron N.
@porkyneal
Mar 04 2016 18:38
I have a sprintf question.

if i dont declare my char array as such

char example[10] = "1111111111";

I get stability issues when using sprintf and this declaration

char example[10];
This message was deleted
If I do it like the second example and use the output as a subscribe topic with the pubsubclient library, I dont receive anything
Am I using the right function or am I doing something else wrong?
Aaron N.
@porkyneal
Mar 04 2016 18:44
my full usage is:
char mqttBaseTopic[50]= "smartfactory/rti/9999999999999999999999999/";
sprintf(mqttBaseTopic,"smartfactory/rti/%d",ESP.getChipId());
Martin Ayotte
@martinayotte
Mar 04 2016 19:01
If your char array need to contains 10 char, you need an array of 11 because of the null character at the end.
For the second example, it is nicer to use String class : String str = String("smartfactory/rti/") + ESP.getChipId();
Michael Miller
@Makuna
Mar 04 2016 19:43
@martinayotte but doesn't the way you suggest now do three allocations, one for the constant, one for the convert of chipid, and yet another for the final storage?
While the original sprint has only the local mqttBaseTopic?
The only real issues I am mentioning is memory fragmentation and the temporary bump is peak memory usage.
Martin Ayotte
@martinayotte
Mar 04 2016 19:45
Ok !
I didn't though about that
Michael Miller
@Makuna
Mar 04 2016 23:37
but you can improve it a little by using sprint_P() instead of sprint(), this way the format string isn't taking up memory also.
There are some bad things about the String class, and there are FAR BETTER implementations of them out in the world, but Arduino created this thing and now its about compatibility.