-
Posts
30 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Gallery
Downloads
Everything posted by Paja
-
Thank you Roman, saved me few moments 😉 Pavel
-
Thank you! That is probably the problem, that the L:var does not exist. Thank you! Pavel
-
Hello, What I am trying to do is to create Lvar that will contain a value from a FSUIPC offset. I need this in order to use this L:Var using Air Manager later on. I am tesing on simple dewpoint value: while 1 do dp = ipc.readSW("0E8E") ipc.display("dew point from offset"..dp/256) ipc.writeLvar("L:DEWPOINT", dp) dpL = ipc.readLvar("L:DEWPOINT") ipc.display("\n".."dew point from Lvar"..dpL) ipc.sleep(50) end Which returns error into FSUIPC log "2651078 *** LUA Error: ...s (x86)\Steam\steamapps\common\FSX\Modules\Meteo.lua:9: attempt to concatenate global 'dpL' (a nil value)" I am trying to .display both the values to check if the read and write is working. I will remove the display later on Do I need to introduce the L:DEWPOINT var before? --------------------------------------------------------------------------------------------------------------------------------------------- while 1 do dp = ipc.readSW("0E8E") ipc.writeLvar("L:DEWPOINT", dp) ipc.sleep(50) end With this minimalistic code there are no errors in the log, but the Air Manager seems to read "0.0" from L:DEWPOINT variable. Thank you! Pavel
-
I know about using the other computer to slave, standard thing. I was just thinking about using the lowcost Linux boards - but if it is not possible, ok - thanks for info. I will try Lua to send the data, thanks :) Pavel
-
Hello Pete, have you considered developing the WideClient for Linux? It would be very useful together with all those ultra cheap minimalistic Linux computers (Raspbery Pi, Arduino Yun, etc). They are small devices that can run simplistic version of Linux, so if we had WideClient on them, we could hopefuly access FSUIPC variables remotely via LAN - it would be easier than having ton of USB or RS232 devices connected to the flightsim computer with lot of their custom applications running... Pavel
-
I have never been completely sure about which of those "DBl, FLT, DD, SB, SD, etc) types should I read so I have done this small LUA file which will help you to decide. You just need to change the offset ID on the second line and then simply run this LUA in your FSX - you will see your offset being read as all the available types and you can decide which of them fits your individual needs. while 1 do offset = "132C" --write the Offset ID from FSUIUPC4 Offsets Status.pdf (eg. "132C") test1 = ipc.readDBL(offset) test2 = ipc.readFLT(offset) test3 = ipc.readDD(offset) test4 = ipc.readSB(offset) test5 = ipc.readSD(offset) --test6 = ipc.readSTR(offset, 4) -- Not used test8 = ipc.readUB(offset) test9 = ipc.readUD(offset) test10 = ipc.readUW(offset) ipc.display("testDBL="..test1.."\ testFLT="..test2.."\ testDD="..test3.."\ testSB="..test4.."\ testSD="..test5.."\ testSW="..test7.."\ testUB="..test8.."\ testUD="..test9.."\ testUW="..test10) ipc.sleep(50) end Attached you can see the result for testing NAV/GPS switch offset reading. I need 1 or 0 regaring the switch position so I will use probably the UB type which is the "simplest" format of the offset which yet matches my need to be 0 or 1 - however all those except DBL, FLT and DD give the same result so technically this is completely up to me which of the remainings I will use. Pavel Brodsky
-
Ok, got it working... Attached I am sending the easiest ever example of serial communication with arduino. Just paste the INO into your arduino and the LUA into your FSX/Modules and you will get parking brake LED working on the Arduino's onboard LED. dev = com.open("COM3", 9600, 0) function pkgbrake(offset, value) if value == 0 then com.write(dev, "g") else com.write(dev, "a") end end event.offset(0x0BC8, "UB", "pkgbrake") int strValue = 0; int light1 = 0; const int out1 = 13; void setup() { Serial.begin(9600); pinMode(out1, OUTPUT); } void loop() { if(Serial.available() > 0) { strValue = Serial.read(); } if (strValue == 'a') { digitalWrite(out1,HIGH); strValue = 'z'; } if (strValue == 'g') { digitalWrite(out1,LOW); strValue = 'z'; } } Hope that helps. Pavel
-
Hello, thank you very much for you effort, I will try it as soon as I get to my Arduino which is currently at home... Very appreciated! By the way, I found this project: https://code.google.com/p/arduino-fs/which seems to be doing it similar way, I will try investigating it a little bit... Regards, Pavel
-
Interesting - I have tried real time printing of the n variable to a ipc.display and it returns just 1, regardless if the line is "a" or "g" or if I specify the length parameter or not. I have googled it but the ONLY thing I could find is some VRInsignt MCP driver where autor uses the same name for handle name and for variable which openes the com.open and he does NOT save it to any variable like dev=com.write but he uses just com.write... I have tried it exactly as he did and the result was quite...weird :grin: Do you have any tips where to get more info about com.write in LUA? I cant find it on their website... I have tried lot of COM sniffing programs but all of them are unable to open the COM port while FSX (or Arduino terminal or whichever app) is communicating on that port with Arduino... My only and last hope is to find another computer with COM port, try to wire them together and log on the second computer what is my LUA actually sending to it (LUA wont know it is not arduino but computer, I hope) Pavel
-
That sounds like a good point however code handle = com.open("COM3",9600,0) --COM 3 opened, 9600bps, no handshake while 1 do com.write(handle,"a",1) ipc.sleep(500) com.write(handle,"g",1) ipc.display("overhead driver ok") end gives the same result - just RX led blinking (even if I tried it with spaces inside like (handle, "g" 1). I found out that Arduino in default settings has 8-N-1 mode (http://en.wikipedia.org/wiki/8-N-1) - is it the same for LUA? I can change this setting to any other mode in Arduino if required... Or maybe am I missing something when LUA Library pdf says that I should use n = com.write( ? What should I in my simple example place instead of n? Pavel
-
Well if I start the portmon.exe it says Not Connected even if I start it after or before the FSX with transmitting LUA plugin (or any other COM software like the COM terminal from Arduino) - have you experienced it? Or possibly could LUA debug to some file everything it has sent via COM? The arduino is receiving data correctly, it blinks every 500ms with RX LED but the orders dont work so LUA must be sending something else than just a and g there :sad: When I send a and g by COM terminal it works with my board... What does the "handle" word mean? Does my code send "handle a" or "a"? Pavel
-
Didn't know, thank you for info ;) Pavel
-
Ok, I did some testing with updated code: handle = com.open("COM3",9600,0) --COM 3 opened, 9600bps, no handshake while 1 do com.write(handle, "a") ipc.sleep(500) com.write(handle, "g") ipc.display("overhead driver ok") end which does something... the message appears, the script runs, the Receiving LED on Arduino blinks quickly, but the arduino is not receiving what it is expecting to (the "a" should turn on a LED, the "g" should switch the LED off - which works from any Serial terminal app, so the arduino code is correct). Is here any way how to log the outcoming traffic from LUA? Pavel
-
Hi Mickey, thank you for the link. However as I understand from it he was working with HIDs, not with "pure" COM port which I am trying to... Pavel
-
By the way is it a good idea to use both sending and receiving from COM port in a single LUA file?
-
Dear Pete, I am experimenting with direct communication between LUA and Arduino. If I suceed I would like to publish my results to give a cheap inputs/outputs to anybody who thinks that all those overpriced Opencockpits (and simillar) cards are just useless... I have my arduino programmed but I need some examples in LUA. Could you give me just a simple script which will be sending string "abc" always when it will be running? I mean - is my code acceptable? handle = com.open(3,9600,0) //COM 3 opened, 9600bps, no handshake com.write(handle, "abc") What does the word "handle" mean here? Is it variable name that can be changed, or what? The same for sending: handle = com.open(3,9600,0) //COM 3 opened, 9600bps, no handshake n = com.test(handle) my_received_data = com.read(handle,n) Is this way correct? I need just listen to COM port and when some string arrives from my arduino I need to store it into a variable... Thank you, Pavel
-
Writing to flight director offset from LUA
Paja replied to Paja's topic in FSUIPC Support Pete Dowson Modules
I wish I knew the number of times I got stuck with lua because of forgetting to use "" for strings. Thank you, solved! Pavel -
Writing to flight director offset from LUA
Paja posted a topic in FSUIPC Support Pete Dowson Modules
Dear Pete, I am trying to switch on and off the flight director from LUA. I am trying the ipc.writeSB(2EE0,1) command but it prevents the LUA file from running. Am I missing something? I still didnt understand properly how to work with different offsets. From the FSUIPC4 Offsets Status.pdf I see that the 2EE0 offset is long "4" but how do I know which type of offset it is? Is somewhere the lehgth - to - type conversion table? I mean even if you help me with this one, how do I know which types are other offsets I will need (alternators, antiice,...)? U understand what is the length of an offset, but when I try logging them in FS I see the result of this 2EE0 is simply 1 or 0, so I would guess it will be the easiest of all the types, hm? Pavel -
Roger, thank you again! By the way, is here any way how I can FSUIPC to scan certain joystick without having to map any action to one of its buttons? I mean I have for example one Leo Bodnar board with 32 switches attached and I want to work with all of them insude my LUA using ipc.testbutton - but I have nothing I could map to them via FSUIPC. Do I really have to map some useless function to one button on each of the Bodnar card or is here any better way how to make it visible for LUA? Pavel
-
Ok, thank you. I will give it a try. I tried killing them and starting one of them by FSUIPC key map to Lua OVERHEAD_SWITCH.lua (for example) which did the job but the FSX crashes sometimes (quite often). So yes, it is hazardous. Well - we are using them to interface inputs to FS from various joystick cards and also to send the information to arduinos (by the COM port) in the whole cockpit. We found out we have better results (smoother values received by arduino,...) when using multiple lua files (eg. one file for two engine instruments) then when using one big lua for all the engine instruments. We are a little bit in heaven of switches and needles (I am sure you know how DC9 cockpit looks like). Now we have 16 LUAs and I think the final result will be about 30. Pavel www.dc-9.eu
-
Hello Pete, do you know any simple way how we could restart all the running LUA scripts? I mean I am using a LOT of LUA stuff here (all of them added to FSUIPC.ini to sections [LuaFiles] and [Auto]. Now imagine that I have done some modifications via notepad in some of them. How can I restart all of them without having to restart the whole FSX (which takes ages)? Thank you, Pavel
-
Hello Pete, sorry for late reply, I have been busy with other works in our cockpit. I added an Auto section to my FSUIPC ini (should there be the .lua?) [Auto] 1=DC9AP The DC9AP.lua contains what you have recently posted here. Now I wonder how I should assign the axis to LuaValue <name of plug-in> - by writing somewhere in the FSUIPC.ini or by user interface in running FSX? I have tried it by [Axes] 1=0X,2520,LuaValue DC9AP as my joystick is 0 and the axis is X and the delta should be 2520. I also wonder if I should call the DC9AP.lua again in the LuaFiles section or if it is sufficient when it was pre-loaded by Auto. Actually it does something, after the airplane was loaded the turn knob was turned into some strange position (which can not be achieved by clicking the knob in cockpit), but it did not respond to the potentiometer. After moving the knob by mouse it returned to standard position where it stood regardless of the joy. What I think that even that the knob has 13 positions for mouse click, the variable values can be different from 1 - 13, dont you think? Maybe I should try first reading the dc9_ap_turn_knob value to determine the range... Thank you for your advice, Pavel Edit: I wanted to use the log lvars.lua for the range check of the variable, so I placed the file into the Modules folder, added to FSUIPC.ini - but where can I find the actual log with L variables?
-
To HIDdemo: so you think that I should write every button which number is higher than 31 to individual FSUIPC offset and then read those offsets when evaluating which buttons are pressed? Do i understand it right? Pavel
-
One possible solution for the high button numbers: I have a small utility which can trigger keyboard commands when all those buttons are pressed. So we can emulate keystrokes like (for example ctrl + alt + shift + Q) and let LUA read them instead of joystick buttons directly...? Pavel