[Plugin] pirate audio

Hi AxLED

Thanks for this great plugin. I’m using it on an Pirate Audio DAC using a Pi Zero W, and find it a bit annoying that the micro USB connector for the Pi comes in to the bottom side. I’ve modified your script a little to include the option to rotate the display 180 degrees, so that it works upside down (with buttons rotated etc). This way I can have the pi sitting on my desk without the USB power stopping it sitting flat. I thought I’d share what I’ve done (I can’t get indents after if statements to come through in this forum, but I’m sure you know where they’re needed!).
config.json:
Added a new boolean config value rotate - I’ve set it to true, but I guess you’d want it false by default.
display.py:
Moved the LCD display initialisation after the json files are read in, and added this after the json read:
rotate = 90
if obj['rotate']['value'] == True:
rotate = 270
changed the first line of the LCD display class creation:
rotation = rotate, # Needed to display the right way up on Pirate Audio
After the declaration of the BUTTONS and LABELS variables:
if rotate == 270:
BUTTONS.reverse()
LABELS.reverse()
In handle_buttons(pin) function, replaced the hard coded reference to button pin numbers in the lines “if pin == 5” etc with “if pin == BUTTONS[0]” and so on with BUTTONS[1], BUTTONS[2] (you already use BUTTONS[3] for the Y button).
This works fine for me and I think it enhances the options for your plugin!

1 Like