Jump to content
The simFlight Network Forums

Recommended Posts

Posted (edited)

Hi,

The code below doesn't work, and i don't understand why. GearStateVal value is send to Gearr_Down_Up function, and is compared to a var called GearState. Values of both vaqrs are shown with ipc.display, and are right. So why the comparison will never work ? If values of 16383 or 0 are sent, the comparison work and it will work. If vGearValState is sent, with values of 16383 or 0, it will not work ... 

Why ? 0 is 0 ... and 16383 is 16383 ...

Thank you for your help ...

 

Regards,

Oliver

function Gear_Lever()
	gear_nose=ipc.readUD(0x0BEC)
	gear_left=ipc.readUD(0x0BF0)
	gear_right=ipc.readUD(0x0BF4)
	GearStateVal = gear_nose + gear_left + gear_right
	
	Gear_Down_Up(GearStateVal)
end
	

function Gear_Down_Up(GearStateVal)    
    -- Gear_Lever_DOWN bit : 2^19= 524288
	-- PDMG EVT_GEAR_LEVER (69632 + 768)
    testVar = ipc.readUD(0x3360)
	dev = ipc.get("dev")
	wrf = ipc.get("wrf")
	
    if logic.And(testVar,0x80000) ~= 0  then
		gear_nose=ipc.readUD(0x0BEC)
		gear_left=ipc.readUD(0x0BF0)
		gear_right=ipc.readUD(0x0BF4)
		GearState = gear_nose + gear_left + gear_right			
		ipc.control(66080,16383)	-- OFFSET FSX OK
				
		while GearState ~= GearStateVal do
						
			gear_nose=ipc.readUD(0x0BEC)
			gear_left=ipc.readUD(0x0BF0)
			gear_right=ipc.readUD(0x0BF4)
		    GearState = gear_nose + gear_left + gear_right	
			ipc.display("RUN --> N : " .. gear_nose .." L : " .. gear_left .. " R : " .. gear_right .. "\n"
					   .. "        GearStateVal : " .. GearStateVal) --.. " / GearState : " .. state)			
			s = string.char(0,56)
			com.writefeature (dev, s, wrf)
			
		end
	end
end	

 

Edited by odrezet77
I Was looking a way to delete this post (it was an error)

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.