Archived

This topic is now archived and is closed to further replies.

CFG212 Michael

Cowl Flaps Realair Duke 60

Recommended Posts

I tried to use a copy of the  Linda Duke 60 Turbine Module for the new Duke 60 V2. After looking in the monitor I found that the Duke uses the values 0, 0.5 and 1 with the variable RECIP ENG COWL FLAP POSITION1Ant and RECIP ENG COWL FLAP POSITION2Ant for the cowl flaps positions CLOSE, HALF and OPEN.

 

I modified the lua file with the new values but there is no reaction when I use my buttons with the defined action. I also tried the variables with underscore instead of space.

 

Any idea what is wrong with the lua script?

 

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

-- oil cowl flaps closed

function Duke_Cowl_close ()

    ipc.writeLvar("L:RECIP ENG COWL FLAP POSITION1Ant", 0)
    ipc.writeLvar("L:RECIP ENG COWL FLAP POSITION2Ant", 0)
    DspShow ("Cowl", "clos")
end

-- oil cowl flaps half

function Duke_Cowl_half ()

    ipc.writeLvar("L:RECIP ENG COWL FLAP POSITION1Ant", 0.5)
    ipc.writeLvar("L:RECIP ENG COWL FLAP POSITION2Ant", 0.5)
        DspShow ("Cowl", "half")
end

-- oil cowl flaps open

function Duke_Cowl_open ()

    ipc.writeLvar("L:RECIP ENG COWL FLAP POSITION1Ant", 1)
    ipc.writeLvar("L:RECIP ENG COWL FLAP POSITION2Ant", 1)
        DspShow ("Cowl", "open")
end

function CawlFlaps_LEFT_open ()
        
    local buf = ipc.readLvar("L:RECIP ENG COWL FLAP POSITION1Ant") + 0.5

    if buf > 1 then buf = 1 end

    ipc.writeLvar("L:RECIP ENG COWL FLAP POSITION1Ant", buf)
        DspShow ("CowL", "open")
end

function CawlFlaps_LEFT_close ()
        
    local buf = ipc.readLvar("L:RECIP ENG COWL FLAP POSITION1Ant") - 0.5

    if buf < 0 then buf = 0 end

    ipc.writeLvar("L:RECIP ENG COWL FLAP POSITION1Ant", buf)
        DspShow ("CowL", "clos")
end
 
function CawlFlaps_RIGHT_open ()
        
    local buf = ipc.readLvar("L:RECIP ENG COWL FLAP POSITION2Ant") + 0.5

    if buf > 1 then buf = 1 end

    ipc.writeLvar("L:RECIP ENG COWL FLAP POSITION2Ant", buf)
        DspShow ("CowR", "open")
end

function CawlFlaps_RIGHT_close ()
        
    local buf = ipc.readLvar("L:RECIP ENG COWL FLAP POSITION2Ant") - 0.5

    if buf < 0 then buf = 0 end

    ipc.writeLvar("L:RECIP ENG COWL FLAP POSITION2Ant", buf)
        DspShow ("CowR", "clos")
end

function CawlFlaps_BOTH_open ()

    CawlFlaps_LEFT_open ()
    CawlFlaps_RIGHT_open ()
        DspShow ("Cwls", "open")
end

function CawlFlaps_BOTH_close ()

    CawlFlaps_LEFT_close ()
    CawlFlaps_RIGHT_close ()
        DspShow ("Cwls", "clos")
end
 

 

 

Thanks,

Michael

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hello,

 

seems the Duke Piston does not work like the Turbine in any aspects.

Great you found the LUA variables yourself, (they are also right) but these are just indicators of cowl flap state

 

I have to make a new module first, but I first have to wait that my replacement Combo will arrive.

 

But I have worked out the correct cowl flap code, you could copy and use it:

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

function Duke_CowlFlap1_show ()
    CF1var = ipc.readLvar("L:Duke_Cowl_Flaps_Switch_1")
    if CF1var == 0 then CF1txt = "clsd"
    elseif CF1var == 0 then CF1txt = "half"
    elseif CF1var == 0 then CF1txt = "open"
    end
    DspShow ("CwlL", CF1txt)
end

function Duke_CowlFlap2_show ()
    CF2var = ipc.readLvar("L:Duke_Cowl_Flaps_Switch_2")
    if CF2var == 0 then CF2txt = "clsd"
    elseif CF2var == 0 then CF2txt = "half"
    elseif CF2var == 0 then CF2txt = "open"
    end
    DspShow ("CwlR", CF2txt)
end

function Duke_CowlFlaps_show ()
    CF2var = ipc.readLvar("L:Duke_Cowl_Flaps_Switch_2")
    CF1var = ipc.readLvar("L:Duke_Cowl_Flaps_Switch_1")
    CFvar = CF1var + CF2var
    if CFvar == 0 then CFtxt = "clsd"
    elseif CFvar == 2 then CFtxt = "half"
    elseif CFvar == 4 then CFtxt = "open"
    end
    DspShow ("Cowl", CFtxt)
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 ()
    Duke_CowlFlaps_show ()
end

function CowlFlaps_BOTH_half ()

	CowlFlaps_LEFT_half ()
	CowlFlaps_RIGHT_half ()
    Duke_CowlFlaps_show ()
end

function CowlFlaps_BOTH_close ()

	CowlFlaps_LEFT_close ()
	CowlFlaps_RIGHT_close ()
    Duke_CowlFlaps_show ()
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

Can't say if the "_show" function is working currently if you use a combo.

Ignore it if not ...

Share this post


Link to post
Share on other sites