These are chat archives for esp8266/Arduino

15th
Jun 2015
chad cormier roussel
@chadouming
Jun 15 2015 06:11
Would be awesome to make cheap wifi speaker
Jakub Sobieraj
@sobiso
Jun 15 2015 10:19
hi all i use arduino in esp8266, is there any example how tu use http server with spiff ?
Ivan Grokhotkov
@igrr
Jun 15 2015 10:23
no spiffs support for now, it was removed... hence no examples
Jakub Sobieraj
@sobiso
Jun 15 2015 10:24
oh so bady, any chance to return this ?
Ivan Grokhotkov
@igrr
Jun 15 2015 10:24
yep, once i'm done with OTA updates i'll add spiffs back
Jakub Sobieraj
@sobiso
Jun 15 2015 10:25
in this month ? ;)
Ivan Grokhotkov
@igrr
Jun 15 2015 10:30
before the beginning of August, that's all I can guarantee :)
Jakub Sobieraj
@sobiso
Jun 15 2015 10:30
lol
too late form me, im back to Sming
Kiril Zyapkov
@kzyapkov
Jun 15 2015 13:23

I'm sure there's a good reason behind this code:

    if(&Serial1 != NULL && Serial1.isTxEnabled()) {
        if(Serial1.availableForWrite() > 0) {
            if(c == '\n') {
                Serial1.write('\r');
            }
            Serial1.write(c);
            return;
        }
    }

but what is it? Why is this mangling necessary?

Me No Dev
@me-no-dev
Jun 15 2015 13:25
it should at least check for "\r" and not write it if it's there
but i vote for not having that code there at all
Kiril Zyapkov
@kzyapkov
Jun 15 2015 13:28

in uart.c from the SDK:

LOCAL void ICACHE_FLASH_ATTR
uart1_write_char(char c)
{
    if (c == '\n') {
        uart1_tx_one_char('\r');
        uart1_tx_one_char('\n');
    } else if (c == '\r') {
    } else {
        uart1_tx_one_char(c);
    }
}

but still, why is this there? what if you wanted to send binary data, that may scramble things badly!

Me No Dev
@me-no-dev
Jun 15 2015 13:28
it's in the SDK because they use it for the AT firmware
and \r\n is the way a line should be terminater in Serial communication in general
i imagine that is why it's there, but in reality it should be removed and just the char be written whatever it might be
Kiril Zyapkov
@kzyapkov
Jun 15 2015 13:29
So this mangling may safely be removed from HardwareSerial.cpp ...
Me No Dev
@me-no-dev
Jun 15 2015 13:29
yes
    if(&Serial1 != NULL && Serial1.isTxEnabled()) {
        if(Serial1.availableForWrite() > 0) {
            Serial1.write(c);
            return;
        }
    }
alon24
@alon24
Jun 15 2015 15:41
after i cloned and ant dist the arduino editor, in windows where can i now find the arduino.exe?
chad cormier roussel
@chadouming
Jun 15 2015 15:45
[Arduino git]\dist\windows\arduino-1.6.5.zip
alon24
@alon24
Jun 15 2015 15:48
actually \Arduino\build\windows\work
@chadouming i do not have that lib - i do not have dist there
and i do not have the zip
Kiril Zyapkov
@kzyapkov
Jun 15 2015 15:56
@me-no-dev about the newline char mangling, it seems the code is there because log messages from the SDK blobs (or maybe the internal rom) only use \r for line terminators, and this doesn't look good in a terminal
chad cormier roussel
@chadouming
Jun 15 2015 15:58
Well, it's the path you linked but if there is no zip, then the build failed.
Me No Dev
@me-no-dev
Jun 15 2015 15:58
great. those can go separate way
alon24
@alon24
Jun 15 2015 15:59
ork
 [launch4j] Compiling resources
 [launch4j] Linking
 [launch4j] Successfully created c:\Users\ilan\Dropbox\git\Arduino\build\windows
\work\arduino.exe
 [launch4j] Compiling resources
 [launch4j] Linking
 [launch4j] Successfully created c:\Users\ilan\Dropbox\git\Arduino\build\windows
\work\arduino_debug.exe

BUILD FAILED
c:\Users\ilan\Dropbox\git\Arduino\build\build.xml:79: The following error occurr
ed while executing this line:
c:\Users\ilan\Dropbox\git\Arduino\build\build.xml:65: The following error occurr
ed while executing this line:
c:\Users\ilan\Dropbox\git\Arduino\build\build.xml:894: Source resource does not
exist: C:\Program Files\Java\jdk1.6.0_45\release

