backend stub rpm behaviour changed to incremental

This commit is contained in:
Mikkeli Matlock
2026-01-26 18:14:14 +09:00
parent d60d3a7a30
commit d6825eb9d9

View File

@@ -229,15 +229,21 @@ class ArduinoService:
"""Fake data for testing without Arduino connected.""" """Fake data for testing without Arduino connected."""
import random import random
_rpm = 3000
while self._running: while self._running:
self._connected = True self._connected = True
data = { data = {
"time": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), "time": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
"voltage": round(12.0 + random.uniform(-0.5, 0.8), 2), "voltage": round(12.0 + random.uniform(-0.5, 0.8), 2),
"rpm": random.randint(800, 6000) if random.random() > 0.3 else None, "rpm": _rpm if random.random() > 0.1 else None,
"eng_temp": random.randint(60, 95), "eng_temp": random.randint(60, 95),
"gear": random.randint(1, 6) if random.random() > 0.2 else 0, # 0 = neutral "gear": random.randint(1, 6) if random.random() > 0.2 else 0, # 0 = neutral
} }
_rpm += 10
if _rpm > 7500:
_rpm = 500
with self._lock: with self._lock:
self._latest = data self._latest = data
self._buffer.append(data) self._buffer.append(data)