Explorar o código

added field check

subDesTagesMitExtraKaese %!s(int64=3) %!d(string=hai) anos
pai
achega
cd3f002132
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      raspberry-pi/connection.py

+ 2 - 2
raspberry-pi/connection.py

@@ -75,7 +75,7 @@ class SerialConnection:
 class ArduinoSlave(SerialConnection):
   def __init__(self):
     super().__init__()
-    self.sensorData = [0] * 12
+    self.sensorData = [0] * 13
     self._recvCbs = []
     self._t = None
 
@@ -130,7 +130,7 @@ class ArduinoSlave(SerialConnection):
       if data:
         data = str(data, "ASCII")
         vals = data.split('\t')
-        if vals[0] == "DATA:":
+        if vals[0] == "DATA:" and len(vals) >= 13:
           self.sensorData = vals[1:]
           for cb in self._recvCbs:
             cb(self.sensorData)