Closed
Description
When using the backlight setting, the value returned is not the value set. For example, the following code:
import time
import board
import math
from adafruit_featherwing import minitft_featherwing
minitft = minitft_featherwing.MiniTFTFeatherWing(cs=board.D11, dc=board.D12)
old = minitft.buttons
while True:
buttons = minitft.buttons
if buttons.right and not old.right:
print("Button RIGHT!")
minitft.backlight = 0.125
print('backlight %g %g' % (.125, minitft.backlight))
if buttons.left and not old.left:
print("Button LEFT!")
minitft.backlight = 0.875
print('backlight now %g %g' % (.875, minitft.backlight))
`
produces
Button RIGHT!
backlight 0.125 0.87451
Button LEFT!
backlight now 0.875 0.121569
At a minimum these values should be consistent between set/get. The following should result in no change to the value:
minitft.brightness = minitft.brightness
Ideally, given the parameter name "brightness" the value 1.0 should be maximum brightness and the value 0.0 should be off for clarity.
Thus line 105:
self._backlight.duty_cycle = int(255 * min(max(1 - brightness, 0.0), 1.0))
should become:
self._backlight.duty_cycle = int(255 * min(max(brightness, 0.0), 1.0))
Metadata
Metadata
Assignees
Labels
No labels