Cant get Annunciators to work on Seneca V community made

Latest Information on Sim Innovation's flagship product Air Manager

Moderators: russ, Ralph

Post Reply
Message
Author
Howy_Itzer
Posts: 10
Joined: Tue Nov 16, 2021 2:52 pm

Cant get Annunciators to work on Seneca V community made

#1 Post by Howy_Itzer »

test or failed items do not light leds. Here is the code

------------------------------
-- Define constants
------------------------------
x_size = 880
y_size = 130
no_of_cols = 6
no_of_rows = 2
delta_x = 144
delta_y = 68
offset_x = 7--(x_size - (no_of_cols * delta_x))/2
offset_y = 0--(y_size - (no_of_rows * delta_y))/2
gbl_bat = 0

------------------------------
-- setup arrays
------------------------------
dx = {}
dy = {}
dw = {}
dh = {}
for i = 1, no_of_cols * no_of_rows do
dx = ((i-1)%no_of_cols)*delta_x
dy = math.floor((i-1)/no_of_cols)*delta_y
dw = delta_x
dh = delta_y
end

-------------------------------
-- Background image
-------------------------------
img_annun_off = img_add("annun_left_off.png",0,0,x_size,y_size)

-------------------------------
-- Setup mask
-------------------------------
img_mask_day = {}
for i = 1, no_of_cols * no_of_rows do
img_mask_day = img_add("annun_left_on_day.png",0,0,x_size,y_size)
viewport_rect(img_mask_day, dx+offset_x, dy+offset_y, dw, dh)
visible(img_mask_day[i], false)
end

img_mask_night = {}
for i = 1, no_of_cols * no_of_rows do
img_mask_night[i] = img_add("annun_left_on_night.png",0,0,x_size,y_size)
viewport_rect(img_mask_night[i], dx[i]+offset_x, dy[i]+offset_y, dw[i], dh[i])
visible(img_mask_night[i], false)
end

lights_right_on_day = img_add("annun_left_on_day.png",0,0,x_size,y_size)
lights_right_on_night = img_add("annun_left_on_night.png",0,0,x_size,y_size)
visible(lights_right_on_day, false)
visible(lights_right_on_night, false)

function new_warnings(battery, avionics, op_left, alt_left,rpm_left,engage_left,flap_percent,gear_percent,vlt_left,baggage_percent, lights_test, day_night)

if battery == 1 and avionics == 1 then
gbl_bat = 1
else
gbl_bat = 0
end

-- Test all LIGHTS
visible(lights_right_on_day, day_night == 0 and lights_test == 1 and gbl_bat == 1)
visible(lights_right_on_night, day_night == 1 and lights_test == 1 and gbl_bat == 1)

--#####################################################################
-- LEFT LIGHTS

-- Left Oil Pressure
visible(img_mask_day[1], day_night == 0 and op_left == 1 and gbl_bat == 1)
visible(img_mask_night[1], day_night == 1 and op_left == 1 and gbl_bat == 1)
-- Left Alternator Inoperant
visible(img_mask_day[2], day_night == 0 and alt_left_inop == 1 and gbl_bat == 1)
visible(img_mask_night[2], day_night == 1 and alt_left_inop == 1 and gbl_bat == 1)
-- Left Vacuum Inoperant
visible(img_mask_day[3], day_night == 0 and vac_left_inop == 1 and gbl_bat == 1)
visible(img_mask_night[3], day_night == 1 and vac_left_inop == 1 and gbl_bat == 1)
-- Left Start Engage
visible(img_mask_day[4], day_night == 0 and start_engage_left == 1 and gbl_bat == 1)
visible(img_mask_night[4], day_night == 1 and start_engage_left == 1 and gbl_bat == 1)
-- Flaps in Transit
visible(img_mask_day[5], day_night == 0 and flaps_in_transit == 1 and gbl_bat == 1)
visible(img_mask_night[5], day_night == 1 and flaps_in_transit == 1 and gbl_bat == 1)
-- Gear Warn
visible(img_mask_day[6], day_night == 0 and gear_warn == 1 and gbl_bat == 1)
visible(img_mask_night[6], day_night == 1 and gear_warn == 1 and gbl_bat == 1)
-- Left Low Voltage
visible(img_mask_day[7], day_night == 0 and vlt_low_left == 1 and gbl_bat == 1)
visible(img_mask_night[7], day_night == 1 and vlt_low_left == 1 and gbl_bat == 1)
-- Baggage Door
visible(img_mask_day[8], day_night == 0 and baggage_door == 1 and gbl_bat == 1)
visible(img_mask_night[8], day_night == 1 and baggage_door == 1 and gbl_bat == 1)
--#####################################################################
end

