ReadStringUntil does not read until or String just looses it?


i have peculiar issue serial communication and/or strings. made small gadget reads rfid badge, sends logging info server esp8266 , retrieves log of previous reads displayed on 1" oled screen. board pro micro, arduino 1.6.6. works fine , dandy except reading log net. part of data seems quite random length start. all, 20% or so, , in between.

on server side have made simple arduino , send log this:
code: [select]

{08.11. 23:26 (92231460)#08.11. 23:09 (92231460)#08.11. 23:09 sininen#08.11. 23:09 valkoinen#08.11. 23:08 (92231460)#}

'{' tell response begins, timestamp + card id + '#' each log entry , '}' tell response ends.

i have serial adapter tapped between esp8266 , micro serial port listen esp8266 sending arduino. response call looks this:
code: [select]

+ipd,209:http/1.1 200 ok
date: sun, 08 nov 2015 21:26:09 gmt
server: apache/2.4.10 (unix) openssl/1.0.1e-fips mod_bwlimited/1.4
x-powered-by: php/5.4.37
transfer-encoding: chunked
content-type: text/html

1
{

+ipd,75:45
08.11. 23:26 (92231460)#08.11. 23:09 (92231460)#08.11. 23:09 sininen#

+ipd,54:30
08.11. 23:09 valkoinen#08.11. 23:08 (92231460)#}


on arduino side after making call read in response global string variable responsefromserver with:
code: [select]

serial1.find("{");
responsefromserver = serial1.readstringuntil('}');

first reading serial1 stream , omitting content until '{' found, reading in stuff variable until end character '}' found.

however, in responsefromserver string this:
code: [select]



+ipd,75:45
08.11. 23:26 (92231460)#08.11. 23:09 (92231460)#08.11. 23:09 s


what happening? why responsefromserver string truncated? said, position gets truncated quite random, times full response until '}' character.

i have tried solve issue in avail. build custom "read until '}' or timeout" method works same: reads input stream serial1 (esp8266) brief time (definitely not until timeout), exits , in result string random truncated part of server response.

i can't see problems code have posted going on rest of program anyone's guess.  problem memory seems , use of strings (uppercase s) opposed c style strings (lowercase s) regarded unwise members of forum.

how posti programming question


Arduino Forum > Using Arduino > Programming Questions > ReadStringUntil does not read until or String just looses it?


arduino

Comments