Sign in to follow this  
dental12

realair duke v2

Recommended Posts

Help AVSIM continue to serve you!
Please donate today!

Hello,

 

what new version do you mean?

Piston B60 V2?

 

If so, no, it does not work in any aspects.

I have to make a new module first, but have to wait till my replacement Combo arrives

Share this post


Link to post
Share on other sites

Did a module ever get posted for the Duke v.2?  I have one that's pretty much functional (lacking the pressurisation knobs, unfortunately)...basically culled pieces from here and there to get the functionality.  I think there are some folks that already have it working as well, though.  If it's needed, I would want some testers so I could flush out any 'helper macros' that might be desired. 

 

Gregg

Share this post


Link to post
Share on other sites

Hello,

 

I have here an unfinished module - had the Duke a long time uninstalled currently.

You can have a look and modify it. I will upload once then this as a module.

 

many thanks

 

 

(no guarantee that this is working)

-- module 1.0
-- Dezember 2013 unreleased
-- ################################
-- RealAir Duke B60 V2
-- ################################



-- ## system ###############

function InitVars ()

    Yoke_Hide ()
    --open_door_when_onground ()
end



--function Timer ()

--   OilL = round(ipc.readLvar("dukeCorrectedOtL"))
--   OilR = round(ipc.readLvar("dukeCorrectedOtR"))


--    if _MCP2() then

--        FLIGHT_INFO1 = "L Oil R"
--        FLIGHT_INFO2 = OilL .. "C " .. OilR .. "C"

--    else

--        FLIGHT_INFO1 = "L" .. OilL
--        FLIGHT_INFO2 = "R" .. OilR
--    end
--end

function LargerockerSound ()
     ipc.writeLvar("L:LargerockerSound", 1)
end




-- ## Avionics ###############



function DukeB60_Inverter_on ()
     ipc.writeLvar("L:Duke_inverter_Switch", 0)
     DspShow("Inv", "on")
end

function DukeB60_Inverter_off ()
     ipc.writeLvar("L:Duke_inverter_Switch", 1)
     DspShow("Inv", "off")
end

function DukeB60_Inverter_stby ()
     ipc.writeLvar("L:Duke_inverter_Switch", 2)
     DspShow("Inv", "stby")
end


function DukeB60_NavCom1_On ()
     ipc.writeLvar("L:NavCom1_On", 0)
     DspShow("Nav1", "on")
end

function DukeB60_NavCom1_Off ()
     ipc.writeLvar("L:NavCom1_On", 1)
     DspShow("Nav1", "off")
end

function DukeB60_NavCom2_On ()
     ipc.writeLvar("L:NavCom2_On", 0)
     DspShow("Nav2", "on")
end

function DukeB60_NavCom2_Off ()
     ipc.writeLvar("L:NavCom2_On", 1)
     DspShow("Nav2", "off")
end

function DukeB60_GPS_On ()
     ipc.writeLvar("L:dukeGpsOn", 1)
     DspShow("GPS", "on")
end

function DukeB60_GPS_Off ()
     ipc.writeLvar("L:dukeGpsOn", 0)
     DspShow("GPS", "off")
end

function DukeB60_ADF_On ()
     ipc.writeLvar("L:ADF_On_Switch", 1)
     DspShow("ADF", "on")
end

function DukeB60_ADF_Off ()
     ipc.writeLvar("L:ADF_On_Switch", 0)
     DspShow("ADF", "off")
end

function DukeB60_Avionics_on ()


    DukeB60_NavCom1_On ()

	_sleep(200, 400)

    DukeB60_NavCom2_On ()

	_sleep(200, 400)

    DukeB60_GPS_On ()

	_sleep(200, 400)

    DukeB60_ADF_On ()

    _sleep(200, 400)

     DukeB60_XPDR_on ()
end

function DukeB60_Avionics_off ()

    DukeB60_NavCom1_Off ()

	_sleep(200, 400)

    DukeB60_NavCom2_Off ()

	_sleep(200, 400)


    DukeB60_ADF_Off ()

	_sleep(200, 400)

    DukeB60_GPS_Off ()

	_sleep(200, 400)

    DukeB60_XPDR_off ()

