GSalden Posted May 16, 2014 Report Share Posted May 16, 2014 After 2 years of building I almost finished my Ifly 737 NG home cockpit. I am currently fine tuning the hardware. My question is about using the AT modes. Mt tq has Phidget hardware and I use Fs2Phidget to control it. Servos are driving the levers. However with power on , it is not possible to move the levers manually. Therefore I want to use 3 relays. Software setup : Ifly Cockpit Builders Edition | Ifly2FSUIPC | FSUIPC | Fs2Phidgets Ifly2FSUIPC Offset 94DE : 0 : blank / 1 : N1 / 2 : GA / 3 : Retard / 4 : FMC Spd / 5 : MCP Spd / 6 : THR Hld / 7 : ARM Values 0 and 7 : AT not commanding throttles Values 1 to 6 : AT commanding throttles Unfortunately there is no explanation in the Fs2Phidgets manual on how to use multiple offset values with some values being on and others being off. I have tried asking it at the Fs2Phidget forum but no respond. Now I am stuck with the fact that Fs2Phidget can read only an offset without multiple variable. So I was thinking if FSUIPC could help in this was. Is it possible to have FSUIPC read offset 94DE with values 1-6 and then sent a new offset to Fs2Phidget without variables, simply on/off When FSUIPC reads pffset 94DE with values 0 or 7 it does nothing. In Fs2Phidget I can use this offset to control 3 relays to connect/disconnect the power to the servos. Thanks in advance. Link to comment Share on other sites More sharing options...
Thomas Richter Posted May 16, 2014 Report Share Posted May 16, 2014 Hi, just check Lua for that. You will find lots of examples for use and of course a manual in FSUIPC download section. 1 Link to comment Share on other sites More sharing options...
GSalden Posted May 16, 2014 Author Report Share Posted May 16, 2014 Thanks for the reply, but this is not just a simple lua plugin Link to comment Share on other sites More sharing options...
Thomas Richter Posted May 16, 2014 Report Share Posted May 16, 2014 Hi, Thanks for the reply, but this is not just a simple lua plugin Lua is a programming language and a script / plugIn you write runs in FSUIPC. So with couple if ... then .. end you can catch the Offset with value 0 to 7 and write to an free offset of your choice the bool value ON/ OFF that will be handled in FSPhidgets. So read offset, decide the result for the new Offset (ON/OFF) and write that to this Offset. read Offset_IN If ((Offset_IN > 0) and (Offset_IN < 7)) then Offset_OUT = 1 else Offset_OUT = 0 endif write Offset_OUT This is not exactly what you write in Lua but close to, check the correct Lua-syntax. It is really not more needed than that, value 0 and 7 results in OFF (0) and any inbetween results in ON (1). Link to comment Share on other sites More sharing options...
GSalden Posted May 16, 2014 Author Report Share Posted May 16, 2014 Thanks for your help I will try and let you know. Link to comment Share on other sites More sharing options...
GSalden Posted May 17, 2014 Author Report Share Posted May 17, 2014 The Fs2Phidgets software is running on my client pc. The LUA manual is very overwhelming with information. Lots of examples and commands , so for me it is very difficult to see which one is needed. Some commands are almost the same. Is it correct that on my client pc I have to have Initial.lua and the AT lua in the FSUIPC folder on my server ? The offset to read is 94DE with 8 values.. Is the read command I have to use : ipc.read.... ( Then I see SW / UB / UD / UW ? ) With the write command is this like : ipc.write ( SW / UB / UD / UW ) ? Thanks in advance. Link to comment Share on other sites More sharing options...
Thomas Richter Posted May 17, 2014 Report Share Posted May 17, 2014 Hi, SW / UB ... is the size/Type of offset you want to read or write to, e.g. UB = Unsigned Byte. There is no action needed on both, FSUIPC and WideClient. When you want to place the Lua plugin on the client then just place the file in the WideClient folder and WideClient will start it automatically when FS connects. There are also different start options (described in the manual) but that is the easiest one. As you can see it is not a big deal ... -- Initializing flags -- val=0 -- Convert AT value from 0 to 7 to 1/0 function atIn(offset, value) if (value>0) and (value<7) then val=1 else val=0 end ipc.writeUB(0x66C0,val) end -- AT Command value 0 to 7 event.offset(0x94DE,"UB","atIn") Offset 66C0 is in a FREE range of Offsets. The file to place in WideClient folder you can get from this link, just unzip and drag. AT_Convert.lua Link to comment Share on other sites More sharing options...
GSalden Posted May 17, 2014 Author Report Share Posted May 17, 2014 Many thanks Thomas. Link to comment Share on other sites More sharing options...
GSalden Posted May 23, 2014 Author Report Share Posted May 23, 2014 After some small hardware mods the tq is ready for testing. Today I am going to do that. If I put the lua file on the client , do I stil lhave to add it in the fsuipc.ini file ? Link to comment Share on other sites More sharing options...
Pete Dowson Posted May 23, 2014 Report Share Posted May 23, 2014 After some small hardware mods the tq is ready for testing. Today I am going to do that. If I put the lua file on the client , do I stil lhave to add it in the fsuipc.ini file ? No. Lua plug-ins paced in the same folder as WideClient are run automatically -- there's no need to do anything in the WideClient.INI file, and the FSUIPC.INI file is only relevant to the FS PC, FSUIPC knows and cares nothing about Client plug-ins. If it doesn't appear to be working, check the WideClient folder for a Log file with the plug-in name. That will detail any errors found. Pete Link to comment Share on other sites More sharing options...
GSalden Posted May 23, 2014 Author Report Share Posted May 23, 2014 Thanks Pete . The support I am getting from you and Thomas is outstanding. :razz: Link to comment Share on other sites More sharing options...
GSalden Posted May 24, 2014 Author Report Share Posted May 24, 2014 Unfortunately I do not get it to work. In the AT_convert.log file it says : LUA: ÄT_Convert"Log{from WideClient] Date (dmy): 24/05/14, Time 10:07:24.037: Client name is SKANDER-PC 5709 LUA: beginning"C\WideFs\AT_Convert.lua" That looks good to me. In the Fs2Phidget software I took the Autopilot Master Switch and changed the offset to 66CO. It is just a name for the switch with an on/off status and bit length of 4 bytes : [AUTOPILOT_MASTER_SWITCH] Offset=66C0 Length=4 FSType=Digital Offvalue=0 Onvalue=1 LogicVar=False FunctionVar=False SpecialFunction=0 Format=###0 Multiplier=1 Divisor=1 Integer=False NormalAngle=False IRS=False WriteOnly=False Enable= To check I also used 1 for off and 0 for on, but also no result. In the Ifly2FSUIPC doc it says that the size for othe AT mode is 1. All suggestions are welcome Link to comment Share on other sites More sharing options...
Pete Dowson Posted May 24, 2014 Report Share Posted May 24, 2014 In the Fs2Phidget software I took the Autopilot Master Switch and changed the offset to 66CO. It is just a name for the switch with an on/off status and bit length of 4 bytes : ... In the Ifly2FSUIPC doc it says that the size for othe AT mode is 1. Why 4 bytes when you are told it is one byte and you are reading and writing one byte? Isn't that a bit obtuse? ;-) And when testing things involving offsets, please use the tools available to see what is going on: FSUIPC logging tab, right-hand side. monitor offset 66C0 as type U8 and offset 94DE also as type U8. Select "Normal log" below. FSUIPC will then log all changes to those two offsets. I'm afraid I'm no help with either iFly2FSUIPC or FS2Phidget, so if the offsets are working correctly, you'll need help elsewhere I think. Like a value which can be on or off is a "LogicVar"? Maybe? Pete Link to comment Share on other sites More sharing options...
GSalden Posted May 24, 2014 Author Report Share Posted May 24, 2014 Pete, again you have pointed me into the right direction ! By monitoring the offsets and making small changes in Fs2Phidget I was able to get my 0/16/16 IO board work. The 3 relais controlling the power to the 2 throttle levers and the speedbrake lever are working. The offset driving the levers was already working Thank you very much :razz: :razz: :razz: Link to comment Share on other sites More sharing options...
GSalden Posted September 12, 2015 Author Report Share Posted September 12, 2015 Hello team, This weekend I hope to finish my home cockpit. I was just doing some testing and found out that the 3 relais that give power to the 3 servos loose their power given by the Phidget 0/16/16 card. To be sure that the lua script I placed in the client's WideFs folder here how it looks : -- Initializing flags --val=0-- Convert AT value from 0 to 7 to 1/0function atIn(offset, value)if (value>0) and (value<7) thenval=1elseval=0endipc.writeUB(0x66C0,val)end-- AT Command value 0 to 7event.offset(0x94DE,"UB","atIn") Did I forget something ? The AT has 7 modes. Mode 0 en 7 need the servos to be non powererd, while mode 1 - 6 need them powerered. Offset 0x66C0 is a free offset that when set to 1 will give signal to Fs2Phidget and that will give power to the relais so it opens and give power to the servo. Offset 94DE is the AT mode in Ifly2Fsuipc. Thanks in advance. Link to comment Share on other sites More sharing options...
Pete Dowson Posted September 12, 2015 Report Share Posted September 12, 2015 The AT has 7 modes. Mode 0 en 7 need the servos to be non powererd, while mode 1 - 6 need them powerered. Offset 0x66C0 is a free offset that when set to 1 will give signal to Fs2Phidget and that will give power to the relais so it opens and give power to the servo. Offset 94DE is the AT mode in Ifly2Fsuipc. Well, as far as I can see, the Lua program will be doing what you ask of it. so you need to debug the actual offsets. Have you logged them? You can use the FSUIPC Monitor facilities on the FS PC, or the Monitor parameter in the WideClient.INI file. Also always check the Wideclient folder for a Log with the name of your Lua file. That will (1) show when it last ran, and (2) contain details of any errors which stop it working. Pete Link to comment Share on other sites More sharing options...
GSalden Posted September 12, 2015 Author Report Share Posted September 12, 2015 Thanks again for the fast support. I just saw that the speedbrake sometimes give signal and it gives an armed mode. That probably is AT mode 7 so it deactivates the power to the servos. Regards Gerard Link to comment Share on other sites More sharing options...
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