From 40baad6fc685baf0eeca43de6cbd591395ce84e6 Mon Sep 17 00:00:00 2001 From: Konstantinos Kamaropoulos Date: Sun, 5 Jan 2020 20:00:48 +0200 Subject: [PATCH] feat: Split packet into parts --- main.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index b0a06b1..96e6dea 100644 --- a/main.py +++ b/main.py @@ -7,7 +7,16 @@ lora = RYLR896Py.RYLR896("/dev/ttyS0", 115200) lora.SetRFParamsLessThan3KM() def dataHandler(data): - print(data["message"]) + # Split data on '|' separator character + dataSplit = data["message"].split("|") + + drone_id = dataSplit[0] + gprmc = dataSplit[1] + sensors = dataSplit[2:] + + print("drone_id:", drone_id) + print("gprmc:", gprmc) + print("sensors:", sensors) # 2. Listen for data while True: