Undim on button press rather than tmp value
This commit is contained in:
parent
1ed22e8aa8
commit
57346674df
2 changed files with 24 additions and 8 deletions
|
@ -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)
|
||||
|
|
Reference in a new issue