Undim on button press rather than tmp value

This commit is contained in:
Edgar P. Burkhart 2024-12-14 10:18:40 +01:00
parent 1ed22e8aa8
commit 57346674df
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 24 additions and 8 deletions

View file

@ -41,6 +41,7 @@ class Screen:
self._held = False
self.sense.stick.direction_middle = self.stick_click
self.sense.stick.direction_any = self.auto_dim.undim
@property
def value(self) -> None | str:
@ -161,11 +162,11 @@ class AutoDim(Thread):
def auto_dim(self) -> None:
accel_z = self.sense.get_accelerometer_raw()["z"]
if not self.switching and accel_z < 0.9:
if not self.switching and accel_z < 0.2:
self.switching = True
self.dim = not self.dim
elif self.switching and accel_z > 0.98:
elif self.switching and accel_z > 0.9:
self.switching = False
@property
@ -180,6 +181,9 @@ class AutoDim(Thread):
self.sense.gamma_reset()
self._dim = value
def undim(self) -> None:
self.dim = False
def format_value(value: float) -> str:
v = math.trunc(value)