end

-- ## Electrics #####################################

function Battery_on ()

	ipc.writeDD("281C", 1)
	DspShow ("BAT ", "On  ")
    LargerockerSound ()
end

function Battery_off ()

	ipc.writeDD("281C", 0)
	DspShow ("BAT ", "Off ")
    LargerockerSound ()
end


function Battery_toggle ()

    if ipc.readDD("281C") == 0 then
        Battery_on ()
    else
        Battery_off ()
    end
end



function Magneto1_off ()
   ipc.control(66400, 0)
   DspShow ("Mag1", "off")
end

function Magneto1_right ()
   ipc.control(66400, 2)
   DspShow ("Mag1", "rght")
end

function Magneto1_left ()
   ipc.control(66400, 1)
   DspShow ("Mag1", "left")
end

function Magneto1_both ()
   ipc.control(66400, 3)
   DspShow ("Mag1", "both")
end

function Magneto1_start ()
   ipc.control(66400, 4)
   DspShow ("Mag1", "strt")
end



function Magneto2_off ()
   ipc.control(66401, 0)
   DspShow ("Mag2", "off")
end

function Magneto2_right ()
   ipc.control(66401, 2)
   DspShow ("Mag2", "rght")
end

function Magneto2_left ()
   ipc.control(66401, 1)
   DspShow ("Mag2", "left")
end

function Magneto2_both ()
   ipc.control(66401, 3)
   DspShow ("Mag2", "both")
end

function Magneto2_start ()
   ipc.control(66401, 4)
   DspShow ("Mag2", "strt")
end


function ENG1_magneto_inc ()

	FVar = "0892"

	val = ipc.readSB(FVar)
	if val == 0 then
	val = 2
    MagTxt = "rght"
    elseif val == 2 then
	val = 1
    MagTxt = "left"
    elseif val == 1 then
	val = 3
    MagTxt = "both"
	end

	ipc.writeSB(FVar, val)
    DspShow ("Mag", MagTxt)
end

function ENG1_magneto_dec ()

	FVar = "0892"

	val = ipc.readSB(FVar)
	if val == 3 then
	val = 1
    MagTxt = "left"
    elseif val == 1 then
	val = 2
    MagTxt = "rght"
    elseif val == 2 then
	val = 0
    MagTxt = "off"
	end

	ipc.writeSB(FVar, val)
    DspShow ("Mag", MagTxt)
end

---

function ENG2_magneto_inc ()

	FVar = "092A"

	val = ipc.readSB(FVar)
	if val == 0 then
	val = 2
    MagTxt = "rght"
    elseif val == 2 then
	val = 1
    MagTxt = "left"
    elseif val == 1 then
	val = 3
    MagTxt = "both"
	end

	ipc.writeSB(FVar, val)
    DspShow ("Mag", MagTxt)
end

function ENG2_magneto_dec ()

	FVar = "092A"

	val = ipc.readSB(FVar)
	if val == 3 then
	val = 1
    MagTxt = "left"
    elseif val == 1 then
	val = 2
    MagTxt = "rght"
    elseif val == 2 then
	val = 0
    MagTxt = "off"
	end

	ipc.writeSB(FVar, val)
    DspShow ("Mag", MagTxt)
end

-- generator
function DukeB60_Generator_L_on ()
	ipc.writeSB("3b78", 1)
    DspShow ("GenL", "On")
end

function DukeB60_Generator_R_on ()
	ipc.writeSB("3ab8", 1)
    DspShow ("GenR", "On")
end

function DukeB60_Generator_Both_on ()
	ipc.writeSB("3b78", 1)
	ipc.writeSB("3ab8", 1)
    DspShow ("GenB", "On")
end

function DukeB60_Generator_L_off ()
	ipc.writeSB("3b78", 0)
    DspShow ("GenL", "Off")
end

function DukeB60_Generator_R_off ()
	ipc.writeSB("3ab8", 0)
    DspShow ("GenR", "Off")
end

function DukeB60_Generator_Both_off ()
	ipc.writeSB("3b78", 0)
	ipc.writeSB("3ab8", 0)
    DspShow ("GenB", "Off")
end







-- ## Fuel #####################################

