norberttak / XPanel

XPlane 11/12 plugin to handle home cockpit panels
GNU General Public License v3.0
8 stars 3 forks source link

Question if XPanel could be used for communicating with my generic hidapi boards? #46

Closed wstronks closed 1 year ago

wstronks commented 1 year ago

Hi I came across your XPanel project and it seems like its what I was looking for. I want to communicate between X_Plane to 3 G1000 PFD and MFD panels and 1 G1000 audio panel from brand TRC. I received the hidapi protocol information from the manufacturer and made some scripts in lua ( Flywithlua ) to track button or rotary knob actions through hid_write and hid_read's and switch on LEDS. This works fine but at a huge FPS costs. I am now looking for a more efficient solution for this communication. I hesitate to start coding a plugin because I am not very current in c++. Question: Could I used XPanel for this communication and does it need additional functionality or can that be done through the config options? The panels are not SAITEK or Arduino based but seem to me fairly straight forward hid-api devices. Thanks and regards,. Wilko

norberttak commented 1 year ago

Hi Wilko, Thanks for checking Xpanel project. I don't see any problem with integrating HID-compliant USB devices. All the HW parameters are in a config file named "board-config.ini". In this file, you can define the logical names of the HW devices (switches,...) and connect them to the register/bit of the HID reports.

My arduino based home cockpit device has this config file. You need to modify this file according to your HW parameters.

[device:id="aurduino_homecockpit"]
vid="2341"
pid="8036"

[register:adr=0]
;register 0 is not used

[register:adr=1]
button:id="STROBE",bit=0
button:id="DOME",bit=1
button:id="LAND",bit=2
button:id="TAXI",bit=3
....

If you share your lua script with me, I can create the config file for you. Thanks, Norbert

wstronks commented 1 year ago

Hi Norbert, That is really great, thanks for the quick response. I have attached one of my scripts using Flywithlua that works fine with my boards. Also I attached the manufacturers info on the hidapi protocol they use. I am OK to make the config files in detail, but have only question now. In Flywithlua I used the functions hid-write() and hid-read_timeout(), and have not tried the hid_get_feature_report() and hid_send_feature_report(). Because write/read immediately worked well and because I didn't understand the differences between direct read/write and through feature reports. I am not sure if your plugin works with feature reports? If you can point me in the right direction I will starting testing asap. Thanks again and best regards, Wilko TRCG1000PDF1.txt protocol02ac_trc1000.pdf

norberttak commented 1 year ago

I checked the technical documentation and your lua script as well. It seems the TRC1000 device needs a command first (0x41, 0x42, 0x43, ...) and after that the device will answer with the requested data. This is little bit different compared to Saitek devices (simply read the values without any command). The XPanel plugin in the current form doesn't have the option to send these kinds of commands before every read operation. It's not a huge work to add the support of TRC1000. Give me a few days and I try to add the necessary codes to the plugin.

I'd would be happy if you could help me regarding testing the plugin on your TRC1000 devices. It's good to extend the functionality of the plugin :-)

Until I'm not ready with the c++ code, you may reduce lua script's FPS drop by replacing the do_every_frame() function to do_often(). It's just a guess.

Regarding your question about HID feature reports: This was originally created for some kind of configuration for the HID devices but somehow many manufacturers started to use it instead of normal OUT endpoints. Saitek/Logitech did it as well. From functionality point of view there is no big difference. It seems your device doesn't use the feature reports for normal communication. In c++ code I simply need to use other function of hid_api library.

I'll comeback soon :-) ,Norbert

wstronks commented 1 year ago

Hello Norbert,

Much appreciated you want to spend time on my isssue... Sure I would be happy to test. I used those panels with Prepar3d and software from a US company Flight1Tech. But they unfortunately stopped supporting non-commercial customers. Therefore I switched to X-plane, like it very much, but would like to use the G1000's too.

I am not a 100% sure the TRC1000 only responds after a command. It probably does, but I just quickly coded it this way initially and that worked well. I can test if it only respond with new actual values, after a command.

Yes, I also tried do_often but in that case the button and rotary respond got just too much delay. Also my brute-force approach to make larger steps when turning a rotary know more than 1 dent is not very elegant.

I also have documentation for the TRC G1000 Audiopanel. This uses similar functions but also uses writes to switch on/off the leds. I have attached that doc.

protocol02b0_trc1000_audio.pdf

Thanks for the effort, Wilko

norberttak commented 1 year ago

Hi Wilko, I created the PR #48 with the code modifications for TRC 1000 PFD support. This code can handle the buttons of TRC 1000 PFD device. Neither LED nor Rotary encoder supported yet. I forgot to ask you about your operation system. If it is Windows, I attached the compiled library to this message. Please make a short test: The XPanel.zip shall be unzipped to Xplane plugin folder. Please don't forget to remove (or disable) your lua script during the test.

