I don't know if it's a bug or it's me (I think it's a bug), so I ask you for
comments about that.
I'm fooling around with an Arduino board that sends data to FGFS with a serial
protocol: fgfs
--generic=serial,in,30,/dev/ttyACM1,9600,arduino_serial_basic_input
The protocol input sections is this:
<input>
<line_separator>newline</line_separator>
<var_separator>tab</var_separator>
<chunk>
<name>temp_int</name>
<type>integer</type>
<node>/sim/arduino_integer</node>
</chunk>
<chunk>
<name>temp_string</name>
<type>string</type>
<node>/sim/arduino_string</node>
</chunk>
</input>
Arduino sends data this way command:
Serial.print("1\ta\n");
Well, when I look in FGFS Property browser I see this:
/sim/arduino_integer = '1' (int)
/sim/arduino_string = 'a\n' (string)
That's obviously wrong, there should be no \n after the "a" string!
----------------------
Strangely enough that does work right if I switch the integer and the string
input chunks, so that the string field is received first. In fact, if I use
this protocol:
<input>
<line_separator>newline</line_separator>
<var_separator>tab</var_separator>
<chunk>
<name>temp_string</name>
<type>string</type>
<node>/sim/arduino_string</node>
</chunk>
<chunk>
<name>temp_int</name>
<type>integer</type>
<node>/sim/arduino_integer</node>
</chunk>
</input>
And this Arduino output:
Serial.print("a\t1\n");
I get a correct property assignment, without any \n.
/sim/arduino_integer = '1' (int)
/sim/arduino_string = 'a' (string)
-----------------------------
What am I missing (if that's the case)?
Is it FlightGear not parsing correctly the string input? Maybe attaching to it
any \n it receives as a part of the string?
Or is it me still not understanding how Arduino sends those strings out on the
serial line?
-----------------------------
n.b.
if I don't add a \n in Serial.print() fgfs gets confused because Arduino's
Serial.print() doesn't add any \n by default.
--
GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit
gratis Handy-Flat! http://portal.gmx.net/de/go/dsl
------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel