Jump to content
The simFlight Network Forums

Recommended Posts

Posted

(My apologies if this is not the right place to post this, please direct me)

FSX, SP2, registered copy of FSUIPC (ver 4.974), Windows 7.

 

I’m trying to setup a control panel for Manfred Jahn’s C47.  I have everything working except the start switches.  I actually have them so they do start the engines, but it behaves & sounds different than when I use my mouse to click on the switch.  It doesn’t seem to need primer, doesn’t start until I let go of the switch, and only an elect motor type sound while spinning until it starts.

 

I’ve tried numerous Lvars, FSX controls, offsets and many combinations. 

 

Anyone have this working or know what Lvars to use?

 

I’ve used both the Lua logging and the FSUIPC logging to try to see which vars are being used.  However, in both cases there are many that contain the word “start” or “eng” or other possible names.  I can’t make much sense of what I see.

Here’s what does start them.

111=CP(+B,6)B,26,Cx0200092A,x0004     ;Magneto Start

112=CU(+B,6)B,26,Cx0200092A,x0003     ;Magneto both

113=CP(+B,6)B,26,CM2:2,50             ;Starter switch 2 on

114=CU(+B,6)B,26,CM2:2,0              ;Starter switch 2 off

 

 

[Macros]

1=L:Starter switch:1=SET

2=L:Starter switch:2=SET

 

 

I’ve also tried:

21=L:Starter Switch:2_TMP=SET

22=L:DG_TFS_Starter_left1=SET

23=L:Startersound=SET

24=L:Checked ON-Starter=SET

 

 

Posted
15 minutes ago, Tom68 said:

i’m trying to setup a control panel for Manfred Jahn’s C47.  I have everything working except the start switches.  I actually have them so they do start the engines, but it behaves & sounds different than when I use my mouse to click on the switch.

A lot of the action, including sounds, may be handled internally to the gauge providing the switch.

16 minutes ago, Tom68 said:

I’ve tried numerous Lvars

Did you get a list of them before, from FSUIPC? 

Did you try monitoring them using the supplied Lua plug-in to do this. You can see in real-time when the change, so you know what values to try as parameters.

18 minutes ago, Tom68 said:

I’ve used both the Lua logging and the FSUIPC logging to try to see which vars are being used.  However, in both cases there are many that contain the word “start” or “eng” or other possible names.  I can’t make much sense of what I see.

Ah, was that the live monitoring Lua plug-in?

I assume you've tried FSUIPC mouse Macros? I know they don't work with many add-ons, but you don't know till you try.

21 minutes ago, Tom68 said:

Here’s what does start them.

111=CP(+B,6)B,26,Cx0200092A,x0004     ;Magneto Start

112=CU(+B,6)B,26,Cx0200092A,x0003     ;Magneto both

113=CP(+B,6)B,26,CM2:2,50             ;Starter switch 2 on

114=CU(+B,6)B,26,CM2:2,0              ;Starter switch 2 off

So, isn't that what you want?

23 minutes ago, Tom68 said:

[Macros]

1=L:Starter switch:1=SET

2=L:Starter switch:2=SET

 

 

I’ve also tried:

21=L:Starter Switch:2_TMP=SET

22=L:DG_TFS_Starter_left1=SET

23=L:Startersound=SET

24=L:Checked ON-Starter=SET

with "SET" you have to provide the value to be set as the parameter when you assign the macro. Otherwie you need to follow "Set" with ",n" to set the value n (decimal).

If all else fails to achieve exactly what yo want,  I think you need to talk to the add-on author.

Pete

 

 

Posted

Pete, thanks for your quick response. 

I did use the Lua plug-in to log the Lvars, but I can' t make sense out of all the stuff that happens when I toggle the switch.  And, yes I tried mouse macro's.  And I am setting the Lvars correctly; I've got everything else working using Lvars.

Thanks again.

Posted

Tom,

Did you get it work? If not, this may help.
Many times there is logic involved within the visual model on the clickspot.
When using the FSX or greater SDK to compile the model the XML animation / logic code is visible using a hex editor.
This is the case for the C-47, below is the retrieved code. (comments on engine 1)
Note that 0 = OFF & 50 = ON for the starter switch. Looks like he combined the animation and logic together.

<!-- STARTER 1 -->
<!-- TURN STARTER OFF AND QUIT ALL FURTHER CODE -->
(L:Starter switch:1, enum) 0 != if{ 0 (>L:Starter switch:1, enum) 0 (>L:Starterturn1, rpm) quit }
<!-- TURN STARTER ON BUT IF THERE IS NO POWER QUIT ALL FURTHER CODE -->  
50 (>L:Starter switch:1, enum) (A:Circuit general panel on, bool) ! if{ quit } 
<!-- IF ENGINE ACTUALLY FIRES (USING SOME SLOW START CODE) QUIT ALL FURTHER CODE -->
(A:PROP RPM:1, rpm) 0 > if{ quit }  
<!-- INITIALIZE THE SLOW START VISUAL CODE -->
(L:slowprop, rpm) (>L:Starterturn1, rpm) 

<!-- STARTER 2 -->
(L:Starter switch:2, enum) 0 != if{ 0 (>L:Starter switch:2, enum) 0 (>L:Starterturn2, rpm) quit } 
50 (>L:Starter switch:2, enum) (A:Circuit general panel on, bool) ! if{ quit }  
(A:PROP RPM:2, rpm) 0 > if{ quit } 
(L:slowprop, rpm) (>L:Starterturn2, rpm)

This may be a good candidate for lua but because of the "quit" the coding would have to be done carefully. May give it a try after some thought.

EDIT - decided to give it a go.. Here is a lua as a direct copy of the VC starter code - tested, seems good.
Note - during testing it was found that there are a few obscure bugs dealing with power supplied and the starter logic.
I kept any corrections out of it to keep the intentions of Manfred true. 
Code below and attached. 

--[[

1) With FS Closed, copy this code into a blank text file located in /modules and name it "MJC47_START.lua"
2) To use starter one, use the FSUIPC command "Lua MJC47_START" with a parameter of 1
3) To use starter two, use the FSUIPC command "Lua MJC47_START" with a parameter of 2

]]

local startSw = 0
local propSlow = 0
local propRpm = 0
local pnlPwr = 0

-- STARTER 1
if ipcPARAM == 1 then
	startSw = ipc.readLvar("Starter switch:1")
	if startSw ~= 0 then -- TURN OFF STARTER
		ipc.writeLvar("Starter switch:1", 0) -- PHYSICALLY MOVE SWITCH TO OFF POSITION
		ipc.writeLvar("Starterturn1", 0)		
	else  -- TURN ON STARTER
		ipc.writeLvar("Starter switch:1", 50) -- PHYSICALLY MOVE SWITCH TO ON POSITION
		propRpm = ipc.readDBL(0x2400)
		pnlPwr = ipc.readDBL(0x2840)
		if propRpm == 0 and pnlPwr ~= 0 then -- QUIT IF ACTUAL PROPS TURN BY FS CONTROLLED ENGINE OR NO PANEL POWER
			propSlow = ipc.readLvar("slowprop")
			ipc.writeLvar("Starterturn1", propSlow)  -- SLOW PROP TURNING INI
		end				
	end
end

-- STARTER 2
if ipcPARAM == 2 then
	startSw = ipc.readLvar("Starter switch:2")
	if startSw ~= 0 then -- TURN OFF STARTER
		ipc.writeLvar("Starter switch:2", 0) -- PHYSICALLY MOVE SWITCH TO OFF POSITION
		ipc.writeLvar("Starterturn2", 0)		
	else  -- TURN ON STARTER
		ipc.writeLvar("Starter switch:2", 50)  -- PHYSICALLY MOVE SWITCH TO ON POSITION
		propRpm = ipc.readDBL(0x2500)
		pnlPwr = ipc.readDBL(0x2840)
		if propRpm == 0 and pnlPwr ~= 0 then -- QUIT IF ACTUAL PROPS TURN BY FS CONTROLLED ENGINE OR NO PANEL POWER
			propSlow = ipc.readLvar("slowprop")
			ipc.writeLvar("Starterturn2", propSlow)  -- SLOW PROP TURNING INI
		end				
	end
end

 
 
Roman 

 

MJC47_START.lua

  • Like 1
Posted

Roman,  

I was aware of the starter switch as 0 & 50, but that wasn't enough; as you found out.  I wasn't aware of the XML code.  That is great to know, thanks.

I tried this and it works.

Thanks much for putting this much effort into helping,

Tom

 

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.