I also attached the xpanel.ini config file. Remove the .txt from the file name (Github doesn't allow me to upload ini files) This file shall be put into the folder of your aircraft. This config file defines the actions assigned to buttons on your device.

XPanel.zip xpanel.ini.txt

If you have any issue with the plugin please send me your xplane log file (the plugin creates many log entry there)

Thanks, Norbert

wstronks commented 1 year ago

Hi Norbert,

That was quick! I just installed XPanel and changed in xpanel.ini in the aircraft folder "generic.acf" into "Cessna_172SP_G1000.acf", because that is the aircraft I am testing with. I don't notice any button responses in X-plane yet and attached the log.txt. Connection to the PFD seems OK, but I did see "XPanel [58013] [INFO]:Lua : no flight_loop function defined" appear in the log.txt? Log.txt

Thanks and regards, WIlko

norberttak commented 1 year ago

The message "XPanel [58013] [INFO]:Lua : no flight_loop function defined" doesn't matter. Later you can use Lua functions to handle HW elements but now this is not important right now.

I don't know why it doesn't handle PFD button. I see only one possible problem: Could you please double-check what does the 0:00:57.616 LUA: scripts/c172_init/c172_init.lua Lua script do? Is it somehow connected to the USB device?

It seems the flywithlua plugin still handles somehow the HID devices: C:\X-Plane 12/Resources/plugins/FlyWithLua/Internals/FlyWithLua.ini FlyWithLua Info: Discovered 14 HID devices.

The flywithlua plugin can work together with my plugin but no Lua scripts shall not open the same HID device.

wstronks commented 1 year ago

Hello Norbert,

c172_init.lua is a default lua script that comes with the C172 laminar aircraft. I have not changed it. I attached this file. I completely removed the Flywithlua plugin directory, but have the same behavioir. Should there be debug info written as a button-press is detected? I have not used any other plugins to communicate with the TRC panels, but there are some other hids connected. I will tomorrow test with just the trc hid connected, and see if that gives any info.

thanks, Wilko


From: Norbert Takacs @.> Sent: Sunday, November 20, 2022 6:16 PM To: norberttak/XPanel @.> Cc: wstronks @.>; Author @.> Subject: Re: [norberttak/XPanel] Question if XPanel could be used for communicating with my generic hidapi boards? (Issue #46)

The message "XPanel [58013] [INFO]:Lua : no flight_loop function defined" doesn't matter. Later you can use Lua functions to handle HW elements but now this is not important right now.

I don't know why it doesn't handle PFD button. I see only one possible problem: Could you please double-check what does the 0:00:57.616 LUA: scripts/c172_init/c172_init.lua Lua script do? Is it somehow connected to the USB device?

It seems the flywithlua plugin still handles somehow the HID devices: C:\X-Plane 12/Resources/plugins/FlyWithLua/Internals/FlyWithLua.ini FlyWithLua Info: Discovered 14 HID devices.

The flywithlua plugin can work together with my plugin but no Lua scripts shall open the same HID device.

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnorberttak%2FXPanel%2Fissues%2F46%23issuecomment-1321190628&data=05%7C01%7C%7C632126b1403346f2686108dacb1af38e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638045613858777219%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=V3sFt7NwIxtpvCXnoMi%2FM6BI2hE6JKnFgZEfgDofZDo%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA4ASOUP72RFW7PZFFIKUGI3WJJMGPANCNFSM6AAAAAASEOZ6UY&data=05%7C01%7C%7C632126b1403346f2686108dacb1af38e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638045613858933434%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=e3o72KKTNjAcfLlgNOw7uHCTLAcTZIritdKwPNwe%2BT4%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

norberttak commented 1 year ago

Thanks for checking the LUA scripts and for your tests. Meanwhile, I found an error in my implementation (bad indexing of response bytes) so I created a new binary version attached here:

XPanel.zip

If the plugin works, there should be debug messages like these (generated during the unit test run on my PC): XPanel [23012] [TRACE]:Device NAV button bit changed XPanel [23018] [TRACE]:Device NAV button push action called

The only part that is not clear to me is the report id in the hid_write function call in your script: hid_write( G1000PDF1Device, 1,0x41,0,0,0,0,0,0,0) The second parameter (1) is the report ID although the documentation of TRC doesn't say anything about it. If the modified plugin still doesn't work I'll add that extra 1 byte to my hid_write function call.

Thanks, Norbert

wstronks commented 1 year ago

OK, thanks,

I just tested the TRC Audiopanel with hidapitester and it switches on the LEDs of COM1 MIC, COM2 MIC, COM3 MOC and COM 1 / 2 with the following command line:

C:\Users\wstro>hidapitester --vidpid 0d59/02b1 --open --send-output 1,1,159,0,0 Opening device, vid/pid: 0x0D59/0x02B1 Writing output report of 64-bytes...wrote 9 bytes: 01 01 9F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Closing device

So for some reason the first 1 is probably the reportID. I interpreted in their doc the remarks "The commands and requests from the PC to the TRC board are sent via Endpointer 1 The responses from the TRC board to the PC are retrieved from Endpointer 2" as references to the reportID's.

I will now test your last version, but I expect we do need the extra 1.

regards, Wilko


From: Norbert Takacs @.> Sent: Sunday, November 20, 2022 9:14 PM To: norberttak/XPanel @.> Cc: wstronks @.>; Author @.> Subject: Re: [norberttak/XPanel] Question if XPanel could be used for communicating with my generic hidapi boards? (Issue #46)

Thanks for checking the LUA scripts and for your tests. Meanwhile, I found an error in my implementation (bad indexing of response bytes) so I created a new binary version attached here:

XPanel.ziphttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnorberttak%2FXPanel%2Ffiles%2F10050529%2FXPanel.zip&data=05%7C01%7C%7Cc0a6fdcc33b14ef0f2ed08dacb33cea1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638045720616054727%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=RgNruaQoWlnwGmxXVX6HPYydGHxKvjB1X1lMC80IY5E%3D&reserved=0

If the plugin works, there should be debug messages like these (generated during the unit test run on my PC): XPanel [23012] [TRACE]:Device NAV button bit changed XPanel [23018] [TRACE]:Device NAV button push action called

The only part that is not clear to me is the report id in the hid_write function call in your script: hid_write( G1000PDF1Device, 1,0x41,0,0,0,0,0,0,0) The second parameter (1) is the report ID although the documentation of TRC doesn't say anything about it. If the modified plugin still doesn't work I'll add that extra 1 byte to my hid_write function call.

Thanks, Norbert

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnorberttak%2FXPanel%2Fissues%2F46%23issuecomment-1321231752&data=05%7C01%7C%7Cc0a6fdcc33b14ef0f2ed08dacb33cea1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638045720616054727%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=g%2BrE7DI06VV7RNEISZstf692Q%2FKQVEbPf2FkEP7oGvA%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA4ASOUIESFLB3TSMN3WFYR3WJKBBVANCNFSM6AAAAAASEOZ6UY&data=05%7C01%7C%7Cc0a6fdcc33b14ef0f2ed08dacb33cea1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638045720616210948%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qZRt8GpB3G50vc7FqZtMkjDOlfNepmYOyXsX89azziw%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

wstronks commented 1 year ago

Yes, also with the latest version in X-plane, I see the same behavior. So it probably needs the extra 1 parameter

regards, Wilko


From: Wilko Stronks @.> Sent: Monday, November 21, 2022 10:09 AM To: norberttak/XPanel @.> Subject: Re: [norberttak/XPanel] Question if XPanel could be used for communicating with my generic hidapi boards? (Issue #46)

OK, thanks,

I just tested the TRC Audiopanel with hidapitester and it switches on the LEDs of COM1 MIC, COM2 MIC, COM3 MOC and COM 1 / 2 with the following command line:

C:\Users\wstro>hidapitester --vidpid 0d59/02b1 --open --send-output 1,1,159,0,0 Opening device, vid/pid: 0x0D59/0x02B1 Writing output report of 64-bytes...wrote 9 bytes: 01 01 9F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Closing device

So for some reason the first 1 is probably the reportID. I interpreted in their doc the remarks "The commands and requests from the PC to the TRC board are sent via Endpointer 1 The responses from the TRC board to the PC are retrieved from Endpointer 2" as references to the reportID's.

I will now test your last version, but I expect we do need the extra 1.

regards, Wilko


From: Norbert Takacs @.> Sent: Sunday, November 20, 2022 9:14 PM To: norberttak/XPanel @.> Cc: wstronks @.>; Author @.> Subject: Re: [norberttak/XPanel] Question if XPanel could be used for communicating with my generic hidapi boards? (Issue #46)

Thanks for checking the LUA scripts and for your tests. Meanwhile, I found an error in my implementation (bad indexing of response bytes) so I created a new binary version attached here:

XPanel.ziphttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnorberttak%2FXPanel%2Ffiles%2F10050529%2FXPanel.zip&data=05%7C01%7C%7Cc0a6fdcc33b14ef0f2ed08dacb33cea1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638045720616054727%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=RgNruaQoWlnwGmxXVX6HPYydGHxKvjB1X1lMC80IY5E%3D&reserved=0

If the plugin works, there should be debug messages like these (generated during the unit test run on my PC): XPanel [23012] [TRACE]:Device NAV button bit changed XPanel [23018] [TRACE]:Device NAV button push action called

The only part that is not clear to me is the report id in the hid_write function call in your script: hid_write( G1000PDF1Device, 1,0x41,0,0,0,0,0,0,0) The second parameter (1) is the report ID although the documentation of TRC doesn't say anything about it. If the modified plugin still doesn't work I'll add that extra 1 byte to my hid_write function call.

Thanks, Norbert

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnorberttak%2FXPanel%2Fissues%2F46%23issuecomment-1321231752&data=05%7C01%7C%7Cc0a6fdcc33b14ef0f2ed08dacb33cea1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638045720616054727%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=g%2BrE7DI06VV7RNEISZstf692Q%2FKQVEbPf2FkEP7oGvA%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA4ASOUIESFLB3TSMN3WFYR3WJKBBVANCNFSM6AAAAAASEOZ6UY&data=05%7C01%7C%7Cc0a6fdcc33b14ef0f2ed08dacb33cea1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638045720616210948%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qZRt8GpB3G50vc7FqZtMkjDOlfNepmYOyXsX89azziw%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

norberttak commented 1 year ago

HI Wilko,

Here is the updated binary package with the report id byte: XPanel.zip

Here you can see the code which sends the read command to the device: https://github.com/norberttak/XPanel/blob/e55c0050831673a69cc140ff74cad222b08263a6/src/TRC1000PFD.cpp#L113 I hope it will work now. Fingers crossed :-)

Thanks, Norbert

wstronks commented 1 year ago

Hi Norbert, Yes, this now works great! Let me know if I can contribute to this also?

In the end I would like to be able to connect 3 G1000 panels; PFD Pilot, PFD Co-pilot, MFD and a G1000 audiopanel. However some X-Plane aircraft only have one PFD and an MFD, some like the Phenom300 is equipped with 2 PFD's and an MFD.

Also, I use a Saitek FIP as standby horizon. I saw you are also supporting those. With prepar3d I used SPAD.next, but I prefer to see if I can use XPanel for the FIP too.

Thanks again and regards, Wilko


From: Norbert Takacs @.> Sent: Monday, November 21, 2022 8:00 PM To: norberttak/XPanel @.> Cc: wstronks @.>; Author @.> Subject: Re: [norberttak/XPanel] Question if XPanel could be used for communicating with my generic hidapi boards? (Issue #46)

HI Wilko,

Here is the updated binary package with the report id byte: XPanel.ziphttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnorberttak%2FXPanel%2Ffiles%2F10059763%2FXPanel.zip&data=05%7C01%7C%7Cf48ca3a4254b4df9d77208dacbf29cf4%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638046540113387479%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ustQbngHwUk5P8WTB1pWUrAMkQoXnknQsApCjK6nKRE%3D&reserved=0

Here you can see the code which sends the read command to the device: https://github.com/norberttak/XPanel/blob/e55c0050831673a69cc140ff74cad222b08263a6/src/TRC1000PFD.cpp#L113https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnorberttak%2FXPanel%2Fblob%2Fe55c0050831673a69cc140ff74cad222b08263a6%2Fsrc%2FTRC1000PFD.cpp%23L113&data=05%7C01%7C%7Cf48ca3a4254b4df9d77208dacbf29cf4%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638046540113387479%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OGxfwWdjz0PGCwO2zV29GsFHp8A99rznXRsSOnbVA84%3D&reserved=0 I hope it will work now. Fingers crossed :-)

Thanks, Norbert

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnorberttak%2FXPanel%2Fissues%2F46%23issuecomment-1322513375&data=05%7C01%7C%7Cf48ca3a4254b4df9d77208dacbf29cf4%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638046540113543670%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=743LWKHpyf%2FwJZVLGam3GWgKTwIKNwpY%2BbfpYMUuvIU%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA4ASOUPYQN433GTPEMALXJDWJPBDTANCNFSM6AAAAAASEOZ6UY&data=05%7C01%7C%7Cf48ca3a4254b4df9d77208dacbf29cf4%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638046540113543670%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=pPRcNnqYxEciXLTvawF5IE6WfD2d1n5FiVVgw5Os6ZU%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

norberttak commented 1 year ago

Hi Wilko, That's very good news :-)

If you wish to use more G1000 panels you need to copy the configuration options in the xpanel.ini file. You have to modify the PID value in the second and third panel. It should work without any C++ coding.

As a next step need to:

  1. re-organize the code to make common parts for PFD and Audio panels
  2. add Rotary encoder support
  3. add Audio Panel support
  4. add LED handling

If you wish to contribute to the c++ code I suggest to join after I done with the 1st item above. For example to fine tune the rotary encoder handling (create algorithm to handle the high speed encoder rotations) would be fantastic to share with you.

Rgearding the FIP device: Yes I've just merged the support for this. The documentation and a "how to create" configuration is here: https://github.com/norberttak/XPanel/blob/master/doc/fip-screen.md

For the C172 aircraft you can check a working example here: https://github.com/norberttak/XPanel/tree/master/config/default%20c172

Thanks, Norbert

wstronks commented 1 year ago

Hi Norbert,

That all sounds very good. I would love to help, but am not very current (understatement) in c++. Today I will download Visual Studio and start working on it. (and Yes, I working under Windows, and testing with X-plane 12)

If I remember well, the rotary knobs on the TRC1000's return a byte value with increment 2 per click, I will check it again, specifically for the HDG and CRS knobs. My brute-force approach works reasonable well in lua; if the difference between the current and previous value > 4, repeat the command 12 times. But that is probably due to the relative slow lua interpreter.

thanks and regards, Wilko

wstronks commented 1 year ago

Hi Norbert, While trying to setup VisualStudio and Github, I made a clone of your xPanel project in my Github repository. Then I probably tried to push it again to your environment instead of mine, that was not my intention. I will study it some more, before hitting other buttons! Wilko

norberttak commented 1 year ago

Hi, Don't worry about it. You can't push anything directly to my repo (only through a pull request, but that is OK). So everything is good, no problem happened. I suggest creating a fork from my original repo (there is a button on the top right side of the repo page). You can clone, modify and push anything to your fork repo. That's the most convenient way to use git hub.

BTW I'm working on items 1 and 2 in my list above. As soon as I'm ready, you can quickly start to make fine-tuning the rotary encoder handling. I'm gonna create every fundamental element for this fine tune. ,Norbert

wstronks commented 1 year ago

OK that sounds super. Wilko

wstronks commented 1 year ago

Hi Norbert, I got a message through XPlane.org from Yvan Pieters, who struggles with the same problems in connecting Xplane to TRC1000. I explained your solution and pointed him to this conversation in Github. Regards, Wilko

norberttak commented 1 year ago

Hi Wilko,

Thanks for referring to this project :-)

I've just added the rotation encoder support for the plugin. This is still for the PFD (audio panel will be added next). I enclosed a new configuration file containing the command references copied from your lua script. XPanel.zip test-trc1000-pfd.ini.txt

Just to clarify: this config file is from the unit tests so please open it and copy/paste the end of the file starting with "; ----------- Rotary encoder 0 -----------------" comment to your existing xpanel.ini config file.

Thanks, Norbert

wstronks commented 1 year ago

Hi Norbert,

I was a bit busy the last 2 days. I just installed the last version and will do a real test tomorrow. I saw just typo's in the ini file:

[encoder:id="HDG"] on_increment="commandref:sim/GPS/g1000n1_hdgr_up:once" Should be: on_increment="commandref:sim/GPS/g1000n1_hdg_up:once"

and

[encoder:id="RANGE"] on_decrement="commandref:sim/GPS/g1000n1_range_dn:once" should be: on_decrement="commandref:sim/GPS/g1000n1_range_down:once"

more tomorrow. have a nice evening, Wilko

wstronks commented 1 year ago

Hi Norbert,

I just tested a bit with the last version. It has some unexpected behavior. When switching back to your previous version, that one still works ok. I have attached a log.txt.

First issue is that after starting the plugin and without any actions on the panel the log.txt shows: XPanel [34383] [INFO]:Lua : no flight_loop function defined XPanel [34413] [TRACE]:Device NAV_VOL encoder inc action called (1) XPanel [34477] [TRACE]:Device SWITCH_NAV_12 button bit changed XPanel [34477] [TRACE]:Device PRESS_ALT button bit changed XPanel [34477] [TRACE]:Device SWITCH_COM_12 button bit changed XPanel [34477] [TRACE]:Device CURSOR button bit changed

When thereafter pressing the AP button, it shows: XPanel [25277] [TRACE]:Device NAV_INNER encoder inc action called (4) XPanel [25517] [TRACE]:Device NAV_INNER encoder dec action called (-4)

When turning the HDG knob 2 clicks to the right: XPanel [59917] [TRACE]:Device SWITCH_NAV_12 button bit changed XPanel [59917] [TRACE]:Device PRESS_ALT button bit changed XPanel [59917] [TRACE]:Device SWITCH_COM_12 button bit changed XPanel [59917] [TRACE]:Device SEL_CRS button bit changed XPanel [60797] [TRACE]:Device SWITCH_NAV_12 button bit changed XPanel [60877] [TRACE]:Device SWITCH_NAV_12 button bit changed XPanel [60877] [TRACE]:Device PRESS_ALT button bit changed

If you need more tests, let me know,

Regards, Wilko Log.txt

norberttak commented 1 year ago

Hi Wilko,

I think I found the reason for the first issue. I forgot to initialize a buffer. I have fixed it.

Regarding the second issue, I'm not sure I know the cause. I added some extra debug log. Could you please repeat the above test steps on this version as well? XPanel.zip

Thanks, Norbert

wstronks commented 1 year ago

Good evening, I just ran 2 tests with this version: the first was like before; after startup, pressed ALT once and thereafter HDG 2 clicks to the right this produced log1.txt

Then I reloaded the plugin from X-Plane and thereafter: 2 clicks on NAV Outer and 2 clicks NAV-inner to the right.

Hope it shows enough?

regards, Wilko Log1.txt Log2.txt

norberttak commented 1 year ago

Hi Wilko, Thanks for the quick response! I undertsand the problem now. In my code I use USB read fucntion in a non-blocking mode (means it returns immidiately even if no data has been received from the device). The PFD device requries the three commands (0x41,0x42,0x43) to be sent out and my code doesn't care about the delay needed for the answer. Therefore the received answeres are interpreted on a wrong order. That's why the debug messages are in the latest log file:

XPanel [9118] [DEBUG]:TRC1000PFD: wrong cmd byte in answer (expected: 0xc2) =193

You LUA code uses the timeout version of USB read (means a blocking mode) therefore you can read the answers in the right order. Let me think a littlebit about this, I'll find a good solution for this problem. Thanks, Norbert

wstronks commented 1 year ago

Ni Norbert,

OK, I see. In the lua code I think I did select non-blocking mode, but that probably only doesn't block after it waited the timeout period. I wanted to use a non timeout read in lua, but could not get that function to work, so I used the timeout one. Using the timeout I tested with with different timeout values, but for some reason, lua did not allow me a timeout smaller that 18 ms. I did not notice any real difference between 18 ms and 100 or 200 ms.

Regards, Wilko

From: Norbert Takacs @.> Sent: Tuesday, November 29, 2022 5:58 AM To: norberttak/XPanel @.> Cc: wstronks @.>; Author @.> Subject: Re: [norberttak/XPanel] Question if XPanel could be used for communicating with my generic hidapi boards? (Issue #46)

Hi Wilko, Thanks for the quick response! I undertsand the problem now. In my code I use USB read fucntion in a non-blocking mode (means it returns immidiately even if no data has been received from the device). The PFD device requries the three commands (0x41,0x42,0x43) to be sent out and my code doesn't care about the delay needed for the answer. Therefore the received answeres are interpreted on a wrong order. That's why the debug messages are in the latest log file:

XPanel [9118] [DEBUG]:TRC1000PFD: wrong cmd byte in answer (expected: 0xc2) =193

You LUA code uses the timeout version of USB read (means a blocking mode) therefore you can read the answers in the right order. Let me think a littlebit about this, I'll find a good solution for this problem. Thanks, Norbert

- Reply to this email directly, view it on GitHubhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnorberttak%2FXPanel%2Fissues%2F46%23issuecomment-1330077070&data=05%7C01%7C%7C54fc796ab7c84225f2df08dad1c64069%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638052946656993533%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=5OrUksqub6TstQCOSYEixmqDISb4FSr4ZnG5tLQlZGg%3D&reserved=0, or unsubscribehttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA4ASOUPX547UZVFHVH3S7OTWKWEMPANCNFSM6AAAAAASEOZ6UY&data=05%7C01%7C%7C54fc796ab7c84225f2df08dad1c64069%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638052946656993533%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=oxn6IuLSRLGMpTuySTeOKmKtlvE%2F60Hf%2FuS0efq4Up0%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

norberttak commented 1 year ago

Hi Wilko, I've created a new version that can decode the answers based on the response codes (0xc1,c2,c3). It still uses the non-blocking mode because this is an important point in my design for other devices. Could you please make another short test on this version?

Thanks, Norbert

XPanel.zip

wstronks commented 1 year ago

Hi Norbert,

Just ran this version. It seems turns on the rotary do not give a response. Most buttons and press on a rotary works ok. In the attached log I had:

Started a flight in X-Plane and after startup Pressed. rotary knobs: NAV Volume, NAV freq, HDG, ALT Thereafter pressed normal buttons: AP, YD, FD. HDG, NAV, APR, ALT, VNV, VS, DN, IAS, UP Then pressed rotary knobs: SQ, COM Freq, CRS And thereafter pressed normal buttons: DCT, MENU, FPL, PROC, CLR, ENTanf FMS (cursor)

best regards, Wilko Log.txt

norberttak commented 1 year ago

It's strange. I don't see the parser finds rotary encoder in your config ini file. I mean debug message like this: Logger(TLogLevel::logDEBUG) << "parser: rotation encoder detected " << section_id << std::endl;

Could you please double check the xpanel.ini file?

It shall contain encoder definitions like this:

[encoder:id="NAV_INNER"]
on_increment="commandref:sim/GPS/g1000n1_nav_inner_up:once"
on_decrement="commandref:sim/GPS/g1000n1_nav_inner_down:once"

[encoder:id="NAV_OUTER"]
on_increment="commandref:sim/GPS/g1000n1_nav_outer_up:once"
on_decrement="commandref:sim/GPS/g1000n1_nav_outer_down:once"
wstronks commented 1 year ago

Oh stupid of me, i probably had the initial ini file still in the ac folder. The one without the rotary encoders. Sorry about that. I will test again a little later. Wilko

Wilko Stronks


From: Norbert Takacs @.> Sent: Tuesday, November 29, 2022 6:43:26 PM To: norberttak/XPanel @.> Cc: wstronks @.>; Author @.> Subject: Re: [norberttak/XPanel] Question if XPanel could be used for communicating with my generic hidapi boards? (Issue #46)

It's strange. I don't see the parser finds rotary encoder in your config ini file. I mean debug message like this: Logger(TLogLevel::logDEBUG) << "parser: rotation encoder detected " << section_id << std::endl;

Could you please double check the xpanel.ini file?

It shall contain encoder definitions like this:

[encoder:id="NAV_INNER"] on_increment="commandref:sim/GPS/g1000n1_nav_inner_up:once" on_decrement="commandref:sim/GPS/g1000n1_nav_inner_down:once"

[encoder:id="NAV_OUTER"] on_increment="commandref:sim/GPS/g1000n1_nav_outer_up:once" on_decrement="commandref:sim/GPS/g1000n1_nav_outer_down:once"

— Reply to this email directly, view it on GitHubhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnorberttak%2FXPanel%2Fissues%2F46%23issuecomment-1331036767&data=05%7C01%7C%7C4928dbcad7734223593f08dad23138c6%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638053406099736284%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Tvm04WXFRLkTS0%2B%2BtgggCRKnhik%2BkwXMhDVzOPojt3U%3D&reserved=0, or unsubscribehttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA4ASOUND3FNRGBZXSOBF4XDWKY6D5ANCNFSM6AAAAAASEOZ6UY&data=05%7C01%7C%7C4928dbcad7734223593f08dad23138c6%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638053406099736284%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=XLankd6Hd8anwkk0rw6Y%2F1HjqTZhs4WjKqyHV%2B5lr7w%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

wstronks commented 1 year ago

Hi Norbert, Indeed with the right ini file this version works quite good. Log.txt

I will do a thorough test tomorrow, but seems like all rotary encoders are giving a nice response. The X-plane G1000 also reflects the turns, in changing values. I think the turning of the Nav did make a little too large steps, but I will test in detail tomorrow. Attached the log.txt where I quicly turned all knobs and pushed most of the buttons. More tomorrow.

Thanks for the effort Wilko

wstronks commented 1 year ago

Hello Norbert,

I just spend some more time on testing. First I saw that I probably made some mistakes is my lua script in the bit position assignment to some ID's. These are the errors:

Button ENT and CLR were swapped: PanelButton(4 8 + 6, "CLR) should be PanelButton(4 8 + 7, "CLR") PanelButton(4 8 + 7, "ENT) should be PanelButton(4 8 + 6, "ENT")

Button SQ and ID were swapped: PanelButton(5 8 + 5, "SQ) should be PanelButton(5 8 + 7, "SQ") PanelButton(5 8 + 7, "ID) should be PanelButton(5 8 + 5, "ID")

Rotary encoder HDG and NAV VOL were swapped: PanelRotaryEncoder(ENCODER_1_BUFFER_OFFSET + 4, "HDG") should be PanelRotaryEncoder(ENCODER_1_BUFFER_OFFSET + 5, "HDG")

PanelRotaryEncoder(ENCODER_1_BUFFER_OFFSET + 5, "NAV_VOL") should be PanelRotaryEncoder(ENCODER_1_BUFFER_OFFSET + 4, "NAV_VOL")

I Temporary changed the assigned commands in the config file, to further test. See attached xpanelini.txt xpanelini.txt

One other issue was that I had in my lua script; on ID PRESS_ALT I had set the dataref sim/cockpit/autopilot/altitude: with the result of dataref "sim/cockpit2/gauges/indicators/altitude_ft_pilot". This was my attempt to set the actual current altitude in the Altitude selector. I kind of sync PFD Altitude selector to the current altitude. I don't know how to specify that in the config file.

When testing with the latest version I got sometimes unexpected different behaviors on the rotary encoders:

  1. Sudden big steps. F.i. when turning the Nav and Com frequency rotary knobs. Also when turning the HDG (now displayed in the log as nvol due to my swap in the config file), the heading increments and decrements nice with step 1, but suddenly it jumps about 90 or 180 degrees.
  2. I also sometimes notices that turning f.i. the outer NavCom freq knob that after one click the presented step in the display seemed always 2 clicks, however if I turned really slow I could get a 1 click return. It looked like it clicked on both the break and make of a contact during one click. But I dont know if the rotary encoders work that way. I will test this behavior tomorrow a bit more.
  3. Also when testing the above, experienced some strange freezes in X-Plane. I am not sure if it is related to the testing? I have attached 2 log files of the above tests. Log.txt Log1.txt

Let me know if you some more specific tests. Regards, Wilko

norberttak commented 1 year ago

Hi Wilko,

Thanks for the very detailed test.

  1. I changed the button and encoder names so you can remove the temporary changes from your xpanel.ini
  2. PRESS_ALT: For this kind of "complex" operations you should use a small lua snippet in the config:
    • You need a lua script file in your aircraft folder (according to your log you already have the file test-script.lua). The name of the script is refered in the config ini like this: script_file="C172-arduino-home-cockpit.lua"
    • Put this lua code into the script file (the detailes are here):
      function set_pressure_altitude()
      log_msg("TRACE","set_pressure_altitude() called")
      press_alt = get_dataref("sim/cockpit2/gauges/indicators/altitude_ft_pilot")
      set_dataref("sim/cockpit/autopilot/altitude",press_alt)
      end
    • Add the above lua function call to your xpnale.ini:
      [button:id="PRESS_ALT"]
      on_push="lua:set_pressure_altitude()"
  3. Sudden big steps: It happens when the 8 bit register value overflows (255->0). My code interprets it on wrong way like this: XPanel [50846] [TRACE]:Device COM_OUTER encoder dec action called (-254). Let me fix this very soon.
  4. Two clicks: The documentation has some words about the "Number of turns multiplied by two" what I don't understand (why do they multiply it?). Anyways I can add a division to compensate this multiplication. What is strange for me is that sometime the log contains only a single click like this: XPanel [51102] [TRACE]:Device COM_OUTER encoder inc action called (1)
  5. Freezes in XPlane: I guess this is due to the 255->0 overflow. In that case we flood Xplane with 255 command and that can cause the short freezes.

I'll create a new version soon.

Thanks, Norbert

norberttak commented 1 year ago

Hi Wilko,

Here it is the new version: XPanel.zip

  1. I changed the encoder names according to your last test
  2. The sudden big changes in encoders: I fixed it (it should fix the xplane freezes as well)
  3. The double steps on the encoder could still be valid. I need to find a suitable solution for this.
  4. I also added the support for Audio panel (without LEDs now). I need some help regarding this: The documentation contains only the symbolic names of buttons (S1..S23) and rotary encoders (ROTARY_A, ROTARY_B). Could you please check which symbolic name is which physical button/encoder? https://github.com/norberttak/XPanel/blob/trc-1000/src/TRC1000Audio.cpp To use the Audio panel please add this section to your xpanel.ini:
    
    [device:id="trc1000_audio"]
    vid="d59"
    pid="2b0"

; ----------------- Buttons ----------------- [button:id="S1"] on_push="commandref:sim/GPS/g1000n1_flc:once" ; Add more buttons here ... [button:id="S23"] on_push="commandref:sim/GPS/g1000n1_flc:once"

;----------------- Encoders ----------------- [encoder:id="ROTARY_A"] on_increment="commandref:sim/GPS/g1000n1_range_up:once" on_decrement="commandref:sim/GPS/g1000n1_range_dn:once"

[encoder:id="ROTARY_B"] on_increment="commandref:sim/GPS/g1000n1_cvol_up:once" on_decrement="commandref:sim/GPS/g1000n1_cvol_dn:once"

wstronks commented 1 year ago

Good morning Norbert, I also had a lua script for the TRC AUDIOPANEL but had not send it to you. I will update the ccp file with the right names. This version works good, only still some odd behaviors of the rotaries:

The rotary encoders of NAV, COM and FMS show this behavior: OUTER TURNS - on 1 click it increments the value 2 time, f.i. freq 110.00 becomes 112.00 INNER TURNS - on 1 click it increments the value 2 or 3 times, f.i. 110.00 becomes 110.10, 110,25, 110.35 etc Strangely the same type of rotary encoder for ALT does also 2 incr on outer turn clicks, but on inner it increments the altitude by 100ft as expected?

The other type of rotary encoders for HDG and CRS now work better, but still show big jumps, but not as often as before. I have attached a log.txt in which I after startup only started to turn the HDG knob clockwise at a normal rate. Log1.txt

I will do some more testing later today, but the version already becomes very pleasant to use!

thanks and regards, Wilko

wstronks commented 1 year ago

Hi Norbert,

I have attached the txt as ccp file for the TRC Audiopanel with right names and also a text file with the names for the LED assignments.

TRC1000AudiovWST1.txt TRC1000AudioLEDnames.txt

regards, Wilko

norberttak commented 1 year ago

Good morning, I created a new version:

  1. The encoder clicks are divided by 2 if it is larger than 1
  2. To understand the still existing big jumps in the encoder: I added some extra debug info.
  3. Added the LED handling. To use this feature, add appropriate datarefs to your xpanel.ini file like this:
    [light:id="ADF"]
    trigger_lit="dataref:sim/custom/lights/button/adf:1"
    trigger_unlit="dataref:sim/custom/lights/button/adf:0"

    The LED simbolic names are copied from your cpp file. The above example will turn on the LED if the sim/custom/lights/button/adf value is 1 and turn off if it is 0. The details are here XPanel.zip

Thanks, Norbert

wstronks commented 1 year ago

Hello Norbert,

Nice progress with your development speed... I made all the additions in the ini file for 2 PFD's, 1 MFD and the AUDIO PANEL. I have attached the file. For some of the buttons in the AUDIO PANEL I don't know the right dataref of command yet. I have commented those names. When starting with ini file, XPanel seems to trach continuous presses on the softkeys, see the attached log1.txt. I can not understand if it comes from an ini file error or something else.

I will do some more tests.

Regards, Wilko Log1.txt xpanel.txt

wstronks commented 1 year ago

Hi Norbert, I tried to test a bit more in detail on the double rotary encoder responses. See log.txt In the attached log1.txt file i have deleted all other traces, and just the ones of my test. Let me know if I should do more specific tests

regards, Wilko Log.txt Log1.txt

norberttak commented 1 year ago

Hi Wilko,

Regarding the continuous SOFT_KEY presses: Please change the device id of your audio panel from this:

;===AUDIO PANEL================================
[device:id="trc1000_pfd"]

to this:

;===AUDIO PANEL================================
[device:id="trc1000_audio"]

Regarding the encoders: Thanks for the very detailed tests. Now it is clear for me why the documentation contains the x2 multiplication. If you have some time, please do the "6 full clicks" test again but now with a normal rotation speed. According to my plan :-) on normal speed the division in my code will reduce it to 6 actions on XPlane side.

Thanks, Norbert

wstronks commented 1 year ago

Hi Norbert,

OK, just did another test. I did: Push NAV Turn OUTER about 6 clicks clockwise normal speed Turn OUTER about 6 clicks countrerclockwise normal speed Push NAV Turn INNER about 6 clicks clockwise normal speed Turn INNETabout 6 clicks countrerclockwise normal speed see log.txt Log.txt

I will test the audiopanel after the configfile change a little later,

regards, Wilko

norberttak commented 1 year ago

Hi Wilko,

I modified the encoder handling function in the plugin. With this modification, it will submit a command to XPlane at every second encoder increment. It is now independent of the rotation speed. If it is working better I'll add this config option to the encoder definition in the xpanel.ini file.

XPanel.zip

Thanks, Norbert

wstronks commented 1 year ago

Hello Norbert, When I install this version my X-Plane will crash after connecting to the TRC devices. See attached log file. After installing the previous version X-Plane startup is again as before. regards, Wilko Log.txt

norberttak commented 1 year ago

could you please do a quick test with this version please? XPanel.zip

wstronks commented 1 year ago

Hi Norbert, This version initially crashed my X-Plane, but I extracted the zip again and copied it again in X-Plane plugins. Then started a new flight and now no crash. Maybe I did something wrong the first time.. Also the Rotary Encoders now makes the right steps. I will starting testing a bit more in a minute. Thanks, Wilko

wstronks commented 1 year ago

Hi Again,

When starting x-planes a few times it does sometimes, but not always crash. When it does crash it shows the (same) following log. file.

regards, Wilko Log.txt

wstronks commented 1 year ago

Hi Norbert,

some more test results:

The log file shows a lot of FMS-INNER encoder responses when no rotary encoder was turned or pressed. good luck again with it, and thanks again, Wilko Log.txt

norberttak commented 1 year ago

Hi Wilco, Thanks for the tests again. Sorry for that so many iterations, it seems the rotary encoder is trickier than I thought :-)

A question on my side: What do you mean XPlane crashes? According to the log it is flooded by trace messages (FMS_INNER) which was a miss placed log message in my code. I fixed it now. Otherwise, it seems the plugin closed gracefully. Do you see the simulator freezes or it really crashes to desktop?

I think I find the cause of the still existing sudden changes in some encoder values: XPanel [7251] [TRACE]:encoder HDG decremented (127->128) d = -254 It was an overflow detection error in my code. I fixed it. XPanel.zip

Hope this version is better now. Thanks, Norbert

wstronks commented 1 year ago

Don't worry, I appreciate your work very much. Testing and tuning is fun for me.

With crash I mean that the X-plane window, just disappears, right before it would start and show the cockpit. After clicking the x-plane shortcut, the start screen comes up, I can select saved flight or start a new flight. X-plane starts loading all parts and at the end it just disappears, but the desktop is working ok. I haven't checked if any x-plane process still runs. Will do that later. I will test this version later tonight.

regards, WIlko

wstronks commented 1 year ago

Hello Norbert,

The SINGLE rotary encoders now work OK, no more jumps! Maybe it is nice to have the speed increase option available for these rotary encoders, because turning 180 degrees is very much turning the knob. I read you had a option for that in the config file, but that probably is not implemented for this rotary?

I still do have occasionally a crash to the desktop at startup. I can't find out what causes it. However I noticed the log file always ends with these lines if such a crash has occurred:

XPanel [49425] [TRACE]:encoder FMS_INNER incremented (0->1) d = 1 XPanel [49425] [TRACE]:encoder FMS_INNER accumulated change = 1 XPanel [49425] [TRACE]:encoder FMS_OUTER decremented (0->255) d = -1 XPanel [49425] [TRACE]:encoder FMS_OUTER accumulated change = -1

While the panel knobs were not touched. I will test a bit more with different aircraft to find-out if the problem originates from a 3rd party aircraft. Thanks, regards, Wilko

Log.txt