Total time: 26 seconds
why is it looking for release in java dir?
Me No Dev
@me-no-dev
Jun 15 2015 16:01
@kzyapkov this mangle is used only for os_printf I just checked. Any other goes directly
@alon24 it's looking for jdk 1.6
alon24
@alon24
Jun 15 2015 16:02
its threre, but it does not have a release folder in it
in my jdk (i have 5 , all without release filder in it)
Me No Dev
@me-no-dev
Jun 15 2015 16:03
you hava jdk1.6.0_45?
release should be a file
alon24
@alon24
Jun 15 2015 16:03
C:\Program Files\Java\jdk1.6.0_45
no file
Me No Dev
@me-no-dev
Jun 15 2015 16:04
no clue
alon24
@alon24
Jun 15 2015 16:04
k, 1.6 does not have the release filer but others do
Me No Dev
@me-no-dev
Jun 15 2015 16:04
what's in the file?
Kiril Zyapkov
@kzyapkov
Jun 15 2015 16:07
yes, it's only used from the function installed via os_install_putc1(). makes sense now.
Ivan Grokhotkov
@igrr
Jun 15 2015 16:14
btw Arduino 1.6.5 was released a few hours ago
Kiril Zyapkov
@kzyapkov
Jun 15 2015 16:28
I've been running the esp8266 branch merged with the upstream master for weeks now, works nicely
alon24
@alon24
Jun 15 2015 16:30
did u guys update the buildmanager versin,. so that I do not need to build the ide?
(my 4meg ld file in 164 esp from board manager was not latest)
alon24
@alon24
Jun 15 2015 16:41
I notice that nudemcu - with 12e (only one that states 12e) does not have choosing the flash size -- i have 12e with 4m, not nodemcu but still 12e
Me No Dev
@me-no-dev
Jun 15 2015 16:42
you answered your question yourself basically
all 12e have 4M so far
if nodemcu has 12e then no need for size selection
you can go for generic and 4M setup
alon24
@alon24
Jun 15 2015 16:43
getting this error if i choose esp8266 with 4m:
In file included from C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\core_esp8266_eboot_command.c:24:0:
C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\eboot_command.h:14:23: warning: ISO C restricts enumerator values to range of 'int' [-Wpedantic]
     ACTION_LOAD_APP = 0xffffffff
                       ^
C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\core_esp8266_wiring_digital.c:105:16: warning: redefinition of typedef 'voidFuncPtr' [-Wpedantic]
 typedef void (*voidFuncPtr)(void);
                ^
In file included from C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\core_esp8266_wiring_digital.c:22:0:
C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\wiring_private.h:37:16: note: previous declaration of 'voidFuncPtr' was here
 typedef void (*voidFuncPtr)(void);
                ^
In file included from C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\spiffs\spiffs_cache.c:9:0:
C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\spiffs\spiffs_nucleus.h:348:6: warning: ISO C99 doesn't support unnamed structs/unions [-Wpedantic]
     };
      ^
C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\spiffs\spiffs_nucleus.h:358:6: warning: ISO C99 doesn't support unnamed structs/unions [-Wpedantic]
     };
      ^
C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\spiffs\spiffs_nucleus.h:343:3: warning: union has no named members [-Wpedantic]
   union {
   ^
C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\spiffs\spiffs_nucleus.h:360:4: warning: ISO C99 doesn't support unnamed structs/unions [-Wpedantic]
   };
    ^
In file included from C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\spiffs\spiffs_check.c:23:0:
C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\spiffs\spiffs_nucleus.h:348:6: warning: ISO C99 doesn't support unnamed structs/unions [-Wpedantic]
     };
      ^
C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\spiffs\spiffs_nucleus.h:358:6: warning: ISO C99 doesn't support unnamed structs/unions [-Wpedantic]
     };
      ^
C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\spiffs\spiffs_nucleus.h:343:3: warning: union has no named members [-Wpedantic]
   union {
   ^
C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\spiffs\spiffs_nucleus.h:360:4: warning: ISO C99 doesn't support unnamed structs/unions [-Wpedantic]
   };
    ^
In file included from C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\spiffs\spiffs_gc.c:2:0:
C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\spiffs\spiffs_nucleus.h:348:6: warning: ISO C99 doesn't support unnamed structs/unions [-Wpedantic]
     };
      ^
C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\spiffs\spiffs_nucleus.h:358:6: warning: ISO C99 doesn't support unnamed structs/unions [-Wpedantic]
     };
      ^
C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\spiffs\spiffs_nucleus.h:343:3: warning: union has no named members [-Wpedantic]
   union {
   ^
C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-816-g1f0673f\cores\esp8266\spiffs\spiffs_nucleus.h:360:4: warning:
but blink works
Ivan Grokhotkov
@igrr
Jun 15 2015 16:44

you can go for generic and 4M setup

no that won't work as esp12e needs DIO mode specified

Me No Dev
@me-no-dev
Jun 15 2015 16:44
i have 12e
no need for dio
Ivan Grokhotkov
@igrr
Jun 15 2015 16:44
there are 12ed and 12eq
:)
Me No Dev
@me-no-dev
Jun 15 2015 16:45
dafuq
Ivan Grokhotkov
@igrr
Jun 15 2015 16:45

