Page 1 of 1
ECIO USB serial, string limited to 20 chars?
Posted: Sun Feb 03, 2013 11:28 pm
by wardnica
I'm trying to send a string with multiple variables to the computer using the usb serial. I make a string_out out of 4 variables, of which two are gps location, and are 8 characters long. Then I try to send 2 other strings existing out of 4 digit numbers...
Somehow the string seems limited to 20 characters, but when I make string_out = "abcdefgh" + "ABCDEFGH" + "1234" + "1234" ; the string is totally received in the computer...
so, when I compose the string out of multiple variables, the last numbers of the string are cut of, and when I just make 'one' string as above, the string is received completely...
(yes, the string_out is long enough ofcourse

)
Re: ECIO USB serial, string limited to 20 chars?
Posted: Sun Feb 03, 2013 11:38 pm
by JonnyW
Hi. Can you post a (simple) flowchart example and we can have a look?
Cheers,
Jonny
Re: ECIO USB serial, string limited to 20 chars?
Posted: Wed Feb 06, 2013 1:31 pm
by wardnica
I'm sorry for the late responce

A snapshot of the part of the program where te problem is situated:
https://www.dropbox.com/s/ar00cmiz350y2 ... %20usb.png
The string manipulation marked red is the problem, the computer receives only 20 characters of the string which is 24 characters long, the last 4 characters just disappear...
Re: ECIO USB serial, string limited to 20 chars?
Posted: Wed Feb 06, 2013 2:27 pm
by JonnyW
Hello.
There is a hard limit on a multiple concatenation - Flowcode uses a temporary string of 20 characters to perform this if more than one string is appended.
Try the code:
Code: Select all
.string_out = .substring1 + " " + .substring2 + " " + .substring3 + " "
.string_out = .string_out + .substring4
.string_out = .string_out + "/"
And see if this works OK.
There are ways to extend this 20-char limit, but they are untested and involve editing the back-end C code, so I would advise this way first.
Cheers,
Jonny
Re: ECIO USB serial, string limited to 20 chars?
Posted: Wed Feb 06, 2013 4:01 pm
by wardnica
Unfortunately the code you suggested didn't work... I guess I'll have to change the Ccode...
It's solved

I changed every "20" number of the Ccode of the existing calculation block to 35 and now it works

Thank you
Re: ECIO USB serial, string limited to 20 chars?
Posted: Wed Feb 06, 2013 9:48 pm
by JonnyW
Hi. Glad that sorted it, but you may have issues there that will cause strange behaviour...
In the internals.c file in the FCD directory of Flowcode there is a variable called FCI_TMP_STRING[20]. Change this 20 to something higher and your data will not overflow the array.
Cheers,
Jonny