These are chat archives for esp8266/Arduino

18th
Nov 2015
Sven Eliasson
@comino
Nov 18 2015 00:37
Hey! Im trying to use the esp as WiFiServer and WifiClient at the same time - it doesnt work by default. Some had the same issues and found a solution?
(I use different ports ;) )
Sven Eliasson
@comino
Nov 18 2015 00:59
Sorry - Im using ESPWebServer ;)
kathir1951
@kathir1951
Nov 18 2015 13:07
HI to all .I am trying to compile native C code using extern "c" IN THE PROGRAM USING ARDUINO IDE. For main sketch using extern "C" has no prblem .but we use extern "C" in included c files I got following error
HI to all .I am trying to compile native C code using extern "c" IN THE PROGRAM USING ARDUINO IDE. For main sketch using extern "C" has no prblem .but we use extern "C" in included c files I got following error expected identifier or '{' before string constant extern "C" How tio solve this error Pl guide me
kathir1951
@kathir1951
Nov 18 2015 13:12
blob
Markus
@Links2004
Nov 18 2015 13:13
a c file is already C and the C compiler is used.
only the cpp compiler know extern "c"
so no need for a extern "c" in a c file.
kathir1951
@kathir1951
Nov 18 2015 13:16
@Links2004 Thanks then how can I include c files using native c code of ESP IN ARDUINO ide
Markus
@Links2004
Nov 18 2015 13:17
create a library and add the c files there, they will be compiled if the library is (h file) is included in the ino file.
or rename the file to cpp instead of c then extern is working
kathir1951
@kathir1951
Nov 18 2015 13:29
@Links2004 Thanks I already done creating lib but if i have to add any correction i have to recreate lib Thanks a lot
sam-fori-yana
@khaaali
Nov 18 2015 14:25
where can i find WiFiClientSecure.h ? is it in git i'm unable to find it?
Ivan Grokhotkov
@igrr
Nov 18 2015 14:35
@vnvnsairam it's in libraries/ESP8266WiFi/src/WiFiClientSecure.h
sam-fori-yana
@khaaali
Nov 18 2015 14:43

thanks while compiling OTA update over HTTPS im getting this error...
OTAHTTP:77: error: no matching function for call to 'ESP8266HTTPUpdate::update(WiFiClientSecure&, const char&, const char&)'

auto ret = ESPhttpUpdate.update(client, host, url);

Ivan Grokhotkov
@igrr
Nov 18 2015 14:47
what is the output of git rev-parse HEAD?
perhaps you have a slightly outdated version of the core?
it was added in esp8266/Arduino@a2789df
Sven Eliasson
@comino
Nov 18 2015 15:34
I reduced my problem with the client to following problem - it came down to a Ticker problem.
A statement in the docu about ticker mentioned : "It is currently not recommended to do blocking IO operations (network, serial, file) from Ticker callback functions. Instead, set a flag inside the ticker callback and check for that flag inside the loop function." Why is that so ?
I tried to do a WiFiclient.print(..) with Ticker and that fails whatever I do
Me No Dev
@me-no-dev
Nov 18 2015 16:30
network also runs through interrupts like the ticker
you can not trigger another interrupt while you are keeping this one
so you should do as said in the docs
static bool tickerInterrupted = false;
void onTicker(){
  tickerInterrupted = true;
}
void loop(){
  if(tickerInterrupted){
    tickerInterrupted = false;
    //send network packet/print to serial/read/wrte a file in SPIFFS
  }
}
Sven Eliasson
@comino
Nov 18 2015 16:35
@me-no-dev : thanks - did it like that and it works just fine ;) Im just curious why, cause it would be cleaner if its not needed
Me No Dev
@me-no-dev
Nov 18 2015 16:35
is it clear now?
Sven Eliasson
@comino
Nov 18 2015 16:35
yep
Me No Dev
@me-no-dev
Nov 18 2015 16:36
same holds for pin interrupts
Sven Eliasson
@comino
Nov 18 2015 16:37
I guess the reason that just one interrupt at the same time is possible is hidden in the SDK, right?
Me No Dev
@me-no-dev
Nov 18 2015 16:37
no :) it's how interrupts work as far as I know
Sven Eliasson
@comino
Nov 18 2015 16:37
in a cortex system I have interrupt priorities
Me No Dev
@me-no-dev
Nov 18 2015 16:37
you "interrupt" the loop, can not interrupt an interrupt
so one interrupt needs to finish
your onTicker function is called by interrupt therefore it runs in one
interrupt priorities decide which routine to be called first, not which can interrupt others as far as I know and understand
Sven Eliasson
@comino
Nov 18 2015 16:44
ok - google agrees ;) what I mean is called "nested interrupt" and only more advanced controllers (like cortex where I used it) have it
I thought its alsways like that - thanks
onkelfunny
@onkelfunny
Nov 18 2015 17:52
@igrr i have a problem with the WiFiServer library... my setup
#include <ESP8266WiFi.h>

class Web {
    public:
        Web(int port);
        void begin();

    private:
        WiFiServer *_server;
};
#include "Web.h"
#include <ESP8266WiFi.h>

Web::Web(int port) {
    WiFiServer _server(80);
}

void Web::begin() {
    _server->begin();
}
if i call the begin function in the setup i receive an exception
Exception (28):
epc1=0x40202515 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont 
sp: 3ffeb8e0 end: 3ffebac0 offset: 01a0

>>>stack>>>
3ffeba80:  3fffdc20 3ffea724 3ffebb18 4020264a  
3ffeba90:  3ffe9658 00000000 00000000 00000000  
3ffebaa0:  00000000 00000000 3ffebae4 4020185f  
3ffebab0:  00000000 00000000 3ffeaaa0 40100398  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16 
tail 0
chksum 0x42
csum 0x42
~ld
Markus
@Links2004
Nov 18 2015 17:54
Web::Web(int port) {
     _server = new WiFiServer(80);
}
that shut work you never init the _server in your code so you get a null ptr exception
onkelfunny
@onkelfunny
Nov 18 2015 18:55
works great ... thanks!!
kathir1951
@kathir1951
Nov 18 2015 20:24
@Links2004
@Links2004 Thanking you for your guide lines for using native c code of esp8266 in arduino ide. I found GPIO MACRO OF .
d-anders
@d-anders
Nov 18 2015 20:32
anyone got some info about the witty cloud board?
kathir1951
@kathir1951
Nov 18 2015 20:33
@Links2004 /gpio_output_set GPIO_OUTPUT_SET macro are not working while GPIO_INPUT working in Arduino ide how can i fix it atoi function also not working ? I created indiviual lib files for each and added in the sdk lib and include in the perform text. How can i create libray and add c files in to it can you guide me
Ivan Grokhotkov
@igrr
Nov 18 2015 20:48
I think Microsoft should be held responsible for coining the term "native code" 😆
it's fantastic how it creeps outside of .Net world into other areas
kathir1951
@kathir1951
Nov 18 2015 21:25
@igrr gpio_output_set GPIO_OUTPUT_SET macro are not working while GPIO_INPUT working in Arduino ide using extern "C" how can i fix it