Read from driver 1 lines twice not same as 2 lines
Posted: Tue Apr 02, 2019 2:54 am
Hi,
I am trying to optimize my read commands from a 3D printer USB serial device. I must not understand how the read from driver works. I open the driver like this:
open driver line 1 of field "Printer Path" for text update
I can then read and write to the device. However, I want to read the input from the device one line at a time, but reading that way, it drops data compared to reading all the lines at once.
I send a line to the device with a command, then wait for a response. The response may be one line or several lines, but it always ends with a line that has "ok" in it.
I read from it like this:
read from driver line 1 of field "Printer Path" for 1 lines in 1 seconds
This always works if there is only one line (and it has "ok" in it).
read from driver line 1 of field "Printer Path" for 2 lines in 1 seconds
Works with 1 or 2 lines with the last line having the "ok"
However, doing this:
read from driver line 1 of field "Printer Path" for 1 lines in 1 seconds
put it into someWhere.
read from driver line 1 of field "Printer Path" for 1 lines in 1 seconds
put it into someWhereElse.
Will not get the second line with the "ok" in it. I have tried everything I know of to figure out why the two ways do not read the 2 lines of input the same. It is like if there are two lines waiting in the interface, and I read one of then, it throws the second line away.
I am trying to optimize my read commands from a 3D printer USB serial device. I must not understand how the read from driver works. I open the driver like this:
open driver line 1 of field "Printer Path" for text update
I can then read and write to the device. However, I want to read the input from the device one line at a time, but reading that way, it drops data compared to reading all the lines at once.
I send a line to the device with a command, then wait for a response. The response may be one line or several lines, but it always ends with a line that has "ok" in it.
I read from it like this:
read from driver line 1 of field "Printer Path" for 1 lines in 1 seconds
This always works if there is only one line (and it has "ok" in it).
read from driver line 1 of field "Printer Path" for 2 lines in 1 seconds
Works with 1 or 2 lines with the last line having the "ok"
However, doing this:
read from driver line 1 of field "Printer Path" for 1 lines in 1 seconds
put it into someWhere.
read from driver line 1 of field "Printer Path" for 1 lines in 1 seconds
put it into someWhereElse.
Will not get the second line with the "ok" in it. I have tried everything I know of to figure out why the two ways do not read the 2 lines of input the same. It is like if there are two lines waiting in the interface, and I read one of then, it throws the second line away.