FSX EVENT_ID with set functionality sets to zero [SOLVED]

Discuss suspected bugs with other users and Sim Innovations Staff

Moderators: russ, Ralph

Post Reply
Message
Author
flyatr
Posts: 300
Joined: Tue Dec 01, 2015 8:53 am

FSX EVENT_ID with set functionality sets to zero [SOLVED]

#1 Post by flyatr »

Hi, I have discussed this before in another topic (viewtopic.php?f=15&t=141) but I think this is a bug.

I have tried using a few different _set events. All of these will reset the respective variable to zero, e.g. when you turn the heading bug in fsx with the mouse, the command

Code: Select all

fsx_event("HEADING_BUG_SET",311)
will set it back to zero all the time no matter what parameter you supply.

These are the ones I tested: NAV1_STBY_SET, VOR1_SET, AP_VS_VAR_SET_METRIC, HEADING_BUG_SET

flyatr
Posts: 300
Joined: Tue Dec 01, 2015 8:53 am

Re: FSX EVENT_ID with set functionality sets to zero

#2 Post by flyatr »

Dear Sim Innovations staff, can you reproduce this?

User avatar
Ralph
Posts: 7917
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: FSX EVENT_ID with set functionality sets to zero

#3 Post by Ralph »

I still have to try. I'll do next week.

User avatar
Ralph
Posts: 7917
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: FSX EVENT_ID with set functionality sets to zero

#4 Post by Ralph »

The nav frequency is a tricky one, because you need to give it in a BCD format, which is quite complicated. However, I can also confirm that the other ones, like the VOR OBS and autopilot heading do not work. So that's one to fix in 2.1.2.

User avatar
Corjan
Posts: 2939
Joined: Thu Nov 19, 2015 9:04 am

Re: FSX EVENT_ID with set functionality sets to zero

#5 Post by Corjan »

Hi,


Just has a look in the code, and there seems like the argument was not being forwarded to FSX at all.
Add a fixed version as an attachment. Did not have time to test this, so it might still have issues.

Replace the existing dll in <fsx_dir>/Modules/Air Manager/AirManager.dll.


Let me know if this helps,

Corjan
AirManager.zip
(57.19 KiB) Downloaded 270 times

User avatar
Ralph
Posts: 7917
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: FSX EVENT_ID with set functionality sets to zero

#6 Post by Ralph »

It works!

Image

flyatr
Posts: 300
Joined: Tue Dec 01, 2015 8:53 am

Re: FSX EVENT_ID with set functionality sets to zero [SOLVED]

#7 Post by flyatr »

Confirmed, thanks. Now to the BCD format...

flyatr
Posts: 300
Joined: Tue Dec 01, 2015 8:53 am

Re: FSX EVENT_ID with set functionality sets to zero [SOLVED]

#8 Post by flyatr »

I turns out it's not that complicated. BCD means that each digit in a number is represented in a 4 bit binary code. Since lua has no binary datatype I figured I'd use hexadecimal and it worked on the first try!

The radio frequency has 5 digits. FSX assumes that the first is always 1 and so only the remaining 4 digits have to be send. Now best is an example. Let's set Nav1 to 110.95:

Code: Select all

fsx_event("NAV1_RADIO_SET",0x1095)
Individual numbers / digits:
1 - Nothing to do here, FSX assumes it
1 - in binary code this is 0001, hex 0x1
0 - in binary code this is 0000, hex 0x0
9 - in binary code this is 1001, hex 0x9
5 - in binary code this is 0101, hex 0x5

So we see we don't have to convert or calculate anything! Just take the numbers as they are, declare them as hex (0x...) and there you go.

flyatr
Posts: 300
Joined: Tue Dec 01, 2015 8:53 am

Re: FSX EVENT_ID with set functionality sets to zero [SOLVED]

#9 Post by flyatr »

I do it like this, maybe there's a better way:

Code: Select all

function frequency_to_hex_string(frequency)				-- pass as 110.95
	frequency = math.floor((frequency - 100) * 100)		-- remove the trailing 1 and decimal point
	return "0x"..tostring(frequency)					-- concatenate the hex identifier
end

f=108.50
fsx_event("NAV1_RADIO_SET",frequency_to_hex_string(f))

Post Reply