Implement GPIO button hold detection and LED feedback (story 4-1)
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>
This commit is contained in:
@@ -1,11 +1,29 @@
|
||||
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 False
|
||||
return self._button.is_held
|
||||
|
||||
|
||||
class LEDController:
|
||||
def __init__(self, pin: int = LED_GPIO_PIN) -> None:
|
||||
self._led = LED(pin)
|
||||
|
||||
def on(self) -> None:
|
||||
pass
|
||||
self._led.on()
|
||||
|
||||
def off(self) -> None:
|
||||
pass
|
||||
self._led.off()
|
||||
|
||||
Reference in New Issue
Block a user