Closed tomjn closed 10 months ago
Based on set_backlight
in: https://github.com/pimoroni/st7735-python/blob/master/library/ST7735/__init__.py#L201
Tested now my growhat has arrived and failed :( also tried GPIO.HIGH
and GPIO.LOW
with the same results, no change with this PR applied
So it turns out the first batch of Pi grow hats had a diode soldered on back to front and were sold at a discount but now the sale is over some of them are still being sold without the warning.
I've looked up and confirmed on pinout.xyz that it's pin 12, and tested this directly with both wiringpi's gpio
tool and with python directly, nothing turns off the backlight.
I suspect this PR does what's needed, perhaps a PR to the https://github.com/pimoroni/st7735-python repo to add sleep and power off methods would also help but it wouldn't impact the backlight sadly
After receiving a new grow hat with the diode fixed I tested the code and noticed I needed to set the backlight before rendering to the screen or it wouldn't display right, so I've redone my change and force pushed so it's in one nice commit.
I'm pretty happy with the result:
https://github.com/pimoroni/grow-python/assets/58855/701feb05-872f-44a4-b8d3-dc03309a7aed
Just merged and released ST7735 v0.0.5, which this library can now target!
@Gadgetoid this should work even before that, but are you suggesting I switch this over to the new sleep wake methods? Other than changing the code are there any other files to adjust? I'm not sure what sleep does that goes above and beyond turning off the backlight but it makes sense it might inch out a milliamp or two more than just backlight on its own
I can program but I'm not super familiar with how Python dependencies/etc work, most of my personal experience is with things like composer and npm lock files with the odd dabble with ruby bundlers. If it's just switching set_backlight(GPIO.LOW)
to .sleep()
then that's easy enough
Ah it's a case of changing the st7735 line here:
To
st7735>=0.0.5
So when Grow is installed, it'll try to pull in v0.0.5 or greater ensuring the new things are available.
Done, also moved wake
to after the rendering is done to save a few ms of display time while it's rendering
Thank you, I need to get this released :grimacing:
Monitor blacks out the screen when the light is low, but it doesn't do anything to the backlight, limiting its functionality.
This change sets the backlight to zero, and restores it back to 12 when the screen is in use
Related to https://github.com/pimoroni/grow-python/issues/16 and https://github.com/pimoroni/grow-python/issues/15
Note that this doesn't mean the display is unpowered, but hopefully it helps