Air Player - how to add hardware?

Support for Air Player desktop.

Moderators: Ralph, russ

Message
Author
uptimist
Posts: 44
Joined: Mon Oct 19, 2020 3:57 pm

Air Player - how to add hardware?

#1 Post by uptimist » Mon Oct 19, 2020 4:02 pm

I have an Arduino setup to drive input, which is working fine on Air Manager when connected to that PC.
When I clone the panel and run on Air Player on a separate PC with the Arduino connected to the AP PC, I am getting no input from the Arduino.

Do I need to do something to "add" the Arduino in AP? In Air Manager, when the Arduino is connected to that PC I see it listed in the Devices tab, but there is nothing equivalent for Air Player (there's no interface to view)

Thanks for any suggestions, perhaps I have not understood how to set this up.
Last edited by uptimist on Tue Oct 20, 2020 10:54 am, edited 1 time in total.

uptimist
Posts: 44
Joined: Mon Oct 19, 2020 3:57 pm

Re: Air Player - how to add hardware?

#2 Post by uptimist » Mon Oct 19, 2020 4:12 pm

One more thing to add to this, I ran the instrument from the Create/Edit panel in AM, and selected to Run on the AP PC. When I do this it generates a console error from the hw_dial_add function call: "Illegal Argument List". I am guessing that means it is not recognizing the Arduino on that PC. So I'm back to the same question - is there something I need to do to add the hardware on the PC running AP, so it recognizes the Arduino?
Thanks
Last edited by uptimist on Tue Oct 20, 2020 10:54 am, edited 1 time in total.

uptimist
Posts: 44
Joined: Mon Oct 19, 2020 3:57 pm

Re: Air Player - how to add hardware?

#3 Post by uptimist » Tue Oct 20, 2020 9:32 am

I am still struggling with this, would really appreciate any help!

I checked the drivers on the the AP PC for the Arduino. It was using the Arduino drivers which came when I installed Mobiflight previously. So I manually updated the drivers to the default usbser driver in Windows, dated 2006. However In the device “Events” tab in device manager the last message is “Driver installed” there is no “Device Installed” message like I see on the good PC. So I must still be missing something, I don’t know what.

Edited to add: I also ran the demo version of Air Manager on the Player PC, and under the devices it does the Arduino connected OK. So I'm quite puzzled.

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

Re: Air Player - how to add hardware?

#4 Post by Ralph » Wed Oct 21, 2020 8:28 am

You can run an instrument from the Create/Edit tab in Air Player, that way you can receive prints and such, so you'll get some more information.
Air Player is running on a different PC I guess? You're sure you don't have anything else running on that Air Player machine that could be claiming the Arduino com port, like Arduino Studio or Simvim.

uptimist
Posts: 44
Joined: Mon Oct 19, 2020 3:57 pm

Re: Air Player - how to add hardware?

#5 Post by uptimist » Wed Oct 21, 2020 9:28 am

Yes, I ran an instrument from Create/Edit tab, and select “Air Player” to run on remote pc with AP. This is when I see “illegal argument list” error for the call to hw_dial_add. The instrument runs fine locally.

If I run Air Manager on the remote PC (in demo mode because I don’t have another license) the Arduino boards show as connected in the Devices tab.

I can’t find any other software which might be “grabbing” the ports, although it’s possible. I had Mobiflight installed but it is not running and there’s no obvious background process. I don’t know where else to look for anything residual.

I guess I could try Air Display on another PC to see if it works there, and then I’d know at least the problem is specific to the first remote PC.

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

Re: Air Player - how to add hardware?

#6 Post by Ralph » Wed Oct 21, 2020 12:55 pm

Can you make a screenshot of the error? Or copy paste it.

uptimist
Posts: 44
Joined: Mon Oct 19, 2020 3:57 pm

Re: Air Player - how to add hardware?

#7 Post by uptimist » Wed Oct 21, 2020 2:42 pm

The error shown is “logic.Luca:62: Illegal argument list”

That line corresponds to:
“hw_dial_add(“Trim Wheel”, trimwheel_callback)

This occurs when running the code for this instrument in the Create/Edit tab with Air Player selected, and Arduinos connected to the PC with Air Player running on it. Other instruments with hardware have the same problem.

It runs fine on the local Air Manager machine.

I also have a problem that each time I run a panel from the “Devices” tab, hardware settings (board type, channel, pins) have to be reconfigured, they are not saved between sessions.

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

Re: Air Player - how to add hardware?

#8 Post by Ralph » Wed Oct 21, 2020 5:49 pm

Can you share your complete script here?

uptimist
Posts: 44
Joined: Mon Oct 19, 2020 3:57 pm

Re: Air Player - how to add hardware?

#9 Post by uptimist » Thu Oct 22, 2020 9:26 am

Sure, see below.
I also tried G5 panel with hardware connected, it doesn't work either, and error log shows hardware binding error.

img_add_fullscreen("trimback.png")
img_trim = img_add("trimindicator.png", 38, 145, 33, 10)
img_add_fullscreen("trimcover.png")

-- 20 = top
-- 170 = take off
-- 270 = bottom

function new_trim(trim)
-- -1 = full nose down trim
-- 0 = take off setting
-- 1 = full nose down trim

-- pixel range is 250
move(img_trim, 38, 145 + (125 * var_cap(trim, -1, 1)), nil, nil)

end

function new_trim_fsx(trim)
-- -0.43 = full nose down trim
-- 0.43 = full nose up trim

trim = trim
new_trim(trim)

end

function trimwheel_callback(direction)
if direction == 1 then
fsx_event("ELEV_TRIM_UP")
fsx_event("ELEV_TRIM_UP")
fsx_event("ELEV_TRIM_UP")
fsx_event("ELEV_TRIM_UP")
fsx_event("ELEV_TRIM_UP")
fsx_event("ELEV_TRIM_UP")
fsx_event("ELEV_TRIM_UP")
fsx_event("ELEV_TRIM_UP")
fsx_event("ELEV_TRIM_UP")
fsx_event("ELEV_TRIM_UP")
fsx_event("ELEV_TRIM_UP")
fsx_event("ELEV_TRIM_UP")
elseif direction == - 1 then
fsx_event("ELEV_TRIM_DN")
fsx_event("ELEV_TRIM_DN")
fsx_event("ELEV_TRIM_DN")
fsx_event("ELEV_TRIM_DN")
fsx_event("ELEV_TRIM_DN")
fsx_event("ELEV_TRIM_DN")
fsx_event("ELEV_TRIM_DN")
fsx_event("ELEV_TRIM_DN")
fsx_event("ELEV_TRIM_DN")
fsx_event("ELEV_TRIM_DN")
fsx_event("ELEV_TRIM_DN")
fsx_event("ELEV_TRIM_DN")
end
end

function new_rbi(degs)
print(degs)
end

hw_dial_add("Trim Wheel", trimwheel_callback)

xpl_dataref_subscribe("sim/cockpit2/controls/elevator_trim", "FLOAT", new_trim)
fsx_variable_subscribe("ELEVATOR TRIM INDICATOR", "Position", new_trim_fsx)
fsx_variable_subscribe("NAV RELATIVE BEARING TO STATION:1", "Degrees", new_rbi)

User avatar
Keith Baxter
Posts: 2809
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Air Player - how to add hardware?

#10 Post by Keith Baxter » Thu Oct 22, 2020 9:57 am

Hi,

In future Please post code between the code boxes. That is the </> icon is found just above . Makes it easier for all.

When you have issues it is best to simplify.
Try this and let us know the results.
Not sure if you intend to send a event 12 times every dial click. I suspect that is not your intention. If it is then add the extra 11 events.

Code: Select all

function trimwheel_callback(direction)
    if direction == 1 then
        fsx_event("ELEV_TRIM_UP")
        print("Trim UP")
    else 
        fsx_event("ELEV_TRIM_DN")
         print("Trim DN")      
    end
end
hw_dial_add("Trim Wheel", trimwheel_callback)

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest