flatdog Posted September 10, 2010 Report Posted September 10, 2010 Has anyone managed to work out how to operate the autopilot altitude setting knob (Bendix King KFC 225) on the Real Air Simulations SIAI Marchetti SF260? I have all the other buttons, switches and knobs sorted but this one defeats me. I have followed guenseli's post on finding macros and logging LVars without much success. I am trying to operate the knob using a dual concentric rotary encoder via Leo Bodnar's BU0836X board. The com and nav radios are working perfectly. As a quick side note; many thanks to guenseli for all the information he has made available and also of course to Pete for FSUIPC which gets better and better. Philip
flatdog Posted September 10, 2010 Author Report Posted September 10, 2010 I have been going through the Lvars.log file again and have found: 302752 LUA: L:apAltDragStep=659 302798 LUA: L:apAltDrag=653 Assuming that these are correct and to keep things simple I would like to create two standalone .lua files, one to increase / decrease in 100's and one in 1000's. I think that the format would be something like ipc.writeLvar("L:apAltDragStep", 100) but would be very happy to receive some guidance. I have tried putting this line into a file called apAltSlow.lua and assigned a button to it but am not having much success. Thanks, Philip
Pete Dowson Posted September 10, 2010 Report Posted September 10, 2010 302752 LUA: L:apAltDragStep=659 302798 LUA: L:apAltDrag=653 How do those values (659 and 653) relate to what is going on? Any idea what the word "Drag" in these names has to do with it? doesn't seem an obvious name for what you want! You need to observe what happens to the variables whne changing the value on screen. Assuming that these are correct and to keep things simple I would like to create two standalone .lua files, one to increase / decrease in 100's and one in 1000's. I think that the format would be something like ipc.writeLvar("L:apAltDragStep", 100) That wouldn't change a value by 100 but set it to 100 instead. If you want to increment a value you'd have to READ it first, add the 100, then WRITE it back! I have tried putting this line into a file called apAltSlow.lua and assigned a button to it but am not having much success. I'm not surprised. Why not start a proper separate Lua file. Seems daft to insert a line into something designed to do something else. Regards Pete
flatdog Posted September 10, 2010 Author Report Posted September 10, 2010 The dual concentric knob 'on-screen' is operated by left dragging up and down with the mouse on the outer ring to increase / decrease 1000's and right dragging up and down on the inner ring to +/- 100's. There are quite a few instances of apAltDrag and apAltDragStep in the log file all with different values, I just included those two as an example. I perhaps naively assumed that they referred to autopilot altitude and a mouse drag. I had been dragging the knobs up & down while logging to try to find out what was happening but the values on screen were scrolling so fast that I couldn't be 100% sure what was happening. I had hoped that if I could get a button to set a value of 100 I would at least know that was on the right track.
Pete Dowson Posted September 10, 2010 Report Posted September 10, 2010 I had been dragging the knobs up & down while logging to try to find out what was happening but the values on screen were scrolling so fast that I couldn't be 100% sure what was happening. You can always examine the log file at your leisure. You don't need to rely only on the screen copy. Regards Pete
flatdog Posted September 11, 2010 Author Report Posted September 11, 2010 I have been on a bit of a wild goose chase with this. I started from scratch and used the various logging facilities again and found: 251177 *** EVENT: Cntrl= 66124 (0x0001024c), Param= 1000 (0x000003e8) AP_ALT_VAR_SET_ENGLISH 251177 *** EVENT: Cntrl= 66124 (0x0001024c), Param= 1000 (0x000003e8) AP_ALT_VAR_SET_ENGLISH 251239 *** EVENT: Cntrl= 66124 (0x0001024c), Param= 1000 (0x000003e8) AP_ALT_VAR_SET_ENGLISH 251239 *** EVENT: Cntrl= 66124 (0x0001024c), Param= 1000 (0x000003e8) AP_ALT_VAR_SET_ENGLISH 251302 *** EVENT: Cntrl= 66124 (0x0001024c), Param= 2000 (0x000007d0) AP_ALT_VAR_SET_ENGLISH 251364 *** EVENT: Cntrl= 66124 (0x0001024c), Param= 2000 (0x000007d0) AP_ALT_VAR_SET_ENGLISH 251426 *** EVENT: Cntrl= 66124 (0x0001024c), Param= 2000 (0x000007d0) AP_ALT_VAR_SET_ENGLISH 251489 *** EVENT: Cntrl= 66124 (0x0001024c), Param= 2000 (0x000007d0) AP_ALT_VAR_SET_ENGLISH I have assigned a button to AP_ALT_VAR_SET_ENGLISH with a parameter of 0. I had hoped that if I dialled in an altitude of say 2000 with the mouse and then pressed the button the altitude should be set to 0 but nothing happens. The log shows: ********* FSUIPC4, Version 4.623 by Pete Dowson ********* User Name="Philip Roberts" User Addr="pRoberts@nf-castings.co.uk" FSUIPC4 Key is provided WIDEFS7 not user registered, or expired [Continuation log requested by user] Running inside FSX on Windows Vista (using SimConnect Acc/SP2 Oct07) Module base=61000000 Wind smoothing fix is fully installed (Non relevant lines omitted) ....... 929407 [buttons.SIAI-Marchetti SF.260 Left Gold] 123=PD,0,C66124,0 929407 FS Control Sent: Ctrl=66124, Param=0 929641 Button changed: bRef=0, Joy=3 (D), Btn=0, Released I have also tried setting the parameter to 3000 but still no luck.
Pete Dowson Posted September 11, 2010 Report Posted September 11, 2010 I have assigned a button to AP_ALT_VAR_SET_ENGLISH with a parameter of 0. I had hoped that if I dialled in an altitude of say 2000 with the mouse and then pressed the button the altitude should be set to 0 but nothing happens. The log shows ... It's more important what the log doesn't show, and it doesn't show the EVENT resulting from your assigned button pressing. Try it on a default aircraft and you'll see what I mean. It looks like that aircraft is trapping that event for its own purposes. Regards Pete
flatdog Posted September 11, 2010 Author Report Posted September 11, 2010 OK so when I use the rotary encoder set up for the com radio I get: 16316643 Button changed: bRef=0, Joy=1 (B), Btn=14, Pressed 16316643 [buttons.SIAI-Marchetti SF.260 Left Gold] 40=CP(-B,8)B,14,C65637,0 16316643 .... Condition (-B,8) = TRUE 16316643 FS Control Sent: Ctrl=65637, Param=0 16316643 [buttons.SIAI-Marchetti SF.260 Left Gold] 45=CP(+B,8)B,14,C66437,0 16316643 .... Condition (+B,8) = FALSE 16316643 *** EVENT: Cntrl= 65637 (0x00010065), Param= 0 (0x00000000) COM_RADIO_WHOLE_INC .... and the digits on the screen change as expected. When I press the button set up to test the autopilot altitude knob I get: 16331651 Button changed: bRef=0, Joy=3 (D), Btn=0, Pressed 16331651 [buttons.SIAI-Marchetti SF.260 Left Gold] 123=PD,0,C66124,0 16331651 FS Control Sent: Ctrl=66124, Param=0 16331651 *** EVENT: Cntrl= 66124 (0x0001024c), Param= 0 (0x00000000) AP_ALT_VAR_SET_ENGLISH 16331822 Button changed: bRef=0, Joy=3 (D), Btn=0, Released ..... but the digits on screen (which I set to 1000 with the mouse before pressing the button) do not change. The log file looks OK .... I think? Regards, Philip
flatdog Posted September 11, 2010 Author Report Posted September 11, 2010 The correct control is AP_ALT_HOLD_VAR So with ipc.writeLvar("L:AP_ALT_HOLD_VAR", 1000) the button now changes the display to 1000. I now want to read the current value and increase it by 1000 so I have (in my SF160.lua file): if ipcPARAM == 3 then i = ipcreadLvar("L:AP_ALT_HOLD_VAR") ipc.writeLvar("L:AP_ALT_HOLD_VAR", i+1000) end alas this does not yet work but at least I am on the right track. The error is: ********* LUA: "SF160" Log [from FSUIPC version 4.623] ********* 5131590 System time = 11/09/2010 19:18:50, Simulator time = 17:57:15 (00:57Z) 5131590 LUA: beginning "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\SF160.lua" 5131590 *** LUA Error: ...Games\Microsoft Flight Simulator X\Modules\SF160.lua:16: attempt to call global 'ipcreadLvar' (a nil value) 5131590 LUA: ended "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\SF160.lua" 5131590 System time = 11/09/2010 19:18:50, Simulator time = 17:57:15 (00:57Z) ********* LUA execution terminated: Log Closed *********
Pete Dowson Posted September 12, 2010 Report Posted September 12, 2010 ..... but the digits on screen (which I set to 1000 with the mouse before pressing the button) do not change. The log file looks OK .... I think? Have you tested on a default aircraft? The control works fine on all of those. If it doesn't on this add-on aircraft it is because they've done their own thing. I'm sorry, but I cannot get every aircraft and hack into them all. FSUIPC supports all default controls. If you need to program others then you may have up to 4 choices: 1. Use any keyboard short-cuts the aircraft maker has provided 2. See if FSUIPC mouse macros work -- this depends on the gauges using C/C++ gauge SDK methods 3. See if you can do it via L:Vars, using a Lua plug-in. This often suits XML gauges. 4. Finally, resort to something like Key2Mouse (by Luciano Napolitano) to convert keypresses to mouse moves and clicks. Regards, Pete
flatdog Posted September 12, 2010 Author Report Posted September 12, 2010 Cracked it: if ipcPARAM == 4 then i = ipc.readLvar("L:AP_ALT_HOLD_VAR") ipc.writeLvar("L:AP_ALT_HOLD_VAR", i+1000) end if ipcPARAM == 5 then i = ipc.readLvar("L:AP_ALT_HOLD_VAR") ipc.writeLvar("L:AP_ALT_HOLD_VAR", i-1000) end if ipcPARAM == 6 then i = ipc.readLvar("L:AP_ALT_HOLD_VAR") ipc.writeLvar("L:AP_ALT_HOLD_VAR", i+100) end if ipcPARAM == 7 then i = ipc.readLvar("L:AP_ALT_HOLD_VAR") ipc.writeLvar("L:AP_ALT_HOLD_VAR", i-100) end I had missed out the "." in ipc.readLvar - tired eyes I guess. This needs more work because the AP should only go to 9000 ft and then return to 0 - but it works and I have learned a lot in the process. Thanks, Philip
Pete Dowson Posted September 12, 2010 Report Posted September 12, 2010 Cracked it Good! Well done! Pete
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now