fix: use physical pin numbers
- Changed GPIO mode from BCM to BOARD - Now using physical pin numbers (15 for relay, 7 for status) - Updated pin documentation - Made logging clearer about physical pin numbers
This commit is contained in:
parent
ef770dde37
commit
ee437e9f95
|
|
@ -38,8 +38,8 @@ class MQTTSettings(BaseModel):
|
|||
enabled: bool = False
|
||||
|
||||
class GPIOSettings(BaseModel):
|
||||
gatePin: int = 15 # Relay control pin
|
||||
statusPin: int = 7 # Gate open status pin
|
||||
gatePin: int = 15 # Physical Pin 15 - Relay control pin
|
||||
statusPin: int = 7 # Physical Pin 7 - Gate open status pin
|
||||
|
||||
class LoggingSettings(BaseModel):
|
||||
level: str = "INFO" # Default to INFO level
|
||||
|
|
@ -550,7 +550,7 @@ app.mount("/", StaticFiles(directory="../public", html=True), name="static")
|
|||
def setup_gpio():
|
||||
"""Initialize GPIO pins based on settings"""
|
||||
GPIO.setwarnings(False)
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
GPIO.setmode(GPIO.BOARD) # Use physical pin numbers instead of BCM
|
||||
|
||||
try:
|
||||
settings = app.state.current_settings
|
||||
|
|
@ -567,7 +567,7 @@ def setup_gpio():
|
|||
status_pin = settings.gpio.statusPin
|
||||
GPIO.setup(status_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
||||
|
||||
logger.info(f"GPIO initialized (Gate Pin: {gate_pin}, Status Pin: {status_pin})")
|
||||
logger.info(f"GPIO initialized (Gate Pin: Physical {gate_pin}, Status Pin: Physical {status_pin})")
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to setup GPIO: {e}", exc_info=True)
|
||||
raise
|
||||
|
|
|
|||
Loading…
Reference in New Issue