Jump to content
The simFlight Network Forums
Sign in to follow this  
rustam

Elevation trim offset (xBC0): Min / Max values

Recommended Posts

As far as I can trace in the event log, by default the controls 65607 and 65615 has max step of 31. Therefore, I'm trying to implement the following code to bypass default values with step 256/16384:

-- Elevator Trim -------------------------------------------------------------------------

if ipcPARAM == 890 then				--	Up

	local val = ipc.readSW(0x0BC0)
	local newval = val + 256
	
	if newval > 16383 then
		ipc.writeSW(0x0BC0,16383)
		ipc.writeLvar(soundSet,0)
	else 
		ipc.writeSW(0x0BC0,newval)
		ipc.writeLvar(soundSet,10)
	end
	
end

if ipcPARAM == 891 then				--	Down

	local val = ipc.readSW(0x0BC0)
	local newval = val - 256
	
	if newval < -16383 then
		ipc.writeSW(0x0BC0,-16383)
		ipc.writeLvar(soundSet,0)
	else 
		ipc.writeSW(0x0BC0,newval)
		ipc.writeLvar(soundSet,10)
	end
	
end

But it seems strange that when I reach 0 (zero) trimming down the elevator, instead of switching to negative values, the offset values start counting down from 65536, as shown in the image below, whereas in the List of Offsets it's clearly stated that elevator trim control input at offset xBC0 ranges from –16383 to +16383 being of type signed word (SW). Or, am I getting smth wrong?! :)

 

ga55cjp.jpg

 

Thanks!

 

Rustam

 

Share this post


Link to post
Share on other sites

But it seems strange that when I reach 0 (zero) trimming down the elevator, instead of switching to negative values, the offset values start counting down from 65536, as shown in the image below, whereas in the List of Offsets it's clearly stated that elevator trim control input at offset xBC0 ranges from –16383 to +16383 being of type signed word (SW). Or, am I getting smth wrong?!

 

As the image shows, you are logging the value as a UW, Unsigned word! The values over 32767 will actually be negative. It's all in the interpretation -- you are just displaying them wrongly!

 

Pete

  • Upvote 1

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  

×

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.