Jump to content
The simFlight Network Forums

zuby

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by zuby

  1. I got it. Thank you very much Thomas Richter for your help and time
  2. Thanks Thomas Richter for your response. I read PMDG SDK ".h" file but did not find any numeric parameter that sets position of a switch, could you guide me further?
  3. Hello Paul, I'm using below code to on/off flight director switch in PMDG Aircraft. it's working in reverse order when i send parameter 1 it turns off to FD and 0 turns on, is it normal? or im using it wrong way? FSUIPCConnection.SendControlToFS(PMDGEvent.EVT_MCP_FD_SWITCH_L, 1);
  4. Oh!....I was understanding that it will be declared as an array....Now I understood :) Under of thanks Paul for your help and time.
  5. Thank you very much Paul...it's working...Now I'm initializing offsets like below, and grouped offsets. private static Offset<float> _AIR_SPEED; internal static void InitOffsets() { _AIR_SPEED = new Offset<float>("PMDG", 0x6524); } also i have question how do i declare left and right Backcourse for reading? below is the list of PMDG offsets mapping from pdf. but declaration not mentioned. could guide me. thanks 6520 4 WORD x 2 MCP_Course[2]
  6. Hello Paul, I'm receiving the error, "Communication With FSUIPC Faild Group ' ' does not exist.", when FSUIPCConnection.Process is called. when i declare offset into PMDG737MCP then program runs well. how do i resolve that issue? Here is the code below. class PMDGOffset { private static Offset<float> _AIR_SPEED = new Offset<float>(0x6524); public static float AIR_SPEED { get { return _AIR_SPEED.Value; } set { FSUIPCConnection.SendControlToFS(PMDGEvent.EVT_MCP_IAS_SET, (int)value); } } } class PMDG737MCP { public static void Update() { FSUIPCConnection.Process(); txt.Text = PMDGOffset.HEADING.ToString(); } }
  7. Hello Pete, I hope you will be gud...that problem was solved, and thank you very much. you guys awesome.
  8. Thanks Pete I did not know about that problem. thanks. Yes, I armed A/T First then enable Speed Hold. No, could tell me? is there a solution for that problem?
  9. Thanks Pete for your response. I enabled logging..now i'm receiving *** EVENT: Cntrl= 65860 (0x00010144), Param= 0 (0x00000000) AUTO_THROTTLE_ARM *** EVENT: Cntrl= 65891 (0x00010163), Param= 1 (0x00000001) AP_PANEL_SPEED_HOLD *** EVENT: Cntrl= 65918 (0x0001017e), Param= 0 (0x00000000) AP_MACH_HOLD as you can see in logged, first i turn on AUTO_THROTTLE_ARM, in 2nd line i press speed hold switch AP_PANEL_SPEED_HOLD, in 3rd i press C/O button. All I did in virtual cockpit by mouse. or without joystick. also C/O button working fine it's changing airspeed display value into decimal point. when i assign AP_MACH_HOLD to a joystick's button it does not change airspeed values into decimal point. I don't know why? I'm not using PMDG add-on. Thanks.
  10. Thanks aua668 for your response. it's a fsx aircraft, not pmdg.
  11. Hello Pete, How do i program C/O or IAS Mach Button with joystick...I did not find any offest or option in fsuipc to program that button....could you hep me how do i program?
  12. Hello Pete, Is this dual concentric rotary switch? could you attach that rotary pic?
  13. Thanks a lot Pete for your time and help. I'm glad now my rotaries and buttons are working gud. thanks again.
  14. Thanks Pete for guidance. now buttons are working fine I changed while loop limit to 4 in HIDemo.lua as you said. could you tell me? which parameter should i change in ini file? Ok. it means i need push button rotary that will change incremental value. will rotary encoder also miss some click? thanks Pete I liked this one its working. what would you recommend for trim wheel, rotary switch or multi turn pot?
  15. Thanks Pete your gud response. I will check to change while loop. then inform you. I mean when i attach Ap Spd Inc, from fs control, to rotary switch then rotate rotary knob air speed values do not increment smoothly...means rotary switch's 1 or two detentes pass without changes air speed values. is it rotary switch problem or programming bug?
  16. Thanks Pete for your response. It is 128 buttons HID joystick. Im using hiddemo.lua program. my joystick buttons matrix is 8x16. will the below program work fine with 8x16 matrix. Vendor = 0x03EB Product = 0x2043 Device = 0 Report = 0 Pollrate = 25 dev, rd, wrf, wr, init = com.openhid(Vendor, Product, Device, Report) if dev == 0 then ipc.log("Could not open HID") ipc.exit() end buttons = {} -- Up to 256 buttons = 8 x 32 bit words prevbuttons = { 0, 0, 0, 0, 0, 0, 0, 0 } function Poll(time) -- We use "readlast" so the values we use are the most up-to-date CurrentData, n, discards = com.readlast(dev, rd) -- Extract values we need if n ~= 0 then -- Now handle the buttons : up to 256 of them! buttons[1], buttons[2], buttons[3], buttons[4], buttons[5], buttons[6], buttons[7], buttons[8] = com.GetHidButtons(dev, CurrentData) -- check for changes i = 1 while i <= 8 do if buttons[i] ~= prevbuttons[i] then prevbuttons[i] = buttons[i] -- Send to FSUIPC as a set of 32 virtual buttons -- i.e. DWORD offsets 3340 onwards ipc.writeUD(0x3340 + ((i-1) * 4), buttons[i]) end i = i + 1 end end end ------------------------------------------------------------------------ if init then -- Deal with initial values, if supplied (some joysticks don't) ipc.log("init seen!") Poll(0) end if Pollrate == 0 then -- Ouch. Mustn't divide by zero! Pollrate = 25 end event.timer(1000/Pollrate, "Poll") -- poll values 'Pollrate' times per second it is a rotary switch here its diagram.
  17. Hello Pete, I made 8 axes and 128 buttons joystick. when i connect joystick it shows joy# 64 to 71 in fsuipc buttons/switches tab. is it normal? the joystick 0-31 buttons is working fine. but 32 to 127 is responding very slow. i don't know why? and rotary pulse switch is also skipping some values. i'm connecting a rotary on two buttons. pls guide me. thanks
  18. I got it....Thank you very much Pete for your help and time. Sorry for this.
  19. Hello Pete, Finally the below lua code is working now :). but "str = string.char(0,49)" char function's first argument must be 0 I dont know why? it does not work when i remove 0. and also guide me where should i use com.close(handle)? because i will use com.write function into offset event. if i use com.close after event then i need to reopen hid device. Under of Thanks for your help and time. local USB_DEVICE_VID = 0x1234 local USB_DEVICE_PID = 0x0001 Device = 0 -- Multiple devices of the same name need increasing Device numbers. Logging = false Report = 0 -- I *think* all joystick types use Input Report 0 dev, rd, wrf, wr, init = com.openhid(USB_DEVICE_VID, USB_DEVICE_PID, Device, Report) if dev == 0 then ipc.log("Could not open HID") ipc.exit() end local str = "" str = string.char(0,49) n = com.write(dev,str) ipc.log("return value = " .. n) com.close(dev)
  20. pete i tried that code but i'm not receiving values into my device..i don't know why?...also i showed you ipc log of that code.
  21. it means the code below is right for hid device? Vendor = 0x1234 Product = 0x0001 Device = 0 Report = 0 dev, rd, wrf, wr, init = com.openhid(Vendor, Product, Device, Report) if dev == 0 then ipc.log("Could not open HID") ipc.exit() end -- Finish HID Connect function call_speed (offset, value) com.write(dev,tostring(value), wr) end event.offset (0x07E2, "UW", "call_speed") -- aircraft speed
  22. Thanks for your reply Pete. I understood that how to write data to COM3 port....but I want to write data to HID Device. but how? I dont know. I think I can not use com.write for HID device. right?
  23. The purpose to show this library is that you can understand my problem easily...there is a proper documentation for luahidapi. Whereas how to use com.write with HID, there is no example file or documentation to use that function. Could you give me HID code example for com.write. or how do i use com.write for HID? yes the id ownded by "Technical Corp" but I'm using default HID example program (that has 0x1234 VID) of mikroc. Thanks for your reply.
  24. Thanks Pete for your response. I did not know that. thanks for your information. Here is the luahidapi library link: https://github.com/ynezz/luahidapi here is the working code of luahidapi...I copied luahidapi.dll into "Modules/lua", also copied hidapi.dll and lua51.dll into "Modules/dll" folder local hid = require "luahidapi" local sfmt, sbyte, schar, srep = string.format, string.byte, string.char, string.rep ------------------------------------------------------------------------ -- initialize ------------------------------------------------------------------------ if not hid.init() then print("hid library: init error") return end --====================================================================-- --** WARNING: Test uses Microchip's VID and a PID from MPLAB tools' ** --** PID range. DO NOT use outside of a laboratory/personal setting. ** --====================================================================-- local USB_DEVICE_VID = 0x1234 local USB_DEVICE_PID = 0x0001 local USB_REPORT_SIZE = 64 local dev = hid.open(USB_DEVICE_VID, USB_DEVICE_PID) if not dev then print("Open: unable to open test device") return end function addpadding(str) local length = string.len(str) for i=length, 7 do str = str .. " " end return str; end function call_speed (offset, value) local tx = "" tx = tx .. tostring(value); hidwrite(tx) end function hidwrite (buffer) buffer = addpadding(buffer) buffer = srep(buffer, USB_REPORT_SIZE / 8) local res = dev:write(buffer) if not res then print("Unable to write()") print("Error: "..dev:error()) return end end -- FSX events event.offset (0x07E2, "UW", "call_speed") -- aircraft speed after that I read that air speed value into joystick code (that i wrote in mikroc) and display that value to 7 segment LED. yes those are correct. getting from to run a program named "hid scanner.exe" I was thinking that com.write works like luahidapi. besides above conversation could you guide me? How do i display air speed value to 7 segment LED without serial communication?
×
×
  • 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.