Page 1 of 1

Circular buffer question help needed.

Posted: Wed Jul 12, 2017 6:27 pm
by Pactor
Hello
I'm baffled again.
If I have the below in the circular buffer and wanted just to print the 20.8 temp received how would I do it?
I've tried searching for the string that comes before and it gets located, I just thought I could get the following bytes and that would be what I was looking for but it never seem to print what I'm looking for.
Thanks for any advice

Mark


+IPD,100:<span id="ctl00_ContentMain_dlParams_ctl01_lblPValue"><b><font size="6">20.8&deg;C</font></b></span>CLOSED

Re: Circular buffer question help needed.

Posted: Thu Jul 13, 2017 5:33 pm
by Benj
Hi Mark,

Please can you post the program or a snippet of code that shows what you are doing and hopefully we can point you in the right direction.

Re: Circular buffer question help needed.

Posted: Thu Jul 13, 2017 6:58 pm
by Pactor
I had some luck I'm getting >22.8 on the display. Could do without the ">" appearing though.

I'm just wondering how to isolate the 22.8 out of the data received.
I'm very thick. I've attached my attempt

+IPD,100:<span id="ctl00_ContentMain_dlParams_ctl01_lblPValue"><b><font size="6">22.8&deg;C</font></b></span>CLOSED

I'm not sure about all the chip config options available to the micro I'm using.
I have an external xtal. Somethings happening so it must be half right.

Re: Circular buffer question help needed.

Posted: Fri Jul 14, 2017 10:08 am
by Benj
Hello,

How's this. I have created a simple state machine that looks for the "6">" and then starts filling the buffer until we reach the next "<" character.
8266-1.fcfx
(28.89 KiB) Downloaded 320 times
You may want to finish the reading after you receive the '&' character instead of the '<' but it should be easy for you to change this by switching the last compare hex value.

Re: Circular buffer question help needed.

Posted: Fri Jul 14, 2017 7:21 pm
by Pactor
Thanks very much.
You've got a very logical brain.

I only had to alter 2 small things and it worked perfectly.
Why could I not see that solution.

Thanks again.