Auto power-on the SIM868 module via its PWRKEY GPIO line
Root-caused a "GPS not working" report to the SIM868 module chip being fully powered off (the HAT's 5V rail can be live while the chip itself stays off until PWRKEY is triggered) - confirmed by getting zero AT response at any baud rate while the app's GPS thread had the serial port open normally. Discovered this specific HAT revision has the "P4" GPIO power-on mod wire installed (Waveshare FAQ / GSM_PWRKEY.rar script), letting PWRKEY be triggered via physical pin 7 (BCM GPIO4) instead of a manual button press. Verified live: pulsing it low for 4s then high brought the module from zero AT response to responding immediately. modules/app_gps.py: added _module_responds()/_pulse_pwrkey()/ _ensure_module_powered(), wired into _poll_loop() before the existing GNSS power-on check. Checks AT first and only pulses PWRKEY if the module isn't already responding, since PWRKEY is a toggle (pulsing an already-on module would turn it back off). Also fixed a related logging gap found while debugging: print() diagnostics from app_gps.py were invisible in yaris-obd.log for months because Python fully-buffers stdout when it isn't a TTY. deploy/yaris-obd.service now sets PYTHONUNBUFFERED=1. requirements.txt: added RPi.GPIO. PLAN.md: documented both findings and the Pi deploy gotchas (systemd unit file changes need a manual copy + daemon-reload; requirements.txt changes need a manual venv pip install - neither is picked up by a plain git pull + restart). Co-authored-by: Copilot <[email protected]>
This commit is contained in:
@@ -8,6 +8,10 @@ Type=simple
|
||||
User=yaris
|
||||
Group=yaris
|
||||
WorkingDirectory=/home/yaris/app/yaris-obd
|
||||
# Unbuffered stdout so print() diagnostics (GPS/GNSS status, etc.) actually reach
|
||||
# the log file promptly instead of sitting in Python's stdout buffer indefinitely
|
||||
# when it's redirected to a file instead of a TTY.
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
ExecStart=/home/yaris/app/yaris-obd/venv/bin/python app.py
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
Reference in New Issue
Block a user