getting this error if i choose esp8266 with 4m:

those are warnings, don't bother

alon24
@alon24
Jun 15 2015 16:45
my 12e works with this blink, its just that i get these warnings
Ivan Grokhotkov
@igrr
Jun 15 2015 16:46
okay, ignore them... i'll remove the -pedantic flag a bit later.
Me No Dev
@me-no-dev
Jun 15 2015 16:46
I have the feeling that nodemcu is using the same modules, but in dio mode to have more pins available
we can tun in either mode
Ivan Grokhotkov
@igrr
Jun 15 2015 16:49
@alon24 can you try the same blink sketch, but this time selecting "Generic" as a board and 4m for flash size?
alon24
@alon24
Jun 15 2015 16:54
@igrr thats the one that is working for me
(just with warnings)
Ivan Grokhotkov
@igrr
Jun 15 2015 16:54
k, thanks.
alon24
@alon24
Jun 15 2015 16:54
is the ssd1306 support already in, or do i need to get an external zip file?
Me No Dev
@me-no-dev
Jun 15 2015 16:55
nodemcu had a different pinmap
ssd1306 not in
sticilface
@sticilface
Jun 15 2015 18:05

I wanted to ask some experts for some help as my head is about to explode... and i'm not really sure what I'm doing. I've started to run into some memory issues, and want to move my html code from strings in heap to flash. Take this example...

const String teststring = F("<html>\
  <head>\
    <meta http-equiv='refresh' content='30'/>\
    <title>ESP8266 Demo</title>\
    <style>\
      body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }\
    </style>\
  </head>\
  <body>\
    <h1>Hello from ESP8266!</h1>\
    <p>Uptime: %02d:%02d:%02d</p>\
    <img src=\"/test.svg\" />\
  </body>\
</html>");

This compiles and i can send teststring out just fine. What i need to do is find some way to substitute variables into this string... in the form of text, numbers.. things like heap space and selections etc.. ... I've tried lots... looked at some examples but it is beyond me. if anyone could show me some working code.... it would be much appreciated..

the snsprintf that this originates from fails as F macro is a string... if i use PROGMEM it crashes.. and well i'd prefer just to keep using strings...
Me No Dev
@me-no-dev
Jun 15 2015 18:06
why using F at all?
and no need to keep the template as string also
sticilface
@sticilface
Jun 15 2015 18:07
i guess my lack of understanding will come through here...
Me No Dev
@me-no-dev
Jun 15 2015 18:08
you can just const char * test = "<html>....</html>";
sticilface
@sticilface
Jun 15 2015 18:08
i've only been using C for a few months.. all started with this IDE... so bearing that in mind...
does that keep the code out of heap then? what is the purpose of PROGMEM, F, SPTR if you can just use const?
Me No Dev
@me-no-dev
Jun 15 2015 18:09
then feed that into os_sprintf(buff, test, hours, minutes, seconds)
reason for them is Arduino AVR compatibility
so libs written for AVR can work here
sticilface
@sticilface
Jun 15 2015 18:12
ah ok
Me No Dev
@me-no-dev
Jun 15 2015 18:14
also, since you are outputing probably through the Web server
Printabe things have the printf method
so sever.client().printf(test, hours, minutes, seconds) will also work
sticilface
@sticilface
Jun 15 2015 18:15
that is correct, although i've not used any of these before either
sticilface
@sticilface
Jun 15 2015 18:26
ok so this compiles but constantly causes a reset when i load the page...
  char temp[400];

  int l=2;
  char *j = "test";
  long k = 123456789;
  char s = 'g';
  float f = 2.3;


 const char * teststring = "<html>\
  <head>\
    <meta http-equiv='refresh' content='30'/>\
    <title>ESP8266 Demo</title>\
    <style>\
      body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }\
    </style>\
  </head>\
  <body>\
    <h1>Hello from ESP8266!</h1>\
    <p>Uptime: %d %l %c %s %f</p>\
    <img src=\"/test.svg\" />\
  </body>\
</html>";

server.client().printf(teststring, l, k, s, j, f);
Me No Dev
@me-no-dev
Jun 15 2015 18:27
there is more to it just those lines :)
gimme a sec
sticilface
@sticilface
Jun 15 2015 18:31
:)
I may have another issue related to the web server. mine just stops responding 2-3min after boot. I can't track down an issue that is causing it. I've tried lots... but the ESP is fine. it is still responding to MQTT commands, posting serial output, and driving WS2812s... but just nothing via HTTP... heap is fine... around 17K and stable
Me No Dev
@me-no-dev
Jun 15 2015 18:37
server.send(200, "text/html", "");
server.client().printf(teststring, l, k, s, j, f);
that might actually send your data
no clue on the other issue
having tested web server for days
no issues at all
sticilface
@sticilface
Jun 15 2015 18:39
I'm thinking it might be a memory issue..
just trying that now..
Me No Dev
@me-no-dev
Jun 15 2015 18:40
also remove the svg file if you are not using a file system, because it will cause another request
sticilface
@sticilface
Jun 15 2015 18:48
trying the above code just causes an instant reset
handle root hit...
 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1464, room 16 
