L:Com1OnOff", "Bool"
Using FSUIPC with Leo Bodnar USB board. With switch connected works perfectly with parameters 1 and 2. Also using Air Manager for gauge displays. Using "L:Com1OnOff", "Bool" in their LUA program does not work. I want to be able to turn off on the com radio. Any help is greatly appreciated.
Van
Piper Cherokee 180 L:Com1OnOff
- Nick - A2A
- A2A Captain
- Posts: 13803
- Joined: 06 Jun 2014, 13:06
- Location: UK
Re: Piper Cherokee 180 L:Com1OnOff
Hi Van,
That's indeed the correct L:Var and it's working as expected here when tested in FSUIPC6. Here's an example with a two position switch.
1=L:Com1OnOff=SET
What sort of switch are you using, and are you setting the variable or toggling it with your hardware activation?
Thanks,
Nick
That's indeed the correct L:Var and it's working as expected here when tested in FSUIPC6. Here's an example with a two position switch.
1=L:Com1OnOff=SET
What sort of switch are you using, and are you setting the variable or toggling it with your hardware activation?
Thanks,
Nick
A2A Simulations Inc.
Re: Piper Cherokee 180 L:Com1OnOff
Yes as I said I am using FSUIPC with Leo Bodnar USB board. With a real switch connected it works perfectly.
BUT I AM ALSO USING AIR MANAGER just to display the radio digits in my display gauge and that is the problem. As you know Air Manager is a popular program among cockpit builders. The LUA debug window in Air Manager is showing me A00 0 false false. It's like it is reading the LVAR twice? I also verified the script with Sim Innovation who make the program Air Manager. The last line in the script is where the LVAR is used. This is my verified script:
-- Add images in Z-order --
img_add_fullscreen("KX165A.png")
redline = img_add("redline.png", 364, 10, 2, 300)
-- Add text --
txt_com1 = txt_add(" ", "-fx-font-size:55px; -fx-fill: #DCF509; -fx-text-alignment: LEFT;", 25, 90, 200, 200)
txt_com1stby = txt_add(" ", "-fx-font-size:55px; -fx-fill: #DCF509; -fx-text-alignment: LEFT;", 200, 90, 200, 200)
txt_nav1 = txt_add(" ", "-fx-font-size:55px; -fx-fill: #DCF509; -fx-text-alignment: LEFT;", 365, 90, 200, 200)
txt_nav1stby = txt_add(" ", "-fx-font-size:55px; -fx-fill: #DCF509; -fx-text-alignment: LEFT;", 520, 90, 200, 200)
-- Set default visibility --
img_visible(redline, false)
--subscribe callback --
function new_navcomm_FSX(avionics, nav1, nav1stby, com1, com1stby, battery, generator, com1_on_off)
print("A"..avionics.." "..battery, generator, com1_on_off)
--make a boolean power variable based on state of avionics, battery, generator and com1_on_off
local power = avionics >= 8 and (battery >= 8 or generator) and com1_on_off
img_visible(redline, power)
if power then
txt_set(txt_com1, string.format("%d.%.02d",com1/100, com1%100) )
txt_set(txt_com1stby, string.format("%d.%.02d",com1stby/100, com1stby%100))
txt_set(txt_nav1, string.format("%d.%.02d",nav1/100, nav1%100))
txt_set(txt_nav1stby, string.format("%d.%.02d",nav1stby/100, nav1stby%100) )
else
txt_set(txt_com1, " ")
txt_set(txt_com1stby, " ")
txt_set(txt_nav1, " ")
txt_set(txt_nav1stby, " ")
end
end
--subscribes --
fsx_variable_subscribe("ELECTRICAL AVIONICS BUS VOLTAGE", "Volts",
"NAV ACTIVE FREQUENCY:1", "Mhz",
"NAV STANDBY FREQUENCY:1", "Mhz",
"COM ACTIVE FREQUENCY:1", "Mhz",
"COM STANDBY FREQUENCY:1", "Mhz",
"ELECTRICAL BATTERY BUS VOLTAGE", "Volts",
"GENERAL ENG GENERATOR SWITCH:1", "Bool",
"L:Com1OnOff", "Bool", new_navcomm_FSX)
BUT I AM ALSO USING AIR MANAGER just to display the radio digits in my display gauge and that is the problem. As you know Air Manager is a popular program among cockpit builders. The LUA debug window in Air Manager is showing me A00 0 false false. It's like it is reading the LVAR twice? I also verified the script with Sim Innovation who make the program Air Manager. The last line in the script is where the LVAR is used. This is my verified script:
-- Add images in Z-order --
img_add_fullscreen("KX165A.png")
redline = img_add("redline.png", 364, 10, 2, 300)
-- Add text --
txt_com1 = txt_add(" ", "-fx-font-size:55px; -fx-fill: #DCF509; -fx-text-alignment: LEFT;", 25, 90, 200, 200)
txt_com1stby = txt_add(" ", "-fx-font-size:55px; -fx-fill: #DCF509; -fx-text-alignment: LEFT;", 200, 90, 200, 200)
txt_nav1 = txt_add(" ", "-fx-font-size:55px; -fx-fill: #DCF509; -fx-text-alignment: LEFT;", 365, 90, 200, 200)
txt_nav1stby = txt_add(" ", "-fx-font-size:55px; -fx-fill: #DCF509; -fx-text-alignment: LEFT;", 520, 90, 200, 200)
-- Set default visibility --
img_visible(redline, false)
--subscribe callback --
function new_navcomm_FSX(avionics, nav1, nav1stby, com1, com1stby, battery, generator, com1_on_off)
print("A"..avionics.." "..battery, generator, com1_on_off)
--make a boolean power variable based on state of avionics, battery, generator and com1_on_off
local power = avionics >= 8 and (battery >= 8 or generator) and com1_on_off
img_visible(redline, power)
if power then
txt_set(txt_com1, string.format("%d.%.02d",com1/100, com1%100) )
txt_set(txt_com1stby, string.format("%d.%.02d",com1stby/100, com1stby%100))
txt_set(txt_nav1, string.format("%d.%.02d",nav1/100, nav1%100))
txt_set(txt_nav1stby, string.format("%d.%.02d",nav1stby/100, nav1stby%100) )
else
txt_set(txt_com1, " ")
txt_set(txt_com1stby, " ")
txt_set(txt_nav1, " ")
txt_set(txt_nav1stby, " ")
end
end
--subscribes --
fsx_variable_subscribe("ELECTRICAL AVIONICS BUS VOLTAGE", "Volts",
"NAV ACTIVE FREQUENCY:1", "Mhz",
"NAV STANDBY FREQUENCY:1", "Mhz",
"COM ACTIVE FREQUENCY:1", "Mhz",
"COM STANDBY FREQUENCY:1", "Mhz",
"ELECTRICAL BATTERY BUS VOLTAGE", "Volts",
"GENERAL ENG GENERATOR SWITCH:1", "Bool",
"L:Com1OnOff", "Bool", new_navcomm_FSX)
Re: Piper Cherokee 180 L:Com1OnOff
I had a lot of help from the folks at Sim Innovations, makers of Air Manager. They could not get the LVAR L:Com1OnOff,Bool to work either. It is giving two output values False False or False True in the lua program. I just wanted an LVAR that would turn com1 off or on with a true or false value.
- Nick - A2A
- A2A Captain
- Posts: 13803
- Joined: 06 Jun 2014, 13:06
- Location: UK
Re: Piper Cherokee 180 L:Com1OnOff
Hello Van,
I'm afraid we're not at all familiar with the software in question.
Are you able to use numeric values (0 or 1 in this case) rather than boolean expressions in Air Manager?
Thanks,
Nick
I'm afraid we're not at all familiar with the software in question.
Are you able to use numeric values (0 or 1 in this case) rather than boolean expressions in Air Manager?
Thanks,
Nick
A2A Simulations Inc.
Re: Piper Cherokee 180 L:Com1OnOff
Sugestions from Sim Innovations that they also could not get to work:
Tried " L:Com1OnOff ", "Number", new_navcomm_FSX (for 1 and 0)
Tried " L:Com1OnOff ", "Enum", new_navcomm_FSX (for 1 and 0)
Tried a "not" in front the variable name to invert the logic.
PS: I also run a flight simulator group with almost 8,000 members and still growing by the day. I always highly recommend your products in my group. https://www.facebook.com/groups/628896667180635
Tried " L:Com1OnOff ", "Number", new_navcomm_FSX (for 1 and 0)
Tried " L:Com1OnOff ", "Enum", new_navcomm_FSX (for 1 and 0)
Tried a "not" in front the variable name to invert the logic.
PS: I also run a flight simulator group with almost 8,000 members and still growing by the day. I always highly recommend your products in my group. https://www.facebook.com/groups/628896667180635
Re: Piper Cherokee 180 L:Com1OnOff
The LVAR L:Com1OnOff,Bool produces two values when True and two values when False in Air Manager. The values I get are (False False) and (False True) . It would work in Air Manager if I was getting a value of (false) or (True). Since I only need to turn off or on the com1 I ended up using L:FuseNavCom1, Enum : which gives a value of 0 or 1. BUT this also turns off the DME. I think only the programmers could explain the former values.
- Nick - A2A
- A2A Captain
- Posts: 13803
- Joined: 06 Jun 2014, 13:06
- Location: UK
Re: Piper Cherokee 180 L:Com1OnOff
I've just been having a dig around on Sim Innovation's site to try and learn a bit more about the software Van. I'll pass the most recent info you posted above on to our coders and see if they have any suggestions.
Thanks,
Nick
Thanks,
Nick
A2A Simulations Inc.
Re: Piper Cherokee 180 L:Com1OnOff
Thank you SO MUCH ! Working with Sim Innovations on the LUA code I got the following script to work but using the L:FuseNavCom1. The problem it turns off the Com1 and the DME. Not what I really wanted but have to use it for now. Here is the code that works in the script using L:FuseNavCom1 with values of 0 or 1.
-- Add images in Z-order --
img_add_fullscreen("KX165A.png")
redline = img_add("redline.png", 364, 10, 2, 300)
-- Add text --
txt_com1 = txt_add(" ", "size:25px; color:#DCF509; halign:left", 25, 40, 200, 200)
txt_com1stby = txt_add(" ", "size:25px; color:#DCF509; halign:left", 200, 40, 200, 200)
txt_nav1 = txt_add(" ", "size:25px; color:#DCF509; halign:left", 365, 40, 200, 200)
txt_nav1stby = txt_add(" ", "size:25px; color:#DCF509; halign:left", 520, 40, 200, 200)
-- Set default visibility --
img_visible(redline, false)
--subscribe callback --
function new_navcomm_FSX(avionics, nav1, nav1stby, com1, com1stby, battery, generator, FuseNavCom1)
--make a boolean power variable based on state of avionics, battery, generator and FuseNavCom1 == 1
local power = avionics >= 8 and (battery >= 8 or generator) and FuseNavCom1 == 1
img_visible(redline, power)
if power then
txt_set(txt_com1, string.format("%06.02f",com1, com1%1) )
txt_set(txt_com1stby, string.format("%06.02f",com1stby, com1stby%1))
txt_set(txt_nav1, string.format("%06.02f",nav1, nav1%1))
txt_set(txt_nav1stby, string.format("%06.02f",nav1stby, nav1stby%1) )
else
txt_set(txt_com1, " ")
txt_set(txt_com1stby, " ")
txt_set(txt_nav1, " ")
txt_set(txt_nav1stby, " ")
end
end
--subscribes --
fsx_variable_subscribe("ELECTRICAL AVIONICS BUS VOLTAGE", "Volts",
"NAV ACTIVE FREQUENCY:1", "Mhz",
"NAV STANDBY FREQUENCY:1", "Mhz",
"COM ACTIVE FREQUENCY:1", "Mhz",
"COM STANDBY FREQUENCY:1", "Mhz",
"ELECTRICAL BATTERY BUS VOLTAGE", "Volts",
"GENERAL ENG GENERATOR SWITCH:1", "Bool",
"L:FuseNavCom1", "Enum", new_navcomm_FSX)
-- Add images in Z-order --
img_add_fullscreen("KX165A.png")
redline = img_add("redline.png", 364, 10, 2, 300)
-- Add text --
txt_com1 = txt_add(" ", "size:25px; color:#DCF509; halign:left", 25, 40, 200, 200)
txt_com1stby = txt_add(" ", "size:25px; color:#DCF509; halign:left", 200, 40, 200, 200)
txt_nav1 = txt_add(" ", "size:25px; color:#DCF509; halign:left", 365, 40, 200, 200)
txt_nav1stby = txt_add(" ", "size:25px; color:#DCF509; halign:left", 520, 40, 200, 200)
-- Set default visibility --
img_visible(redline, false)
--subscribe callback --
function new_navcomm_FSX(avionics, nav1, nav1stby, com1, com1stby, battery, generator, FuseNavCom1)
--make a boolean power variable based on state of avionics, battery, generator and FuseNavCom1 == 1
local power = avionics >= 8 and (battery >= 8 or generator) and FuseNavCom1 == 1
img_visible(redline, power)
if power then
txt_set(txt_com1, string.format("%06.02f",com1, com1%1) )
txt_set(txt_com1stby, string.format("%06.02f",com1stby, com1stby%1))
txt_set(txt_nav1, string.format("%06.02f",nav1, nav1%1))
txt_set(txt_nav1stby, string.format("%06.02f",nav1stby, nav1stby%1) )
else
txt_set(txt_com1, " ")
txt_set(txt_com1stby, " ")
txt_set(txt_nav1, " ")
txt_set(txt_nav1stby, " ")
end
end
--subscribes --
fsx_variable_subscribe("ELECTRICAL AVIONICS BUS VOLTAGE", "Volts",
"NAV ACTIVE FREQUENCY:1", "Mhz",
"NAV STANDBY FREQUENCY:1", "Mhz",
"COM ACTIVE FREQUENCY:1", "Mhz",
"COM STANDBY FREQUENCY:1", "Mhz",
"ELECTRICAL BATTERY BUS VOLTAGE", "Volts",
"GENERAL ENG GENERATOR SWITCH:1", "Bool",
"L:FuseNavCom1", "Enum", new_navcomm_FSX)
Re: Piper Cherokee 180 L:Com1OnOff
You can always contact Sim Innovations via email here: [email protected]
Re: Piper Cherokee 180 L:Com1OnOff
Nick,
Air Manager fix for A2A Com1 on/off knob - (L:Com1OnOff,bool)
A2A LVAR L:Com1OnOff,Bool produces two values when True and two values when False in Air Manager. The values I get are (False False) and (False True). I found my answer in an old modified gauge file I had (Piper PA-28- KR87 (A2A only). Use "L:Com1OnOff", "DOUBLE", and values of 0 or 1.
My script for a new gauge I made with help from Sim Innovations:
-- Add images in Z-order --
img_add_fullscreen("KX165A.png")
redline = img_add("redline.png", 364, 10, 2, 300)
-- Add text --
txt_com1 = txt_add(" ", "size:25px; color:#DCF509; halign:left", 25, 40, 200, 200)
txt_com1stby = txt_add(" ", "size:25px; color:#DCF509; halign:left", 200, 40, 200, 200)
txt_nav1 = txt_add(" ", "size:25px; color:#DCF509; halign:left", 365, 40, 200, 200)
txt_nav1stby = txt_add(" ", "size:25px; color:#DCF509; halign:left", 520, 40, 200, 200)
-- Set default visibility --
img_visible(redline, false)
--subscribe callback --
function new_navcomm_FSX(avionics, nav1, nav1stby, com1, com1stby, battery, generator, Com1OnOff)
--make a boolean power variable based on state of avionics, battery, generator and Com1OnOff == 1
local power = avionics >= 8 and (battery >= 8 or generator) and Com1OnOff == 1
img_visible(redline, power)
if power then
txt_set(txt_com1, string.format("%06.02f",com1, com1%1) )
txt_set(txt_com1stby, string.format("%06.02f",com1stby, com1stby%1))
txt_set(txt_nav1, string.format("%06.02f",nav1, nav1%1))
txt_set(txt_nav1stby, string.format("%06.02f",nav1stby, nav1stby%1) )
else
txt_set(txt_com1, " ")
txt_set(txt_com1stby, " ")
txt_set(txt_nav1, " ")
txt_set(txt_nav1stby, " ")
end
end
--subscribes --
fsx_variable_subscribe("ELECTRICAL AVIONICS BUS VOLTAGE", "Volts",
"NAV ACTIVE FREQUENCY:1", "Mhz",
"NAV STANDBY FREQUENCY:1", "Mhz",
"COM ACTIVE FREQUENCY:1", "Mhz",
"COM STANDBY FREQUENCY:1", "Mhz",
"ELECTRICAL BATTERY BUS VOLTAGE", "Volts",
"GENERAL ENG GENERATOR SWITCH:1", "Bool",
"L:Com1OnOff", "DOUBLE", new_navcomm_FSX)
Air Manager fix for A2A Com1 on/off knob - (L:Com1OnOff,bool)
A2A LVAR L:Com1OnOff,Bool produces two values when True and two values when False in Air Manager. The values I get are (False False) and (False True). I found my answer in an old modified gauge file I had (Piper PA-28- KR87 (A2A only). Use "L:Com1OnOff", "DOUBLE", and values of 0 or 1.
My script for a new gauge I made with help from Sim Innovations:
-- Add images in Z-order --
img_add_fullscreen("KX165A.png")
redline = img_add("redline.png", 364, 10, 2, 300)
-- Add text --
txt_com1 = txt_add(" ", "size:25px; color:#DCF509; halign:left", 25, 40, 200, 200)
txt_com1stby = txt_add(" ", "size:25px; color:#DCF509; halign:left", 200, 40, 200, 200)
txt_nav1 = txt_add(" ", "size:25px; color:#DCF509; halign:left", 365, 40, 200, 200)
txt_nav1stby = txt_add(" ", "size:25px; color:#DCF509; halign:left", 520, 40, 200, 200)
-- Set default visibility --
img_visible(redline, false)
--subscribe callback --
function new_navcomm_FSX(avionics, nav1, nav1stby, com1, com1stby, battery, generator, Com1OnOff)
--make a boolean power variable based on state of avionics, battery, generator and Com1OnOff == 1
local power = avionics >= 8 and (battery >= 8 or generator) and Com1OnOff == 1
img_visible(redline, power)
if power then
txt_set(txt_com1, string.format("%06.02f",com1, com1%1) )
txt_set(txt_com1stby, string.format("%06.02f",com1stby, com1stby%1))
txt_set(txt_nav1, string.format("%06.02f",nav1, nav1%1))
txt_set(txt_nav1stby, string.format("%06.02f",nav1stby, nav1stby%1) )
else
txt_set(txt_com1, " ")
txt_set(txt_com1stby, " ")
txt_set(txt_nav1, " ")
txt_set(txt_nav1stby, " ")
end
end
--subscribes --
fsx_variable_subscribe("ELECTRICAL AVIONICS BUS VOLTAGE", "Volts",
"NAV ACTIVE FREQUENCY:1", "Mhz",
"NAV STANDBY FREQUENCY:1", "Mhz",
"COM ACTIVE FREQUENCY:1", "Mhz",
"COM STANDBY FREQUENCY:1", "Mhz",
"ELECTRICAL BATTERY BUS VOLTAGE", "Volts",
"GENERAL ENG GENERATOR SWITCH:1", "Bool",
"L:Com1OnOff", "DOUBLE", new_navcomm_FSX)
- Nick - A2A
- A2A Captain
- Posts: 13803
- Joined: 06 Jun 2014, 13:06
- Location: UK
Re: Piper Cherokee 180 L:Com1OnOff
Very glad you were able to find a solution Van, and thanks for posting the info above for anyone else in the same situation.
All the best,
Nick
All the best,
Nick
A2A Simulations Inc.
Who is online
Users browsing this forum: No registered users and 20 guests