Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 05:00
    laercionit edited #6907
  • 04:54
    laercionit opened #6907
  • 03:27
    Tech-TX synchronize #6898
  • 02:34
    devyte closed #6906
  • 01:13
    Gaus12 opened #6906
  • Dec 12 20:44
  • Dec 12 20:18
    dok-net synchronize #6804
  • Dec 12 19:55
    dok-net synchronize #6047
  • Dec 12 19:51
    dok-net synchronize #6902
  • Dec 12 19:50
    dok-net synchronize #6782
  • Dec 12 19:47
    dok-net synchronize #6857
  • Dec 12 17:56
    devyte labeled #6898
  • Dec 12 17:56
    devyte labeled #6898
  • Dec 12 17:56
    devyte milestoned #6898
  • Dec 12 17:53
    devyte synchronize #6898
  • Dec 12 17:53
    devyte closed #6894
  • Dec 12 17:52

    devyte on master

    fix for #6904: NodeMCU v1.0 boa… (compare)

  • Dec 12 17:51
    devyte closed #6904
  • Dec 12 17:51
    devyte closed #6905
  • Dec 12 17:51
    devyte edited #6905
Martin Ayotte
@martinayotte
@zenmanenergy , Yes, the IDE 1.6.8 has some problems with "forward declarations". Either you revert to 1.6.5, otherwise, you will have to place a copy of the function prototypes into a *.h and include it. (hoping this issue will be fixed in 1.6.9)
Steve Nelson
@zenmanenergy
so I can just breakup my code using tabs anymore? *sigh
so I *can't rather
Martin Ayotte
@martinayotte
I don't think it has any thing with tabs, simply that prototype need to be seen before calling the function.
Steve Nelson
@zenmanenergy
as I understand the tabs in the ide, it copies the code onto the bottom of the file which is similar to putting functions declaration after the code that calls the function, so it's out of order. oh well, I'll just change things around.
Martin Ayotte
@martinayotte
example, you have function void myfunc(int arg1) { Serial.println(arg1); }, then you need to add the prototype "void myfunc(int arg1);" at the top of the sketch
Steve Nelson
@zenmanenergy
and you can't reorder the tabs afaik. I wonder if I put the setup() and loop() functions in a right most tab, if that would do it?
The tabs are a rather silly IDE interface, but they do allow for breaking up very long .ino files.
nope, that idea didn't work. the declarations are out of order like in your example.
thanks martin, i'll try the .h solution.
Michael Miller
@Makuna
Yeah, I just use .h in the tabs, include them in them in the order you want in the INO. No problem ;-)
Martin Ayotte
@martinayotte
As I said, it has nothing with tabs. It is the fact that pre-processor doesn't extract prototypes automagically like in 1.6.5. In plain C/C++, you always have to do that manually in a *.h.
Michael Miller
@Makuna
@gonsays If you look at github/makuna/tasks you will see a library that helps you break up code and avoid using delays(); it includes sleep support abstracted from the details of the platform (well, almost, AVR and Esp8266 are so different here).
gonsays
@gonsays
thanks for the info @Makuna :)
@martinayotte I'm using GET in order to obtain the page info, now I need to find some function to delimitate the string
I'm searching for it
client.readStringUntil('\r') reads me all the lines
Martin Ayotte
@martinayotte
@gonsays , beware that some web sites could also send all lines with \n only without \r.
You could also read one character at a time, and parse it yourself.
gonsays
@gonsays
thnks for the tip @martinayotte
yup, I'm not very familiar with buffers and parsing
:S
I'm trying to learn it. Right now, it gives me all the lines of the GET Request: while(client.available()) => String line = client.readStringUntil('\r');
it prints me all the lines, but I just want to get the last 4 lines or so
Martin Ayotte
@martinayotte
As I said, try with '\n' ...
gonsays
@gonsays
I'll try it
I'm going to test it now
with '\n' it gives me the string in one line, with '\r' it gives me several lines
maybe, I'm going to use a "for" instead of the "while" to try to save each line
instead of String line = client.readStringUntil('\r') I may use something like line[i]=client.readStringUntil('\r')
Martin Ayotte
@martinayotte
if '\n' gave you one line, then it is working. don't change the while(client.available()), it will fail getting the whole page.
Or, simply parse the whole thing after you got all the lines.
gonsays
@gonsays
yes, but the lines are not displayed in any array
while(client.available()){ String line = client.readStringUntil('\n'); Serial.print(line);}
as I understood it will only save the last line
after the GET Request
if I try to Serial.println(line) it will give me the last line of the GET Request
I would like to save them
How could I parse it with the while?
I'm trying to code a for loop for it, but if you say that it will fail, maybe i'll test another option, but I'm without ideas (besides the for loop)
Martin Ayotte
@martinayotte
I don't have to be rude, but maybe you have some C/C++ learning to do. What I suggest is : declare String lines[10]; early (before starting the reads) as well as lineNo = 0; , then read one line at a time with lines[lineNo++], when the reads are finished, process lines using for(int l = lineNo - 4; l <= lineNo, l++)
gonsays
@gonsays
yup, I've just tested that solution (using a for loop), it saves me the first 10 results and than it crashes (maybe because the string is full already)
also I've changed the while loop for the for loop -> i think this is the problem
I'll work on it, thank you very much for your help @martinayotte !
Martin Ayotte
@martinayotte
BTW, where the choice a 4 lines comes from ? if it is the whole body, but you want to discard the header, simply throw away the lines until first empty line.
gonsays
@gonsays
ohhh
yes
nice tip
Martin Ayotte
@martinayotte
Good ! this will be even easier, simple need of a boolean "header_finished"
gonsays
@gonsays
thanks for the tips @martinayotte , it's an honour to have your help :) I recognize your nickname from my esp8266 google search