Page 1 of 5

DME generic selector knob control

Posted: Tue Aug 03, 2021 9:36 pm
by ramberga
The generic DME Bendix/King instrument does not have any 'hardware' option available that can be used to externally control its on/off/nav1/nav2 options. Is there a way to create a hardware option for it, so an encoder or rotary switch can be used to control its operation via an Arduino board?

Doing a 'create/edit' gives access to the logic code for the DME instrument, but I am not sure what needs to be changed in the LUA code to allow an encoder to be used to control the selector knob. Can anyone help?

Re: DME generic selector knob control

Posted: Wed Aug 04, 2021 4:15 am
by Ralph
Also got this by email, so it's a bit scattered across different channels. Are you sure that you want to use an encoder with a switch, seems a bit odd.

Re: DME generic selector knob control

Posted: Wed Aug 04, 2021 1:37 pm
by ramberga
Ralph - I have an extra encoder laying around, but can use a rotary switch too. No problem.

I am looking at the LUA API functions currently. Is there an example I could follow to change from mouse control to a hardware switch control?

Thanks.

Re: DME generic selector knob control

Posted: Wed Aug 04, 2021 2:20 pm
by Ralph
You can go with both options, but they will require different code. So it depends on what you want.

Re: DME generic selector knob control

Posted: Wed Aug 04, 2021 2:27 pm
by ramberga
Ralph - I will communicate with you via email, so I'm not cluttering up the forum.

Pete

Re: DME generic selector knob control

Posted: Wed Aug 04, 2021 3:40 pm
by Keith Baxter
ramberga wrote: Wed Aug 04, 2021 2:27 pm Ralph - I will communicate with you via email, so I'm not cluttering up the forum.

Pete
Hi Pete,

Welcome to the forum. Can I suggest not bothering Ralph with emails. He is a very busy and what you ask is quite easy to do.

Take out a few moments and brows through the tutorials Tony has done to assist new peeps to AM. You will find most answers and set you on the road to creating many amazing instruments.

https://www.forums.siminnovations.com/v ... 0fc76abfc2

Keith

Re: DME generic selector knob control

Posted: Thu Aug 05, 2021 7:17 am
by Ralph
The forum is meant for cluttering, so don't worry.

Re: DME generic selector knob control

Posted: Thu Aug 05, 2021 8:32 am
by jph
Ralph wrote: Thu Aug 05, 2021 7:17 am The forum is meant for cluttering, so don't worry.
Well said. :D - The videos by Sling are really good but please post anything you like to the forums at any time. There are always guys here to help. ;)

Re: DME generic selector knob control

Posted: Thu Aug 05, 2021 2:13 pm
by ramberga
Ralph and Keith - watched the videos. Whew! I have an Arduino Leonardo coming tomorrow and will work on getting a rotary switch to control the generic DME this weekend.

Thank you guys!

Pete

Re: DME generic selector knob control

Posted: Sat Aug 07, 2021 8:39 pm
by ramberga
Update: I edited the generic Bendix/King DME display to include a 3 way rotary switch. It works great (I had to do some trouble shooting with the callback, since 'switch_add' uses a second optional argument - 'direction' - and hw_switch_add' does not support more than one callback argument. I ended up just hard-coding 'direction = -1' in the callback function body).

However, as soon as I press 'stop' and exit from 'create/edit' and go back to 'home', the external rotary switch is not operating. It does not activate when out of running it in 'create/edit'.

As a side note, if I keep the instrument in the 'run' mode within 'create/edit', and go to 'home', then the rotary switch works. That is ok, but as soon as I added an encoder to the VOR1/ILS instrument, I can't 'run' both simultaneously, so I have to choose between the two instruments (to use an external hardware device) and 'run' only one of them. I can't use both simultaneously back 'home'.

Help!! Thanks. And yes, the DME and VOR1/ILS instruments are included in the panel I am using (C172 SP).

Pete