Configures LEDs and display on Logitech X52 HOTAS
Logitech X52/X52Pro module
Most of the information about how to configure the devices comes from a GUI program called gx52, created by Roberto Leinardi. His project can be found at https://github.com/leinardi/gx52 . Many thanks to him for his efforts, if you need a GUI app to set up your HOTAS, consider using his program.
If you want a command line tool, there is a utility called x52pro-linux, by nirenjan, available at https://github.com/nirenjan/x52pro-linux . It has a C library that you can use in your own software and a CLI tool to set you HOTAS. It's even available as packages in Debian and Arch.
How to use it
- Initializing the module
from x52 import x52 # locate all devices joystick = x52() # list devices print(joystick.devices)
- Setting button colors
# sets POV LED to green on device 0 joystick.set_led_color(joystick.devices, 'pov', 'green') # Blinks I button and POV Hat 1 joystick.set_led_blink(joystick.devices, 'blink') # stops blinking joystick.set_led_blink(joystick.devices, 'solid')
Valid colors for POV Hat 2 and Throtlle are
off. For all other buttons values are
For blinking status, values are
- LED and MFD brightness
Brightness of LEDs and MFD can be set to values between 0 (which turns them off) and 127 (maximum).
You can set the brightness like this:
# set brightness to 60 joystick.set_brightnes(joystick.devices,'mfd',60) joystick.set_brightnes(joystick.devices,'led',60) # turns the lighting off joystick.set_brightnes(joystick.devices,'mfd',0) joystick.set_brightnes(joystick.devices,'led',0)
- Sets the clock and date.
WARNING: The clock does NOT update itself. You need to call this method and update clock 1 everytime you want it to advance.
Setting the date is only possible when also setting the main clock (identified by 1) When setting clocks 2 and 3, is not possible to set the date, since those 2 only accept offsets from the main clock. The offsets are a number of minutes, between -1023 and 1023.
When setting the date, you can choose the format, valid options are 'DMY' (Day.Month.Year), 'MDY' (Mont.Day.Year) or 'YMD' (Year.Month.Day). The clocks can also be set to 24h or AM/PM modes.
Setting time and date:
# set current date and time to clock 1, usind DMY and 24h formats nowtime=datetime.now joystick.set_clock(device=joystick.devices, clock=1, cur_time=nowtime , date_format = 'DMY', is24h = True) # set clock 2 to 45min ahead joystick.set_clock(device=joystick.devices, clock=2, cur_time=45 )
- Shift indicator
This indicator does nothing to the actual performance or functionality of the X52. It's just there so the official software can tell you when it's using different settings.
You can turn it on or off like this:
#turn it on joystick.set_shift(joystick.devices, 'on') #turn it off joystick.set_shift(joystick.devices, 'off')
- MFD Text
You can write on the 3 text lines of the MFD. Lines are limited to 16 characters, anything beyond that will be discarded. There are issues with non-US ASCII text, so try not to write anything fancy. Just call the method with the line number (1 to 3) and the text. A blank line ('') erases the line.
# write a text to line 1 joystick.write_mfd(joystick.devices, 1, 'A line of Text') joystick.write_mfd(joystick.devices, 1, 'This text is too big and will be truncated') # Erases line 1 joystick.write_mfd(joystick.devices, 1, '')
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for x52_control-1.0.0-py3-none-any.whl