66884270a8
Replace stub ButtonHoldDetector and LEDController with real gpiozero implementations; update tests to use MockFactory so they run without physical GPIO hardware. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
30 lines
596 B
Python
30 lines
596 B
Python
import logging
|
|
|
|
from gpiozero import LED, Button
|
|
|
|
from planemapper.constants import RESET_HOLD_S
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
BUTTON_GPIO_PIN = 17
|
|
LED_GPIO_PIN = 27
|
|
|
|
|
|
class ButtonHoldDetector:
|
|
def __init__(self, pin: int = BUTTON_GPIO_PIN) -> None:
|
|
self._button = Button(pin, hold_time=RESET_HOLD_S)
|
|
|
|
def check(self) -> bool:
|
|
return self._button.is_held
|
|
|
|
|
|
class LEDController:
|
|
def __init__(self, pin: int = LED_GPIO_PIN) -> None:
|
|
self._led = LED(pin)
|
|
|
|
def on(self) -> None:
|
|
self._led.on()
|
|
|
|
def off(self) -> None:
|
|
self._led.off()
|