-- Fuel pump + valve ENG1 on (both engines)

function DukeB60_FuelPumpENG1_on ()

	ipc.writeSB("3b98", 1)
    DspShow("Pump", "1 on")

end

function DukeB60_FuelPumpENG1_off ()

	ipc.writeSB("3b98", 0)
    DspShow("Pump", "1off")
end


function DukeB60_FuelPumpENG2_on ()

	ipc.writeSB("3ad8", 1)
    DspShow("Pump", "2 on")
end

function DukeB60_FuelPumpENG2_off ()

	ipc.writeSB("3ad8", 0)
    DspShow("Pump", "2off")
end


function DukeB60_FuelValveENG1_on ()

	ipc.writeLvar("L:Duke_Tank_Selector_L", 50)
    DspShow("Fuel", "1 on")
end


function DukeB60_FuelValveENG1_off ()

	ipc.writeLvar("L:Duke_Tank_Selector_L", 0)
    DspShow("Fuel", "1off")
end


function DukeB60_FuelValveENG2_on ()

	ipc.writeLvar("L:Duke_Tank_Selector_R", 50)
    DspShow("Fuel", "2 on")
end

function DukeB60_FuelValveENG2_off ()

	ipc.writeLvar("L:Duke_Tank_Selector_R", 0)
    DspShow("Fuel", "2off")
end



function DukeB60_FuelPumps_on ()

    DukeB60_FuelPumpENG1_on ()
    _sleep(150, 350)
    DukeB60_FuelPumpENG2_on ()
end

function DukeB60_FuelPumps_off ()

     DukeB60_FuelPumpENG1_off ()
    _sleep(150, 350)
    DukeB60_FuelPumpENG2_off ()

end

function DukeB60_FuelValves_on ()

    DukeB60_FuelValveENG1_on ()
    _sleep(150, 350)
    DukeB60_FuelValveENG2_on ()
end

function DukeB60_FuelValves_off ()

    DukeB60_FuelValveENG1_off ()
    _sleep(150, 350)
    DukeB60_FuelValveENG2_off ()
end


-- ## Cowl Flaps #####################################

function Duke_CowlFlap1_show ()
    ipc.sleep(10)
    CF1var = ipc.readLvar("L:RECIP ENG COWL FLAP POSITION1Ant")
    if CF1var == 0 then CF1txt = "clsd"
    elseif CF1var > 0 and CF1var < 1 then CF1txt = "half"
    elseif CF1var == 1 then CF1txt = "open"
    end

    FLIGHT_INFO1 = "CwlL"
    FLIGHT_INFO2 = CF1txt
end

function Duke_CowlFlap2_show ()
    ipc.sleep(10)
    CF2var = ipc.readLvar("L:RECIP ENG COWL FLAP POSITION2Ant")
    if CF2var == 0 then CF2txt = "clsd"
    elseif CF2var > 0 and CF2var < 1 then CF2txt = "half"
    elseif CF2var == 1 then CF2txt = "open"
    end
    FLIGHT_INFO1 = "CwlR"
    FLIGHT_INFO2 = CF2txt
end




function CowlFlaps_LEFT_open ()

    ipc.control(66162, 16400)
    Duke_CowlFlap1_show ()
    LargerockerSound ()
end

function CowlFlaps_LEFT_half ()

    ipc.control(66162, 8200)
    Duke_CowlFlap1_show ()
    LargerockerSound ()
end

function CowlFlaps_LEFT_close ()

    ipc.control(66162, 0)
    Duke_CowlFlap1_show ()
    LargerockerSound ()
end

function CowlFlaps_RIGHT_open ()

    ipc.control(66163, 16400)
    Duke_CowlFlap2_show ()
    LargerockerSound ()
end

function CowlFlaps_RIGHT_half ()

    ipc.control(66163, 8200)
    Duke_CowlFlap2_show ()
    LargerockerSound ()
end

function CowlFlaps_RIGHT_close ()

    ipc.control(66163, 0)
    Duke_CowlFlap2_show ()
    LargerockerSound ()
end

function CowlFlaps_BOTH_open ()

	CowlFlaps_LEFT_open ()
	CowlFlaps_RIGHT_open ()

