Board index FlightGear Support Hardware

Serial <output> protocol sends 6 times then stops dead...?

Joysticks, pedals, monitors.

Serial <output> protocol sends 6 times then stops dead...?

Postby ScottBouch » Thu Jul 06, 2017 8:44 pm

It appears FGFS is only sending serial data for about 2 or 3 seconds, and then stopping.

Watching the Arduino LED's I can see the RX LED blink 6 times (always 6 blinks at about 2Hz) during the initial 2 to 3 second period after starting FGFS, then goes off. I have played with the Hz setting, and it makes no difference to the number of flashes, or the frequency of them. It just seems to send 6 somethings, and then stops, but it does send some information, read next paragraph....

I know it's capable of sending partly sensible data during these initial 6 blinks, as by using the <offset> in the xml file, I can set the position of my indicator pointer upon loading FGFS, but it then just sits where I've left it using the <offset>.

(Using the Arduino IDE serial monitor to send the flap position, it works a treat.)

Here's my hardware protocol file, the factor of 180 is used, as it fits with the rest of my Arduino methodology for this indicator:

Code: Select all
<?xml version="1.0"?>

<PropertyList>

   <generic>

   <output>
      <binary_mode>false</binary_mode>
      <line_separator>\n</line_separator>
      <var_separator></var_separator>
      <preamble></preamble>
      <postamble></postamble>

      <chunk>
      <name>flaps</name>
      <node>/surface-positions/flap-pos-norm</node>
      <type>int</type>
      <format>%d</format>
      <factor>180</factor>
      <offset>0</offset>
      </chunk>

   </output>


   <input>
      <line_separator>\n</line_separator>
      <var_separator>,</var_separator>

      <chunk>
      <name>aileron</name>
      <type>float</type>
      <node>/controls/flight/aileron</node>
      </chunk>

      <chunk>
      <name>elevator</name>
      <type>float</type>
      <node>/controls/flight/elevator</node>
      </chunk>

   </input>

   </generic>

</PropertyList>


Input / Output command in FGRUN:
--generic=serial,out,20,/dev/ttyACM0,9600,hardware

As it's a single property I'm playing with outputting at the moment, I'm not using a var separator, just line separator (also omitting the preamble / postamble). The <input> stuff can be ignored for the benefit of this question.

For this simple test, I'm using the Cessna 172. My OS is Linux Mint 17.2.

I don't think I've made an error in the <type> and <format> of the protocol, as I'm able to set the indicator position using the offset... but I may have an error in the <name> or <node> fields perhaps?

OR there could be a different reason why it seems to work initially, then stops??

This is how I'm reading the simple data in the Arduino:

Code: Select all
 
 while(Serial.available()) {
 serial_in= Serial.readString();   // read the incoming data as string
}
 in_scaled = map(serial_in.toInt(), 0, 180, 81, 212);   // scale input for array lookup to match flap position indicator scale



The indicator I'm using right now is a Desynn type flap position indicator from a Hawker Hunter, can be seen half way down this page: http://www.scottbouch.com/aircraft-cock ... ation.html

I should also point out that the behavior of the indicator pointer is the same between starting the Arduino Serial Monitor, and starting FGFS. Upon the serial port being "claimed" by either, the pointer drops to it's de-energised / relaxed position, then after a second goes up to it's zero position awaiting commands over serial.

Cheers, Scott.
Last edited by ScottBouch on Thu Jul 06, 2017 11:04 pm, edited 1 time in total.
User avatar
ScottBouch
 
Posts: 183
Joined: Wed Jun 22, 2016 4:14 pm
Location: Midlands, UK
OS: Linux Mint

Re: Serial <output> protocol sends 6 times then stops dead..

Postby ScottBouch » Thu Jul 06, 2017 11:02 pm

EDIT:

So no idea how or why, but the RX led is now flashing in accordance with the frequency I set in the FGRUN launcher.

Sill no actual data moving the pointer, but the <offset> is capable of setting the pointer on fgfs launch.
User avatar
ScottBouch
 
Posts: 183
Joined: Wed Jun 22, 2016 4:14 pm
Location: Midlands, UK
OS: Linux Mint


Return to Hardware

Who is online

Users browsing this forum: No registered users and 3 guests