Compare commits

..

5 Commits

Author SHA1 Message Date
Ninluc 2c0776bdaa Logs the read GPS line
Build, push image, and notify Watchtower / build-image (push) Successful in 1m3s
Build, push image, and notify Watchtower / notify (push) Successful in 12s
2026-08-18 13:19:02 +02:00
Ninluc da93eaa604 Added dashboard link 2026-08-18 13:18:50 +02:00
Ninluc 608e07cb92 We rolling back ? 2026-08-17 23:21:21 +02:00
Ninluc 2ee70861cd Better GPS read 2026-08-17 23:14:18 +02:00
Ninluc af556fde58 Wait more than 2 seconds for better DHT sensor reads 2026-08-17 23:14:10 +02:00
3 changed files with 11 additions and 12 deletions
+2
View File
@@ -2,3 +2,5 @@
`export PYTHONPATH=/home/pi/SmartWave`
`export PYTHONPATH=/home/ninluc/Documents/school/IoT/smartWave`
https://red.smartwave.matthiasg.dev/dashboard
+6 -9
View File
@@ -34,25 +34,22 @@ class GROVEGPS:
self.longitude = -1.0
def read(self):
"""Reads the latest GGA sentence from serial, thread-safely."""
"""Reads the freshest GGA sentence from serial, thread-safely."""
with serial_lock:
# 1. Flush accumulated stale data in the UART buffer
if self.ser.in_waiting > 0:
# 1. Flush accumulated stale buffer data
self.ser.reset_input_buffer()
# 2. Try reading up to 15 lines to catch the freshest GGA sentence
for _ in range(5):
# 2. Read through the fresh incoming stream to find a complete GGA line
for _ in range(15):
raw_bytes = self.ser.readline()
try:
line = raw_bytes.decode('utf-8', errors='ignore').strip()
# log(f"GPS: Read line: {line}")
log(f"GPS: Read line: {line}")
except Exception:
continue
# Supports both $GPGGA and modern $GNGGA sentences
if (line.startswith('$GPGGA') or line.startswith('$GNGGA')) and calculate_nmea_checksum(line):
if self.parse_gga(line):
return True
return self.parse_gga(line)
return False
def parse_gga(self, line):
+1 -1
View File
@@ -24,7 +24,7 @@ def get_temperature_and_humidity():
return None, None
def get_temperature_and_humidity_with_retry(max_retries=4, retry_delay=1.5):
def get_temperature_and_humidity_with_retry(max_retries=4, retry_delay=2.5):
"""
Reads temperature and humidity with retries.
Uses a 1.5s delay between attempts to respect DHT sampling limits.