reactorone Posted April 12, 2012 Posted April 12, 2012 Hi, I like to know if it is possible to operate a rotary encoder on the YAW TRIM (panel SAS)? I can not make it work with SIOC ... The code for this file clikabledata.lua : elements["PTR-SASP-YAW-TRIM"] = {class = {class_type.BTN, class_type.LEV}, hint = _("Yaw Trim"), device = devices.AUTOPILOT, action = {device_commands.Button_14, device_commands.Button_13}, arg = {192, 192}, arg_value = {0, 1}, arg_lim = {{0, 0}, {-1, 1}}, gain = {0, 0.1}, use_release_message = {true, false}} If someone can help me, I say a big thank you. :thumbup: Sorry for my bad English... R1
Duckling Posted April 12, 2012 Posted April 12, 2012 Hi R1 This works for me: (A 10k pot connected to one of the analog ports on the first USB expansion card) in SiocConfig LUA: [275] = {TruePotentiometer, 38, 13, 0.1}, -- PTR-SASP-YAW-INC In the .ssi file: Var 0275, name SAS_YAW_TRM, Link IOCARD_ANALOGIC, Input 1, PosL 0, PosC 127, PosR 255 // PTR-SASP-YAW-TRIM in ExportSupport.lua: function TruePotentiometer(pValue, pDevice, pNumber) GetDevice(pDevice):performClickableAction(pNumber + 3000,((pValue -127) /127)) end - - - -
whartsell Posted April 13, 2012 Posted April 13, 2012 A pot is really the best solution for the yaw trim. Unlike radio knobs you really want the absolute position of the knob. You can't do that with simple encoders. Your best and easiest solution is to pick up a pot between 10k and 100k and plus it directly into the iocards USB expander. If memory recalls there are 3 headers for pots If you use an encoder you will get into situations where the trim is out of sync with the knob Arduino,EOS and Helios Tutorial Static ATC menu mod
reactorone Posted April 13, 2012 Author Posted April 13, 2012 Hi, Thank you very much my friends! I will test this weekend. R1
reactorone Posted April 13, 2012 Author Posted April 13, 2012 Hi Duckling, Just one question, why [275] ? I thought of [3813] for device ID "autopilot" sorry for my ignorance, if you can explain to me. in SiocConfig LUA: [275] = {TruePotentiometer, 38, 13, 0.1}, -- PTR-SASP-YAW-INC Thanks you very much! :thumbup: R1
Duckling Posted April 14, 2012 Posted April 14, 2012 (edited) Hi R1. I use Oakes script as base, and the "275" is the SIOC Variable number. The line is siocsupport.lua [275] = .. 38,13.. and the actual value from SIOC is calculated within the exportsupport.lua function so in the end, the device ID 3813 with the value is what is used. # Tested using an Encoder for YAW Trim(same LUA function used as in earlier replay above). It works but problem is the encoders resolution per full turn. To get the hole span of 256 degrees (in example below) one needs to turn the encoders many times the full circle. Splitted it up in 5 steps increments to limit the physical movment of the nob itself and still needs to make allmost a full circle and not granular enough. On the other hand using a "round" knob or ignore the position of the pointer on the knob it still usable skipping the 5 incr below. Added a "push to synch" to center the setting. Var 0700, name SAS_YAWTEMP, Link IOCARD_ENCODER, Device 1, Input 39, Aceleration 1, Type 2 // TEMP TEST { L0 = &SAS_YAWTEMP * -5 &SAS_YAWT_act = LIMIT 0 ,255 ,L0 } Var 0701, name SAS_YAWT_act, Value 127 // temp Var 0702, name YAW_SYNCH_tmp, Link IOCARD_SW, Device 1, Input 41, Type I // YAW_SYNC_TEMP { &SAS_YAWT_act = 127 } Edited April 14, 2012 by Duckling - - - -
reactorone Posted April 15, 2012 Author Posted April 15, 2012 Thanks a lot Duckling ! you wanna be my teacher? :smartass: Have you managed to run a servo motor with DCS and SIOC, by example for flaps? I just installed mine for my landing gear panel and I'm looking for sample code to interface with DCS. Again thank you Duckling. :flowers: R1
Duckling Posted April 15, 2012 Posted April 15, 2012 Thanks R1. No servos yet. Just now reached the quads where to add these. Have to decline the teaching role though :) Far from skilled enough. Cheers Gus - - - -
Recommended Posts