Forum Navigation
Please or Register to create posts and topics.

Roel's interfacing topic

I wanted to demo the great option within Air Manager to declare global variables.
One can trigger stuff on other Arduino'swith this.
So i use this for the LTS and other tests on the test panel.

I have my system test panel with Clearance Radio Panel coded with Arduino and this uses the Air Manager message port to transfer data to the Air Manager software.
On the other side i have my APU panel which is all AM coded with LUA.

So when i turn the test switch to the LTS position and push it, i want my APU fire led light up (also trigger a sound )

 

In the arduino code it is done like this

if (button_Testpb_read == LOW){
delay(250);
//Serial.println("Test Pushbutton pushed");

if (button_test4_read == LOW) {
//Serial.println("Switch pos LTS");
messagePort->SendMessage(2,(int32_t)4);
}
}

So i send a messge to AM with an ID of 2 and a payload of 4, this is the trigger for the LTS.

In the AM LUA script of the test panel this payload is picked up and a global variable is set like this

Test_Fire = si_variable_create("TEST FIRE", "INT", 0)

When the message is received it is triggered in the LUA code

if id == 2 then
if payload == 4 then
-- print("Test LTS ")
si_variable_write(Test_LTS, 1)
wait(5);
si_variable_write(Test_LTS, 0)
end
end

So this piece of code sets the global variable TEST_LTS to 1 and sets it back to 0 after 5 secs.

 

So on the Arduino of the APU with the LUA code a function is created which reads the global variable and triggers the fire test

function FIRE_TEST_callback(data1)
print("TEST FIRE: ")
print( data1)

if data1 == 1 then
hw_led_set(LED_APU_FIRE, 1)
sound_play(FireSound)
else
hw_led_set(LED_APU_FIRE, 0)
sound_stop(FireSound)
end
end

SO as long as the data1 variable is 1 (stops after 5 secs) the LED is lit and a sound is heard.
There is a bug in the current version (4.1) of AM whch causes a crash when you use a sound_loop command.
So the sound only sounds shortly with the sound_play command.
It seems to be fixed already in the beta version...

Here is a little demo of it all.

Hey Roel,  very cool to see this working!  I am always intrigued to see raw code and how it works.  (One day after I get the majority of my hardware built up I want to learn as mush as I can about coding.  At least be able to read it, understand it and play with it.)

Several years ago Peter Cos at Flight Deck Solutions had the opportunity to visit a Lear45 while up and running.  He was able to take some photos while pressing and holding the System Test rotary while in the lights position.  You may be aware of this but in the spirit of sharing information, here is the System Test Panel and the APU panel during that test:

(Note that the APU AMP display and the CDR are not part of the lights test)

The lights position on the System Test rotary test all the bulbs in all the Chromolux switches.  All the square Chromolux switches have either two or four bulbs in them.  You can actually see the four bulbs lit up in the FIRE PUSH switch above!  In aviation, it is all about redundancy.  If one bulb fails, there is a second bulb if not three of them ready to carrying the load.

For us sim guys, we are not required to take it to this level.  One bulb, or in our case, one LED per legend is fine which is what most all of us are doing.  So when you push the System Test while in the LTS position, your cockpit will light up like a Christmas tree!  See the rest of the LTS test photos:

(Notice that the Pressure Display is part of the lights test!)

Several of us had and still have the lights test working properly via the FDS SYS Interface cards using internal variables.  Probably along the same lines as what you are doing using Air Manager.  It was easy to set up but a little time consuming because there are so many lights!  I believe you will find it easy to set up as well, although time consuming.  All part of the fun!

It sure will take a lot of time configuring all led’s to get triggered by the lts test.
Indeed i still have to figure out what will light up or what happens when a certain test is triggered.

Allways cool to see the real stuff in action.

thx for the reply


Comments are closed, but trackbacks and pingbacks are open.