defineProperty("pulse", globalPropertyf("sim/flightmodel2/gear/tire_steer_actual_deg[0]"))
defineProperty("IAS", globalPropertyf("sim/flightmodel/position/indicated_airspeed"))
defineProperty("FF", globalPropertyf("sim/cockpit2/engine/indicators/fuel_flow_kg_sec"))
defineProperty("fuel_total", globalPropertyf("sim/flightmodel/weight/m_fuel_total"))
defineProperty("fuelL", globalPropertyf("sim/flightmodel/weight/m_fuel1"))
defineProperty("fuelR", globalPropertyf("sim/flightmodel/weight/m_fuel2"))

defineProperty("fuel_quantity_0", globalPropertyf("sim/cockpit2/fuel/fuel_quantity[0]"))
defineProperty("fuel_quantity_1", globalPropertyf("sim/cockpit2/fuel/fuel_quantity[1]"))


defineProperty("Endurance_h", globalPropertyf("com/dkmp/Endurance_h"))
defineProperty("TotalFuelUsed_kg", globalPropertyf("com/dkmp/TotalFuelUsed_kg"))
defineProperty("InitialFuel", globalPropertyf("com/dkmp/InitialFuel"))


defineProperty("override_beacons_and_strobes", globalPropertyi("sim/flightmodel2/lights/override_beacons_and_strobes"))
defineProperty("strobe_switch", globalPropertyi("sim/cockpit/electrical/strobe_lights_on"))
defineProperty("strobe_flash_now", globalPropertyi("sim/flightmodel2/lights/strobe_flash_now"))
defineProperty("battery_on", globalPropertyi("sim/cockpit2/electrical/battery_on[0]"))  -- ON/OFF main battery

defineProperty("beacon_switch", globalPropertyi("sim/cockpit/electrical/beacon_lights_on"))
defineProperty("beacon_brightness", globalPropertyf("sim/flightmodel2/lights/beacon_brightness_ratio[0]"))



defineProperty("time", globalPropertyf("sim/time/total_flight_time_sec"))

defineProperty("timer", globalPropertyf("com/dkmp/timer"))

local strobe_Brightness={}
for i=0,8 do
	strobe_Brightness[i] = globalPropertyf("sim/flightmodel2/lights/strobe_brightness_ratio[".. i .."]")
end


local strobe={}
for i=0,8 do
	strobe[i] = globalPropertyi("com/dkmp/strobe[".. i .."]")
end


local PBR={}
for i=0, 16 do
	PBR[i] = globalPropertyf("sim/cockpit2/switches/panel_brightness_ratio[".. i .."]")
end

for i=0, 16 do 
	set(PBR[i], 0) 
	end


local IBR={}
for i=0, 16 do
	IBR[i] = globalPropertyf("sim/cockpit2/switches/instrument_brightness_ratio[".. i .."]")
end

for i=0, 16 do 
	set(IBR[i], 0) 
	end

--exceptions:
set(IBR[0]  , 1)
set(IBR[1]  , 1)
set(IBR[3]  , 0.4)
set(IBR[8]  , 1)
set(IBR[10] , 1)
set(IBR[12] , 1)
set(IBR[13] , 1)


local GLS={}
for i=0, 64 do
	GLS[i] = globalPropertyf("sim/cockpit2/switches/generic_lights_switch[".. i .."]")
end

for i=0, 64 do 
	set(GLS[i], 0) 
	end
--exceptions:
set(GLS[19], 1)
set(GLS[37], 1)
set(GLS[38], 1)
set(GLS[39], 1)
set(GLS[41], 1)


	--Custom Slider On
local CSO={}
for i=0,24 do
	CSO[i] = globalPropertyf("sim/cockpit2/switches/custom_slider_on[".. i .."]")
end

for i=0, 24 do 
	set(CSO[i], 0) 
	end
	

local CSR={}
for i=0,24 do
	CSR[i] = globalPropertyf("sim/flightmodel2/misc/custom_slider_ratio[".. i .."]")
end	
	
	
	

set(InitialFuel, (get(fuel_quantity_0) + get(fuel_quantity_1)))


set(override_beacons_and_strobes, 1)


set(timer, 0)


TotalFuelUsed_kg_old = get(TotalFuelUsed_kg)

function update()



if TotalFuelUsed_kg_old - get(TotalFuelUsed_kg) == 0 then
set(TotalFuelUsed_kg, get(InitialFuel)*1 - (get(fuel_quantity_0) + get(fuel_quantity_1)))
else
set(InitialFuel, (get(fuel_quantity_0) + get(fuel_quantity_1)))
end














set(strobe_Brightness[0], get(strobe_switch)*get(battery_on))


s = 1.6

if get(time) < 1 then
set(timer, get(time))
end


if get(time) - get(timer) > s then
set(timer, get(time))
end

loop1 = (get(time) - get(timer)) / s



if get(strobe_switch) == 1 and get(battery_on) == 1 then	
		if loop1 > 0 and loop1 < 0.05 then
			set(strobe_Brightness[1])	
			set(strobe[1], 1)
			set(strobe_flash_now, 1)
		elseif loop1 > 0.05 and loop1 < 0.1 then
			set(strobe_Brightness[0])		
			set(strobe[1], 0)
			set(strobe_flash_now, 0)
		elseif loop1 > 0.1 and loop1 < 0.15 then
			set(strobe_Brightness[1])
			set(strobe[1], 1)
			set(strobe_flash_now, 1)
		elseif loop1 > 0.15 and loop1 < 0.2 then
			set(strobe_Brightness[0])
			set(strobe[1], 0)
			set(strobe_flash_now, 0)
		elseif loop1 > 0.2 and loop1 < 0.25 then
			set(strobe_Brightness[1])
			set(strobe[1], 1)
			set(strobe_flash_now, 1)
		elseif loop1 > 0.25 and loop1 < 1.0 then
			set(strobe_Brightness[0])
			set(strobe[1], 0)
			set(strobe_flash_now, 0)
		end
end


if get(beacon_switch) == 1 and get(battery_on) == 1 then		
		if loop1 > 0.5 and loop1 < 0.55 then
			set(beacon_brightness, 1)
			set(strobe_flash_now, 1)
		elseif loop1 > 0.55 and loop1 < 0.6 then
			set(beacon_brightness, 0)
			set(strobe_flash_now, 0)
		elseif loop1 > 0.6 and loop1 < 0.65 then
			set(strobe[2], 1)
			set(strobe_flash_now, 1)
		elseif loop1 > 0.65 and loop1 < 0.7 then
			set(strobe[2], 0)
			set(strobe_flash_now, 0)
		elseif loop1 > 0.7 and loop1 < 0.75 then
			set(strobe[2], 1)
			set(strobe_flash_now, 1)			
		elseif loop1 > 0.75 and loop1 < 1.0 then
			set(strobe[2], 0)
			set(strobe_flash_now, 0)
		end
	else
	set(strobe[1], 0)
	set(strobe[2], 0)
end	

TotalFuelUsed_kg_old = get(TotalFuelUsed_kg)

end