zuby
-
Posts
39 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Gallery
Downloads
Posts posted by zuby
-
-
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?
-
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);
-
Oh!....I was understanding that it will be declared as an array....Now I understood :)
Under of thanks Paul for your help and time.
-
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] -
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(); } }
-
Hello Pete,
I hope you will be gud...that problem was solved, and thank you very much. you guys awesome.
-
Ok Pete, Thanks alot for your guidance nd time.
-
Thanks Pete
5 minutes ago, Pete Dowson said:Nor do I, but I seem to recall that this was a problem with FS dating way back.
I did not know about that problem. thanks.
7 minutes ago, Pete Dowson said:tell me, did you Arm the A/T and enable Speed Hold first?
Yes, I armed A/T First then enable Speed Hold.
9 minutes ago, Pete Dowson said:Have you asked in the AVSIM FSX support forum?
No, could tell me? is there a solution for that problem?
-
Thanks Pete for your response.
On 6/24/2018 at 3:24 PM, Pete Dowson said:I'm not sure. did you try using FSUIPC's Logging to find out? (Logging tab, enable Event logging then OK out. Operate the button and see what is logged in the FSUIPC LOG file).
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?
QuoteAll my use of an MCP with the C/O button for many years has been with add-on systems like Project Magenta and, more recently, ProSim. If you are using an add-on aircraft like one of the PMDG ones they will likely have their own subsystems for this.
I'm not using PMDG add-on.
Thanks.
-
On 6/24/2018 at 11:53 AM, aua668 said:
Hi,
Simulator, aircraft, etc. ?!?
Without any information you won't get an answer.
Rgds
Reinhard
Thanks aua668 for your response.
it's a fsx aircraft, not pmdg. -
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?
-
Hello Pete,
On 3/2/2018 at 11:01 PM, Pete Dowson said:The GoFlight rotaries, as on their RP48 module, send back "fast" or "slow" codes -- i.e. effectively 4 buttons for each rotary, fast and slow either way. The fast ones are generally used to do things like increment by 10 whilst the slow increment by 1 (for example).
Is this dual concentric rotary switch? could you attach that rotary pic?
-
Thanks a lot Pete for your time and help. I'm glad now my rotaries and buttons are working gud. thanks again.
-
Thanks Pete for guidance.
now buttons are working fine I changed while loop limit to 4 in HIDemo.lua as you said.
On 3/2/2018 at 11:01 PM, Pete Dowson said:You can incread the scan frequency (it's an INI file parameter
could you tell me? which parameter should i change in ini file?
On 3/2/2018 at 11:01 PM, Pete Dowson said:The fast ones are generally used to do things like increment by 10 whilst the slow increment by 1 (for example).
Ok. it means i need push button rotary that will change incremental value. will rotary encoder also miss some click?
On 3/2/2018 at 11:01 PM, Pete Dowson said:You might like to try using the Lua example "Rotaries.lua", provided in the Examples ZIP.
thanks Pete I liked this one its working.
what would you recommend for trim wheel, rotary switch or multi turn pot? -
Thanks Pete your gud response.
I will check to change while loop. then inform you.4 hours ago, Pete Dowson said:There are no "values" being skipped because it isn't related to values.
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?
-
Thanks Pete for your response.
41 minutes ago, Pete Dowson said:128 buttons? I thought with DirectInput that the maximum was 64. Is it a DirectInput joystick device?
It is 128 buttons HID joystick.28 minutes ago, Pete Dowson said:Well, they are all the same to FSUIPC, just bits in offsets. You'll need to look at your hardware of whatever program you have writing to FSUIPC.
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
37 minutes ago, Pete Dowson said:Is it an encoding rotary, pulsing one or the other buttons according to direction, or one which pulses both all the time but with different phasing to differentiate the direction?
it is a rotary switch here its diagram.
-
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
-
I got it....Thank you very much Pete for your help and time.
On 9/23/2017 at 9:41 PM, Pete Dowson said:Why? What's the point of a trace log with no source code to see what was being executed? Or are you talking about the code you posted much later? Did you expect me to magically relate the two with so much intervening goings on?
Sorry for this.
-
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)
-
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.
-
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
-
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? -
11 hours ago, Pete Dowson said:
Sorry, why would I want that?
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?
11 hours ago, Pete Dowson said:This site: http://pcidatabase.com/vendors.php?sort=id lists your 0x1234 as being ownded by "Technical Corp". Is that right?
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. -
Thanks Pete for your response.
2 hours ago, Pete Dowson said:No. HID ports are, like all USB ports, are treated like COM in the Windows API for reading and writing, but the port name is much more complicated than that, and obtained by reference to the PID and VID values you need to program in your Lua when using OpenHID.
I did not know that. thanks for your information.
2 hours ago, Pete Dowson said:And don't you have to supply such information for that?
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" folderlocal 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.
2 hours ago, Pete Dowson said:4660 is hex 0x1234 which seems an very unlikely VID. And a PID of 0x0001 is even more unusual. Are you sure you have those correct? Where are you getting them from?
yes those are correct. getting from to run a program named "hid scanner.exe"
2 hours ago, Pete Dowson said:Why would I need that information?
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?
PMDG Fight director switch
in FSUIPC Client DLL for .NET
Posted
I got it.
Thank you very much Thomas Richter for your help and time