function new_warnings_fsx(battery, avionics, op_left, alt_left, rpm_left,engage_left, flap_percent,gear_percent,vlt_left,baggage_percent, lights_test, day_night)
-- Convert boolean to integer

battery = fif(battery == true, 1, 0)
avionics = fif(avionics >= 1, 1, 0)
op_left = fif(op_left < 25 or op_left > 80, 1, 0)
alt_left_inop = fif(alt_left == true and rpm_left > 500, 0, 1)
vac_left_inop = fif(rpm_left < 100, 1, 0)
start_engage_left = fif(engage_left == true and rpm_left < 500, 1, 0)
flaps_in_transit = fif((flap_percent > 1 and flap_percent < 25) or
(flap_percent > 25 and flap_percent < 62) or
(flap_percent > 64 and flap_percent < 100), 1, 0)
gear_warn = fif(gear_percent > 0 and gear_percent < 100, 1, 0)
vlt_low_left = fif(vlt_left < 25, 1, 0)
baggage_door = fif(baggage_percent > 10, 1, 0)

new_warnings(battery, avionics, op_left, alt_left,rpm_left,engage_left, flap_percent, gear_percent,vlt_left,baggage_percent, lights_test, day_night)

end

-------------------------------
-- Callback
-------------------------------

--button_test = button_add(nil, nil, 929, 27, 49, 49, test_press_callback, test_release_callback)

fsx_variable_subscribe("ELECTRICAL MASTER BATTERY", "BOOL",
"ELECTRICAL AVIONICS BUS VOLTAGE", "Volts",
"GENERAL ENG1 OIL PRESSURE", "PSI",
"GENERAL ENG MASTER ALTERNATOR:1","BOOL",
"PROP RPM:1","RPM",
"GENERAL ENG STARTER:1","BOOL",
"TRAILING EDGE FLAPS RIGHT PERCENT","Percent",
"GEAR POSITION","Percent",
"ELECTRICAL GENALT BUS VOLTAGE:1","Volts",
"EXIT OPEN:1","Percent",
"L:GAUGE_ANUM_TEST","Number",
"L:ASD_SWITCH_ANNUN_DAY","Number",new_warnings_fsx)

fs2020_variable_subscribe("ELECTRICAL MASTER BATTERY", "BOOL",
"ELECTRICAL AVIONICS BUS VOLTAGE", "Volts",
"GENERAL ENG1 OIL PRESSURE", "PSI",
"GENERAL ENG MASTER ALTERNATOR:1","BOOL",
"PROP RPM:1","RPM",
"GENERAL ENG STARTER:1","BOOL",
"TRAILING EDGE FLAPS RIGHT PERCENT","Percent",
"GEAR POSITION","Percent",
"ELECTRICAL GENALT BUS VOLTAGE:1","Volts",
"EXIT OPEN:1","Percent",
"L:GAUGE_ANUM_TEST","Number",
"L:ASD_SWITCH_ANNUN_DAY","Number",new_warnings_fsx)

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

Re: Cant get Annunciators to work on Seneca V community made

#2 Post by Ralph »

And... ?

Howy_Itzer
Posts: 10
Joined: Tue Nov 16, 2021 2:52 pm

Re: Cant get Annunciators to work on Seneca V community made

#3 Post by Howy_Itzer »

See anything wrong with the code? Or does Sim Innovations not support Air Manager

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

Re: Cant get Annunciators to work on Seneca V community made

#4 Post by Ralph »

I'm not really sure why the script would have to be posted here? But if you do post any scripts then please do this between code brackets.

Also, we do not know which flight sim you are using, and which flight model you are using.

Post Reply