feat: минорые изменения после тестирования

This commit is contained in:
2025-11-28 14:20:24 +03:00
parent 5ff0384def
commit d50557a581
12 changed files with 80 additions and 28 deletions
+9 -2
View File
@@ -34,7 +34,7 @@ LED_PIN_NUM = get_env_int("LED_PIN")
LED_PIN = getattr(board, f"D{LED_PIN_NUM}")
GAMMA = get_env_float("GAMMA")
TIMEOUT = get_env_float("TIMEOUT")
TIMEOUT_SECONDS = get_env_float("TIMEOUT_SECONDS")
IDLE_SPEED = get_env_float("IDLE_SPEED")
IDLE_BRIGHTNESS = get_env_float("IDLE_BRIGHTNESS")
@@ -579,7 +579,7 @@ class LightsDaemon(lights_pb2_grpc.LightsServicer):
def loop(self):
while self._running:
with self._lock:
if self._control_mode and time.time() - self._last_ping > TIMEOUT:
if self._control_mode and time.time() - self._last_ping > TIMEOUT_SECONDS:
self._control_mode = False
self._pixels.brightness = IDLE_BRIGHTNESS
self._animation = IdleAnimation()
@@ -597,6 +597,13 @@ class LightsDaemon(lights_pb2_grpc.LightsServicer):
self._control_mode = True
self._last_ping = time.time()
def Disconnect(self, request, context):
with self._lock:
self._control_mode = False
self._pixels.brightness = IDLE_BRIGHTNESS
self._animation = IdleAnimation()
return lights_pb2.Empty()
def Ping(self, request, context):
self._update_last_ping()
return lights_pb2.Empty()