Park Brake in Air Manager & P3Dv5 with Arduino Mega

Are you building a cockpit, planning to build one or just dreaming, this is your cockpit builder meeting point

Moderators: russ, Ralph

Post Reply
Message
Author
BaronD55
Posts: 33
Joined: Tue Jul 21, 2020 3:52 am
Location: 40°S,177°E

Park Brake in Air Manager & P3Dv5 with Arduino Mega

#1 Post by BaronD55 »

I have moved to P3Dv5 from FSX.
I had my cockpit hardware working fairly well but of course all the code was written for XP11.
Now I am starting again and getting my head around events and variables.
For a couple of weeks I have been working on what I know is a fairly basic project - Parking Brake.
I have set up a motor vehicle parking brake that presses against a button when it is released.
Now I have it working except that the image of the park brake in the virtual cockpit does not reflect the changed state of the aircraft's park brake.
I know that the brake is being set and released by my "Park Brake instrument" because the notification banner in the simulator responds appropriately to my use of the brake handle.

Below is my code:

Code: Select all

parkbrake = ""

function parkbrake_callback(position)
if position then
parkbrake = "ON"
else
parkbrake = "OFF"
end
print("Parking brake position is ".. parkbrake)
end -- End Function "parkbrake_callback".

function released_callback() --Park Brake ON; handle pulled out = button released
if parkbrake ~= "ON" then
fsx_variable_write("BRAKE PARKING POSITION", "BOOL", false)
end
print("Parking brake handle is OUT so brake is ON")

end

function pressed_callback()--Park Brake OFF; handle moved in = button pressed.
if parkbrake ~= "OFF" then
fsx_variable_write("BRAKE PARKING POSITION", "BOOL", true)
end
print("Parking brake handle is IN so parkbrake is OFF.")

end

hw_button_add("ARDUINO_MEGA2560_A_D53", pressed_callback, released_callback)

fsx_variable_subscribe("BRAKE PARKING POSITION", "BOOL", parkbrake_callback)

Should I be using something other than fsx_variable_write?

User avatar
Ralph
Posts: 7867
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Park Brake in Air Manager & P3Dv5 with Arduino Mega

#2 Post by Ralph »

Do you mean that the parking brake in the simulator doesn't change or in a Air Manager panel?

BaronD55
Posts: 33
Joined: Tue Jul 21, 2020 3:52 am
Location: 40°S,177°E

Re: Park Brake in Air Manager & P3Dv5 with Arduino Mega

#3 Post by BaronD55 »

Hi Raph,
I meant to say that the parking brake in the simulator doesn't change.

However, I have discovered two things since my original post:-
1. I was looking at the wrong item in my P3D main cockpit view. The Park Brake handle is obscured by the Yoke handle so the yoke needs to be held hard right to expose that particular control to view. :)
2. I found an event that worked. Replacing the two lines in my code that read "fsx_variable_write("BRAKE PARKING POSITION", "BOOL", false)." with "fsx_event("PARKING BRAKE")" got the whole thing working correctly.

Solved.

User avatar
Ralph
Posts: 7867
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Park Brake in Air Manager & P3Dv5 with Arduino Mega

#4 Post by Ralph »

I've said it before and I'll say it again :) FSX and Prepar3D are a wreck. I came to realize that 14 years ago, Microsoft brought a simulator to the market, abandoned the development and left a trail of bugs, quirks, etc...
So now, 14 years later, they bring a simulator to the market again, which is full of bugs and quirky stuff. For me 1+1 = 2 and I suspect it'll be the same story all over again. They cash in on sales, do some patches here and there, cash in on some more sales, cash in on add-ons, then quit developing and in 2034 I'll probably be repeating myself ;)

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Park Brake in Air Manager & P3Dv5 with Arduino Mega

#5 Post by Sling »

Ralph wrote: Tue Oct 20, 2020 6:19 am I've said it before and I'll say it again :) FSX and Prepar3D are a wreck. I came to realize that 14 years ago, Microsoft brought a simulator to the market, abandoned the development and left a trail of bugs, quirks, etc...
So now, 14 years later, they bring a simulator to the market again, which is full of bugs and quirky stuff. For me 1+1 = 2 and I suspect it'll be the same story all over again. They cash in on sales, do some patches here and there, cash in on some more sales, cash in on add-ons, then quit developing and in 2034 I'll probably be repeating myself ;)
1000% agree. Seen nothing so far with this new sim to make me believe differently. I hope it becomes what we wish but no hope for anything with the MS name involved.

Mike Horsten
Posts: 79
Joined: Tue Dec 01, 2020 8:50 am

Re: Park Brake in Air Manager & P3Dv5 with Arduino Mega

#6 Post by Mike Horsten »

Yes and introducing a sim with no multi monitor support, no good interfase to external software, no outside gps support, no ... no... etc. Its really a shame.

I have been moving all my stuff back to xplane. Although the view of MSF2020 is better unfortunatly i cant combine the x-plane model with the view of MSF2020

Mike
Building a home Cessna 172SP Steam. X-plane/MFS2020
(ex Name on Airmanager forum Polarair)

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Park Brake in Air Manager & P3Dv5 with Arduino Mega

#7 Post by Sling »

I’m dreaming that XP12 will be the great Xplane of old with FS2020 visuals as default. If this happens, why anyone would use the other sims for a serious setup is beyond me.

MS fan boys aside. :D

BaronD55
Posts: 33
Joined: Tue Jul 21, 2020 3:52 am
Location: 40°S,177°E

Re: Park Brake in Air Manager & P3Dv5 with Arduino Mega

#8 Post by BaronD55 »

Hi there Mark & Ralph, I've managed to get multi-monitor views working in FS2020 using P34D as the driver.
I achieved this just today and thought, because of the way this thread went, that you two might be interested.
If you want to see it here is the link:-
https://www.facebook.com/groups/flights ... &ref=notif
Cheers

Post Reply