C172 cockpit build.
Building a AP panel for my cockpit. I have board A, analog input A4 mapped to a pushbutton. I can see my Print "button-press and release" in the console when I press and release the button, but nothing happens on the AP panel
(the default S-TEC 55) in the game. I have many other controls working just fine, this one is stumping me. Any suggestions? Thanks in advance.
-- Start AP Buttons --
function ap_hdg_pressed(position)
print("The AP HDG switch got pressed ")
end
function ap_hdg_released(position)
xpl_dataref_write("sim/cockpit2/autopilot/heading_mode" , "INT",1)
print("The AP HDG switch got released ")
end
------- End AP Buttons ----
my_button = hw_button_add("ARDUINO_MEGA2560_A_A4", ap_hdg_pressed, ap_hdg_released)
S-TEC AP Works with Arduino HW?
-
- Posts: 5339
- Joined: Thu Jul 27, 2017 12:22 am
Re: S-TEC AP Works with Arduino HW?
Hi @bmooneyhan , rather try with "sim/autopilot/heading" command which works
-
- Posts: 32
- Joined: Tue Jan 08, 2019 8:28 pm
Re: S-TEC AP Works with Arduino HW?
Thank you for the reply. I'm trying to sort that out. Would this dataref "Heading" not be the actual heading as set on the bug, vs. enabling the AP to use that value in the first place? maybe I'm over-thinking it.
I was thinking like this:
1. Turn on AP.
2. Set "sim/cockpit2/autopilot/heading_mode" to INT, 1 which should be "heading sel".
3. Adjust the bug as needed.
4. When needed, set "sim/cockpit2/autopilot/heading_mode" to INT, 2 for nav, or 13 for GPS.
This would allow me 3 modes of lateral control, HDG BUG, NAV, and GPS.
Referencing this:
sim/cockpit2/autopilot/heading_mode int y enum Autopilot lateral mode. (0=roll, 1=heading sel, 2=nav, 10=TO/GA, 11=Re-entry, 12=Free, 13=GPSS, 14=heading hold, 15=turn-rate, 16=rollout, 18=track) Writeable with override only (sim/operation/override/override_autopilot)
Perhaps I have it all wrong, maybe?
Thanks
I was thinking like this:
1. Turn on AP.
2. Set "sim/cockpit2/autopilot/heading_mode" to INT, 1 which should be "heading sel".
3. Adjust the bug as needed.
4. When needed, set "sim/cockpit2/autopilot/heading_mode" to INT, 2 for nav, or 13 for GPS.
This would allow me 3 modes of lateral control, HDG BUG, NAV, and GPS.
Referencing this:
sim/cockpit2/autopilot/heading_mode int y enum Autopilot lateral mode. (0=roll, 1=heading sel, 2=nav, 10=TO/GA, 11=Re-entry, 12=Free, 13=GPSS, 14=heading hold, 15=turn-rate, 16=rollout, 18=track) Writeable with override only (sim/operation/override/override_autopilot)
Perhaps I have it all wrong, maybe?
Thanks
Re: S-TEC AP Works with Arduino HW?
You have it wrong. As Gilles @SimPassion replied, the best way is to use commands to change the autopilot mode. Many of the datarefs are useful for confirming via a display of some type that the sim has received the command and actioned it.
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Re: S-TEC AP Works with Arduino HW?
Setting autopilot modes through datarefs does not work (reliably). I have tried that route for the Flight Illusion hardware, but we gave up and had to make a firmware upgrade to make it work with commands.
-
- Posts: 32
- Joined: Tue Jan 08, 2019 8:28 pm
Re: S-TEC AP Works with Arduino HW?
I understand. Thank you everyone for the help. I'll try not to return to quickly with more questions.
Buddy
Buddy
-
- Posts: 5339
- Joined: Thu Jul 27, 2017 12:22 am
Re: S-TEC AP Works with Arduino HW?
No issue at all with questions, this is the way to go for clarifying. Good Air Manager discovery and handling !bmooneyhan wrote: ↑Tue Feb 07, 2023 1:43 pm I understand. Thank you everyone for the help. I'll try not to return to quickly with more questions.
Buddy