Jump to content
The simFlight Network Forums

cheeseburger

Members
  • Posts

    14
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Slovakia

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

cheeseburger's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Of course, no problem sir. Yeah, I tried use fixed length, but it will be better for me, if I could use different length blocks :) Thank you.
  2. Hello sir, is possible to check problem which I mentioned? Thank you in advance :)
  3. Hi folks, I am trying change altitude on MCP by rotary encoder, unfortunately I am not sure if I send to ipc.control correct data ipc.control(70032, altitude) value in altitude is correct, I have there (100,200....1000,1100.......12000....) It works only for first three hundred, and then even though I change altitude value by rotary, the value on MCP will not change. Could someone help me? Thank you. EDIT: I tried to send it real altitude /100. This works fine, but only for increasing altitude. If I turn with rotary to anti-clockwise position, the value is decreasing, but altitude on MCP in FSX is still increasing. EDIT2: Solved, I don't know why, but if I send there ipc.control(70032, 536870912) it is decreasing. EDIT3: Sorry, I have one more problem. When I send there real altitude, it is increasing till 35700. Why? I also noticed when I quick turning with rotary the value which I send to ipc.control is e.g. 2100 but it sets only 2000.
  4. If you set it by LUA script, use this. ipc.control(69749, 536870912) Always when you call this function it will be turning off/on/off/on...
  5. No problem, I will remind it to you. thank you once more :)
  6. This is my LUA and arduino code: serial_wait = 100 dev = com.open("COM3", 921600, 0) --com, speed, handshake if dev == 0 then ipc.display("Could not open device port") ipc.exit() end function readSerial(handle, string) ipc.log("com: " .. string) end event.com(dev, 16, 1, '\n', "readSerial") void writeOffset(const char* controlName, int value){ char sendData[16]; sprintf(sendData, "%s:%d\n", controlName, value); Serial.write(sendData); Serial.flush(); } This is what I get when I quick turning rotar .. 6516162 LUA.0: com: alt:5400 alt:550 6516178 LUA.0: com: 0 alt:5600 alt:5 6516193 LUA.0: com: 700 alt:5800 alt 6516224 LUA.0: com: :5900 alt:6000 a 6516240 LUA.0: com: lt:6100 .. I don't know if it was only luck that it works at morning, or I didn't turn it so quick. I didn't change source code. I don't understand, what do you mean by this Thank you so much for you advices. EDIT: I made simple arduino sketch with only one rotar. #include "rotary.h" Rotary r = Rotary(6, 7); int encoderPosCount = 0; void setup() { Serial.begin(115200); Serial.flush(); //Serial.println("Rotary Encoder Debounce"); } void loop() { char result = r.process(); if (result) { if (result == DIR_CCW) encoderPosCount--; if (result == DIR_CW) encoderPosCount++; Serial.println(encoderPosCount*100); Serial.flush(); } } as well as LUA dev = com.open("COM3", 115200, 0) function readSerial(handle, string) ipc.log("com: " .. string) end event.com(dev, 16, 1, '\n', "readSerial") I get same incorrect data. I will get sometimes more than one block. 7848083 LUA.0: com: 19500 7848130 LUA.0: com: 19600 7848192 LUA.0: com: 19700 19800 19 7848223 LUA.0: com: 900 20000 7848255 LUA.0: com: 20100 There is some problem with maintaining block, even though I use '\n' in event.com. I really dont know... :(
  7. Thank you very much. I think my previous problem is solved, but there is one more. When I quickly turning rotary encoder, I get something like this 1266526 LUA.0: com: alt:6300 1266931 LUA.0: com: alt:6400 alt:6500 1266994 LUA.0: com: alt:6600 alt:6700 1267025 LUA.0: com: alt:6800 I still only read the strings. It seems like I get two string at once. Is this normal or not? At morning it works great, but now it is again bad :/
  8. I use Arduino UNO. There is possibly use only one serial. However I use software serial ( https://www.arduino.cc/en/Tutorial/SoftwareSerialExample ) , so I connected second arduino, and send string at the same time to serial link(FSUIPC) and to other Arduino. Data from second arduino I read by putty terminal. I agree 10 000 is very much, I have only tried it if it will change something in my problem. I will try use terminator in event.com. I would like to have one more question. Which baudrate do you recommend? In documentation is mentioned 115200 for VRInsight, also 4800 or 9600. I use own pushbuttons, rotary encoders and I want to use SPI segment displays. Thank you very much :)
  9. Thank you, I noticed one strange thing and maybe where is problem. Now I tried in FSUIPC only read the strings without any reaction. When I send some string to serial link from arduino, sometimes I get only "alti" or something similar as I said. Problem is that next part of string "meter:1000" I get when I turn with rotar again, and usually i get rest of string with new one - "meter:1000\naltimeter:1100". The problem is in LUA script, because I tried to send strings also to other COM port at the same time, and strings are correct, only in LUA are incorrect. This is my code in LUA. serial_wait = 100 dev = com.open("COM3", 9600, 0) --com, speed, handshake if dev == 0 then ipc.display("Could not open device port") ipc.exit() end serial_string = "" function readSerial(handle, string) serial_string = serial_string .. string ipc.log("com: " .. serial_string) n = com.test(dev) ipc.log("DATA AVAIL: " .. n) while(com.test(dev)>0) do ipc.log("READ NEXT DATA...") news, num = com.read(dev, 10000, 10) ipc.log("NEXT DATA " .. news) serial_string = serial_string .. news end ipc.log("SerialString: " .. serial_string) end event.com(dev, 10000, 1, "readSerial") also com.test is always 0, why? Is any chance how to solve it? :/ Thank you very much.
  10. Thank you for you replies. :) I tried to connect rotary encoder, and I have a same problem, so it will be problem somwhere in serial communication. I will try to detect some special char, unfortunately I am not sure if I know how to read by char for serial link in LUA script.
  11. Sorry for my late reply. Of course it does not matter how the log looks. This part of code which I posted here, should be push button for parking brake. Unfortunately, when I get by serial link to FSUIPC something like this "br" or "ake:1" LUA script does not know, what is it and what to do. Thank you in advance :)
  12. Hi folks, I work on MCP based on Arduino. I read/write offsets through FSUIPC by LUA script. Unfortunately I have one problem. I tried to explain it with parking brake. I have on push button. The code in arduino: ... void pushButton(){ button = digitalRead(prkgbrake); if (button == HIGH && exbutton == LOW && millis() - last > ddelay){ Serial.write("brake:1\n") while( digitalRead(prkgbrake) == HIGH){ } } } ... and this is LUA script .... x = com.open("COM3", 115200, 0) function offset(handle, str) ipc.log(str) end event.com(dev, 20, 1, 0, "readSerial") The problem is that if I push several times push button I get at first correct messages brake:1 brake:1 brake:1 brake:1 but then I get something like that brake:1 br ake:1 brake:1brake:1 brak e:1 Could someone help me where is the problem, and how to solve it? Thank you in advance
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.