tail 8
chksum 0x7a
csum 0x7a
e��(�SQS�(RQ�)HT�)SHHHC���r�
I removed the svg ref too.
Me No Dev
@me-no-dev
Jun 15 2015 18:50
hm... something else is causing it maybe
sticilface
@sticilface
Jun 15 2015 18:58
right if i use just '''server.client().printf(teststring, j);''' and %c i get the webpage up until the data point... if i then put '''server.send(200, "text/html", "");''' before it i get a blank page but no crashes.. (i've also gone back to a previous version of the IDE as the latest one is crashing on me all the time..
is there a commit number i can revert to so i can compile the latest 'stable'... without using the boards manager?
Me No Dev
@me-no-dev
Jun 15 2015 20:13
@sticilface found your problem
%l and %f are not supported
chad cormier roussel
@chadouming
Jun 15 2015 20:16
They should output ? Tho
Me No Dev
@me-no-dev
Jun 15 2015 20:18
wdt reset
@sticilface
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
ESP8266WebServer server(80);
const char* ssid = "***********";
const char* password = "************";

const char * teststring = "<html><head><meta http-equiv='refresh' content='30'/><title>ESP8266 Demo</title><style>body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }</style></head><body><h1>Hello from ESP8266!</h1><p>Uptime: %d %d %c %s %d</p></body></html>";

void handleRoot(){
  char temp[400];
  int l=2;
  char *j = (char*)"test";
  long k = 123456789;
  char s = 'g';
  float f = 2.3;
  os_sprintf(temp, teststring, l, k, s, j, f);
  server.send(200, "text/html", temp);
}

void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  if(WiFi.waitForConnectResult() != WL_CONNECTED){
    Serial.printf("Could not connect to %s\n", ssid);
    while(1) delay(500);
  }
  Serial.printf("IP address: ");
  Serial.println(WiFi.localIP());
  server.on("/", handleRoot);
  server.begin();
}

void loop() {
  server.handleClient();
}
This message was deleted
Ivan Grokhotkov
@igrr
Jun 15 2015 21:01
cool, it reboots with %d %l %c %s %f and doesn't reboot with %d %d %c %s %d
sticilface
@sticilface
Jun 15 2015 21:02
this has been causing me an epic... i got it to work.. finally....
thank you!
sticilface
@sticilface
Jun 15 2015 21:26
@igrr can you think of any reason why the web server would stop responding to requests but everything else, including MQTT works just fine?
Ivan Grokhotkov
@igrr
Jun 15 2015 21:28
so your loop() function is called periodically, but the web server doesn't accept new connections?
how many TCP connections do you have simultaneously?
sticilface
@sticilface
Jun 15 2015 21:29
yes! loop function has no delays in it (i've tried delay(1) too)
should be 1... but its with my laptop so i don't know if its freaking it out behind the scenes. (thought that might be it crashes a lot in AP mode)
only 1 direct web connection though
Ivan Grokhotkov
@igrr
Jun 15 2015 21:30

so your loop function is

void loop() {
  server.handleClient();
  mqtt.update();
  Serial.printf("loop");
}

and it keeps running...

if you have a web server and MQTT that's two already
sticilface
@sticilface
Jun 15 2015 21:36

loop is this...

void loop( void ) {

mqttclient.loop();
server.handleClient();
timer.run();
loop_Plugin();

}

the plugin runs the ws2812... which runs super fast, as does the MQTT..., the web server does for about 2-3min and then just stops... nothing... its kind of intermittent as well! just wondering if anyone else if having an issue

Ivan Grokhotkov
@igrr
Jun 15 2015 21:38
does this happen if you leave out loop_Plugin()?
sticilface
@sticilface
Jun 15 2015 21:39
yep
I just put it out there as my main project, just suddenly developed it.. i'll assume i've been an idiot.. until it does/doesn't become an issue... I'm working on isolating it though..
Ivan Grokhotkov
@igrr
Jun 15 2015 21:45
and which version are you on?
sticilface
@sticilface
Jun 15 2015 21:56
Thats a good question... i compiled on 22 may. if i use the latest commit i get almost constant rebooting when trying to connect wifi!
sticilface
@sticilface
Jun 15 2015 22:02
the error i get in the browser is ERR_ADDRESS_UNREACHABLE if that helps
and that is using the latest commits