Fix string identifier format
This commit is contained in:
@@ -36,6 +36,7 @@ class SerialReader:
|
||||
while self._run_event.is_set():
|
||||
line = self.serial.readline()
|
||||
if line:
|
||||
print("Generic method")
|
||||
data = line.decode('utf-8', errors='ignore')
|
||||
self._notify(data)
|
||||
|
||||
@@ -47,4 +48,4 @@ if __name__ == "__main__":
|
||||
|
||||
reader = SerialReader("/dev/ttyUSB1", 57600)
|
||||
reader.subscribe(callback)
|
||||
reader.start()
|
||||
reader.start()
|
||||
|
||||
@@ -21,7 +21,7 @@ class LoraLightSensorReader(SerialReader):
|
||||
match = self.json_pattern.search(line)
|
||||
if match:
|
||||
try:
|
||||
data = json.loads(match.group())
|
||||
data = match.group()
|
||||
self._notify(str(data))
|
||||
except json.JSONDecodeError:
|
||||
print("Received invalid JSON:", match.group())
|
||||
print("Received invalid JSON:", match.group())
|
||||
|
||||
Reference in New Issue
Block a user