Jump to content
The simFlight Network Forums


  • Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About zuby

  • Rank

Profile Information

  • Gender
  • Location

Recent Profile Visitors

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

  1. Hello Pete, Is this dual concentric rotary switch? could you attach that rotary pic?
  2. Thanks a lot Pete for your time and help. I'm glad now my rotaries and buttons are working gud. thanks again.
  3. 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?
  4. 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?
  5. 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.
  6. 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
  7. I got it....Thank you very much Pete for your help and time. Sorry for this.
  8. 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)
  9. 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.
  10. 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
  11. 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?
  12. 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.
  13. 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?
  14. i think diagram will be like this
  15. oh i forgot to mention that i read HidDemo.lua, com.write or com.writefeature function was not used in that file.

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.