end

function CowlFlaps_BOTH_half ()

	CowlFlaps_LEFT_half ()
	CowlFlaps_RIGHT_half ()

end

function CowlFlaps_BOTH_close ()

	CowlFlaps_LEFT_close ()
	CowlFlaps_RIGHT_close ()

end

function CowlFlaps_LEFT_inc ()
    CF1var = ipc.readLvar("L:RECIP ENG COWL FLAP POSITION1Ant")

    if CF1var == 0 then
    CowlFlaps_LEFT_half ()
    elseif CF1var > 0 then
    CowlFlaps_LEFT_open ()
    end
    Duke_CowlFlap1_show ()
end

function CowlFlaps_LEFT_dec ()
    CF1var = ipc.readLvar("L:RECIP ENG COWL FLAP POSITION1Ant")

    if CF1var == 1 then
    CowlFlaps_LEFT_half ()
    elseif CF1var < 1 then
    CowlFlaps_LEFT_close ()
    end
    Duke_CowlFlap1_show ()
end

--

function CowlFlaps_RIGHT_inc ()
    CF2var = ipc.readLvar("L:RECIP ENG COWL FLAP POSITION2Ant")

    if CF2var == 0 then
    CowlFlaps_RIGHT_half ()
    elseif CF2var > 0 then
    CowlFlaps_RIGHT_open ()
    end
    Duke_CowlFlap2_show ()
end

function CowlFlaps_RIGHT_dec ()
    CF2var = ipc.readLvar("L:RECIP ENG COWL FLAP POSITION2Ant")

    if CF2var == 1 then
    CowlFlaps_RIGHT_half ()
    elseif CF2var < 1 then
    CowlFlaps_RIGHT_close ()
    end
    Duke_CowlFlap2_show ()
end

---

function CowlFlaps_inc ()
    CowlFlaps_LEFT_inc ()
    CowlFlaps_RIGHT_inc ()
end

function CowlFlaps_dec ()
    CowlFlaps_LEFT_dec ()
    CowlFlaps_RIGHT_dec ()
end


-- ## Other ###############

function DukeB60_XPDR_show ()

    XPDRvar = ipc.readLvar("L:XPDR_State")

    if XPDRvar == 0 then
    XPDRtext = "off"
    elseif XPDRvar == 1 then
    XPDRtext = "sby"
    elseif XPDRvar == 2 then
    XPDRtext = "tst"
    elseif XPDRvar == 3 then
    XPDRtext = "gnd"
    elseif XPDRvar == 4 then
    XPDRtext = "on"
    elseif XPDRvar == 5 then
    XPDRtext = "alt"
    end
    if _MCP1() then
      DspShow("XPDR", XPDRtext)
    elseif _MCP2() then

    DspRadioShort(XPDRtext)
    end
end

function DukeB60_XPDR_off ()

      ipc.writeLvar("L:XPDR_State", 0)
      DukeB60_XPDR_show ()
end

function DukeB60_XPDR_sby ()

      ipc.writeLvar("L:XPDR_State", 1)
      DukeB60_XPDR_show ()
end

function DukeB60_XPDR_tst ()

      ipc.writeLvar("L:XPDR_State", 2)
      DukeB60_XPDR_show ()
end

function DukeB60_XPDR_gnd ()

      ipc.writeLvar("L:XPDR_State", 3)
      DukeB60_XPDR_show ()
end

function DukeB60_XPDR_on ()

      ipc.writeLvar("L:XPDR_State", 4)
      DukeB60_XPDR_show ()
end

function DukeB60_XPDR_alt ()

      ipc.writeLvar("L:XPDR_State", 5)
      DukeB60_XPDR_show ()
end


-- XPDR inc

function DukeB60_XPDR_inc ()

	i = ipc.readLvar("L:XPDR_State")

	if i < 5 then
	ipc.writeLvar("L:XPDR_State", i+1)

	end

	if i == 5 then
	ipc.writeLvar("L:XPDR_State", 5)

	end
    DukeB60_XPDR_show ()
end

-- XPDR dec

