DME generic selector knob control

Peer support for Air Manager desktop users

Moderators: russ, Ralph

Message
Author
ramberga
Posts: 25
Joined: Sat Dec 19, 2020 10:47 pm

Re: DME generic selector knob control

#31 Post by ramberga »

Ralph -

I just recoded the generic DME receiver (the one you programmed to accept a hardware switch). You had used the 'named' reference argument in the function call. I changed it to 'hardware-id' reference:

From
hw_switch_add("Source selector", 3, function(position)

to
hw_switch_add ("ARDUINO_LEONARDO_A_D2", "ARDUINO_LEONARDO_A_D3", "ARDUINO_LEONARDO_A_D4", function (position)

and, the instrument now works in the 'home' tab now, as well as the 'create/edit' tab when running it. Why does hard coding the pin configuration make it work in the 'home' tab now???

It's like the 'home' tab couldn't reference the pin configuration correctly.


However, as soon as I stop AM and then restart it, the hardware device will not operate the instrument in the 'home' tab.

I have to re-add the instrument back to the panel. Perhaps the 2 issues are related, as it only occurs when accessing the instrument via the 'home' tab.

Any ideas on what is going on with the 'home' tab???? Hard-coding the pin configuration and re-adding the instrument so it works in the 'home' tab???

Pete

ramberga
Posts: 25
Joined: Sat Dec 19, 2020 10:47 pm

Re: DME generic selector knob control

#32 Post by ramberga »

P.S. I just left AM running, but unplugged the USB connection for the Arduino board, then plugged it in again.

Guess what? The instrument will not allow the hardware switch to operate it.

So, something is going on with the communication between the USB, the Arduino board and AM.


The instrument will not allow the hardware switch to operate it, if:

1.I stop and start AM,
2.if I put the computer to sleep and wake it, or
3.if I disconnect, then reconnect the Arduino board via the USB connection.

In all cases, if I re-add the instrument to the panel, it works properly.

It's like the assignment of pins gets lost and never gets reassigned if I unplug the Arduino board, etc.

One other thing: I notice that when I connect or disconnect the Arduino board, it never shows up as a device in Windows 'Device and Printers' section of Control Panel. It does show up under 'Device Manager' however, as Port COM9.

Pete

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

Re: DME generic selector knob control

#33 Post by Sling »

Not sure what’s happening with the hardware not working again after a restart but the other issue of working in create/edit but not in home is probably due to the fact that you haven’t configured the hardware in the home tab. Create/edit hardware settings are not carried over to the home tab because you may have multiples of the same instrument and create/edit is for development and testing single instruments or panels.

Hopefully that explains half of it.

Tony
Last edited by Sling on Thu Aug 12, 2021 6:05 am, edited 1 time in total.

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

Re: DME generic selector knob control

#34 Post by Ralph »

The easiest solution to this is for us to have a look through TeamViewer. Please send us a support ticket, and include your time zone. We are available on Thursday's and Friday's from 8:00 to 17:00 CET.

ramberga
Posts: 25
Joined: Sat Dec 19, 2020 10:47 pm

Re: DME generic selector knob control

#35 Post by ramberga »

Tony - I did make sure that all hardware pin settings were copied in the 'home' section. Please see attached screenshots of the 'create/edit' settings versus the 'home' settings for the rotary switch, using the 'named' argument option in the LUA function call for hw_switch_add. Note that this example uses the DME Receiver instrument (because Ralph had edited it to allow a hardware 3 way switch and I wanted to try his out first).
DME receiver in home tab.jpg
DME receiver in create edit tab.jpg

Also, understand that I tried changing the LUA function call 'hw_switch_add' from the named argument to the hardware_id argument. I did this both to Ralph's code for the DME Receiver as well as the generic DME Display, which I have been trying to get to work. Here's what I did:

I first tried:
hw_switch_add ("DME selector knob", 3, new_state)
and set the pin configurations as you see in the above screenshots. Setting the 'home' settings to D2, D3 and D4 for pins P0, P1 and P2.

This works fine in 'create/edit', but in 'home', the rotary switch does not operate the DME instrument. It's like the pin assignments never occur in 'home'.


Next, I tried hard-coding the pin assignments in the LUA function call, using the hardware_id argument:
hw_switch_add ("ARDUINO_LEONARDO_A_D2", "ARDUINO_LEONARDO_A_D3", "ARDUINO_LEONARDO_A_D4", new_state)

This works in both 'create/edit' as well as 'home'. So, up to this point, hard-coding the pin assignments works. The pin assignments seem to be 'seen' in the 'home' version.

However, if I stop, then restart Air Manager, or restart the computer (or most times disconnect, then reconnect Arduino board/USB connection), the 'home' version of the instrument does not work with the hardware device. I have to re-add the instrument back to the panel WHILE I AM IN AIR MANAGER. Then, it works.

Additionally, I have noticed that usually - but not every time - disconnecting the USB connection for the Arduino board causes the 'home' version to not work with the hardware device. It's weird, because last night, I couldn't get the rotary switch to work after disconnecting/reconnecting the USB connection for the Arduino board. This morning, it worked a couple of times, but now it is not working again after disconnecting/reconnecting USB. Intermittent??

It's like the pin assignment/configuration gets lost in the 'home' section when AM gets restarted or the Arduino board gets disconnected/reconnected. It seems to lose the pin assignments, but re-adding the instrument back seems to reconfigure the pins correctly.

Could it be that I am using a Leonardo board?? I am using 3 other Leonardo boards with X-Plane, because they have the chip set that emulates a joystick. Is the Leonardo board appropriate for AM?? I notice that most tutorials show using the UNO or MEGA boards.

This is so frustrating. Help????

Pete
Last edited by ramberga on Thu Aug 12, 2021 3:51 pm, edited 1 time in total.

ramberga
Posts: 25
Joined: Sat Dec 19, 2020 10:47 pm

Re: DME generic selector knob control

#36 Post by ramberga »

Ralph wrote: Thu Aug 12, 2021 4:41 am The easiest solution to this is for us to have a look through TeamViewer. Please send us a support ticket, and include your time zone. We are available on Thursday's and Friday's from 8:00 to 17:00 CET.
Ralph - I am in Wisconsin USA, Central Daylight Time zone. Can you look at the post I just replied to Tony and see what you think? And, yes, we can do a session together, too. Are you 7 hours ahead of CDT??

Pete

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

Re: DME generic selector knob control

#37 Post by Ralph »

I rather just have a look myself. Tomorrow we will be available.

ramberga
Posts: 25
Joined: Sat Dec 19, 2020 10:47 pm

Re: DME generic selector knob control

#38 Post by ramberga »

Ralph wrote: Thu Aug 12, 2021 5:55 pm I rather just have a look myself. Tomorrow we will be available.
I have to be gone tomorrow. Is there a day early next week that would work for you? Or this weekend?

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

Re: DME generic selector knob control

#39 Post by Sling »

Oh ok that’s not it then. It’s a bit difficult to see in the screen shots you posted but what are all those Searching for messages in the Home tab. If they are not for AM hardware perhaps try removing them.

ramberga
Posts: 25
Joined: Sat Dec 19, 2020 10:47 pm

Re: DME generic selector knob control

#40 Post by ramberga »

Tony- the searching being done by AM is from me unplugging and reconnecting the Arduino board during testing. AM does connect to the board when I reconnect the Leonardo after a few seconds. I get the connect message from AM.

It's like it loses the pin assignments but understand that it also happens when I stop and restart AM too.

Pete

P.S. the searching messages are only for COM 9, which is the only one using the Arduino Leonardo board
connected to AM. All the Arduino boards connected to Xplane are on COM 3,4 and 7. And I did disconnect the others in my testing.

Post Reply