I am wondering if it is possible to use one encoder and several buttons to have the buttons select the proper knob (on a G1000 for instance) and then have the encoder control that parameter. Then push another button to have it control something else.
Anyone know if that is possible (and easy)?
Thanks
One encoder with multiple buttons
-
- Posts: 5772
- Joined: Thu Jul 27, 2017 12:22 am
Re: One encoder with multiple buttons
Yes done with XPDR personal instrument, also implemented a full simulation platform shutdown from itarlofou wrote: ↑Mon Jan 20, 2025 7:04 pm I am wondering if it is possible to use one encoder and several buttons to have the buttons select the proper knob (on a G1000 for instance) and then have the encoder control that parameter. Then push another button to have it control something else.
Anyone know if that is possible (and easy)?
Thanks
You'll have to managed dials input visual designation on your own and backup your current state and location. This could be made in a loop including a default position without any visual designation, which would mean you're not on a dial or button selection, so no input at this time.
I've included a long press in the script, which says we enter in the dials/buttons/switches selection and indeed have to return in default state at the end, to go out selection and input.
Re: One encoder with multiple buttons
Has been asked a couple of times on the forums, so I think with some searching you will find an example.
Re: One encoder with multiple buttons
Thanks guys. I did search for this, but propbably didn't use the right word combination. I'll keep trying.
Ron
Ron
Re: One encoder with multiple buttons
I couldn't find it as well. Something like this:
Code: Select all
state = "HEADING"
hw_dial_add("Generic dial"', function(dir)
if state == "HEADING" then
if dir == 1 then
-- Something something
else
-- Something something else
end
end
if state == "COURSE" then
if dir == 1 then
-- Something something
else
-- Something something else
end
end
end)
hw_button_add("Activate heading input", function()
state = "HEADING"
end)
hw_button_add("Activate course input", function()
state = "COURSE"
end)