function DukeB60_XPDR_dec ()

	i = ipc.readLvar("L:XPDR_State")

	if i > 0 then
	ipc.writeLvar("L:XPDR_State", i-1)

	end

	if i == 0 then
	ipc.writeLvar("L:XPDR_State", 0)

	end
    DukeB60_XPDR_show ()
end

function Master_Warning_Reset ()

	LVarSet = "L:MW_Reset"

	ipc.writeLvar(LVarSet, 1)
	DspShow("MSTR", "CLR")

end

function Yoke_Hide ()

	LVarSet = "L:DukeYokeVis"

	ipc.writeLvar(LVarSet, 1)
	DspShow("YOKE", "OFF")

end

function Yoke_Show ()

	LVarSet = "L:DukeYokeVis"

	ipc.writeLvar(LVarSet, 0)
	DspShow("YOKE", "ON")

end

function RXP_530_show ()

	-- shift + 2
	ipc.keypress(50,9)

end

Share this post


Link to post
Share on other sites

Great start.  I replaced mine and added some stuff...  

 

Added this to the system area...

 

function _lightOn(light)
    bits = ipc.readUW("0D0C")
    bits = logic.Or(light, bits)
    mask = ipc.writeUW("0D0C", bits)
end

function _lightOff(light)
    bits = ipc.readUW("0D0C")
    mask = logic.Xor(65535, light)
    bits = logic.And(mask, bits)
    mask = ipc.writeUW("0D0C", bits)

end

 

-- ## Deice ###############

function Both_Pitot_Heat_On ()
    ipc.writeLvar("L:Stall_Heat", 1)
    ipc.control( 66072, 1 )
end

function Both_Pitot_Heat_Off ()
    ipc.writeLvar ("L:Stall_Heat", 0)
    ipc.control( 66073, 1 )
end

function All_Deice_On()
    ipc.control(66338)
    ipc.sleep(500)
    ipc.writeLvar("L:Duke_Wshield_Heat", 1)
    ipc.writeLvar("L:fuelVentHeatL", 1)
    ipc.sleep(500)
    ipc.writeLvar("L:fuelVentHeatR", 1)
    DspShow("Icing", " all ")
end

function All_Deice_Off()
    ipc.control(66338)
    ipc.sleep(500)
    ipc.writeLvar("L:Duke_Wshield_Heat", 0)
    ipc.writeLvar("L:fuelVentHeatR", 0)
    ipc.sleep(500)
    ipc.writeLvar("L:fuelVentHeatL", 0)
    DspShow("Icing", " off ")
end

-- ## Annunciators ###############

function Annunciator_Test_On ()
        ipc.writeLvar("L:Main_Annun_Test", 1)
end

function Annunciator_Test_Off ()
        ipc.writeLvar("L:Main_Annun_Test", 0)
end

function Annunciator_Test_Momentary ()
        Annunciator_Test_On ()
      _sleep(400, 600)
        Annunciator_Test_Off ()
end

-- ## Lights ###############

 

function DukeB60_Landing_Lights_On ()

    _lightOn(4)

end

 

function DukeB60_Landing_Lights_Off ()

    _lightOff(4)

end

 

function DukeB60_Taxi_Lights_On ()

    _lightOn(8)

end

 

function DukeB60_Taxi_Lights_Off ()

    _lightOff(8)

end

 

function DukeB60_Panel_Lights_On ()

    _lightOn(32)

end

 

function DukeB60_Panel_Lights_Off ()

    _lightOff(32)

end

 

function DukeB60_Cockpit_Lights_On ()

    _lightOn(512)

end

 

function DukeB60_Cockpit_Lights_Off ()

    _lightOff(512)

end

 

function DukeB60_Wing_Lights_On ()

    _lightOn(128)

end

 

function DukeB60_Wing_Lights_Off ()

    _lightOff(128)

end

 

 

Added the following to Other section...

 

 

function DukeB60_PropSync_on ()
    ipc.writeUW("2EC8", "1")
    DspShow("EngSync", " on ")
end

function DukeB60_PropSync_off ()
    ipc.writeUW("2EC8", "0")
    DspShow("EngSync", " off ")
end
Should be pretty complete with that.  I wish we could have pressurization inc/dec commands.

 

Gregg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this