Commit 60437e23 authored by John, Fabian's avatar John, Fabian
Browse files

"fast" version with timestamping on serial receive

parent 0b461fec
......@@ -6,6 +6,9 @@ name = "pypi"
[packages]
paho-mqtt = "==1.5.1"
pyserial = "==3.5"
numpy = "*"
matplotlib = "*"
scipy = "*"
[dev-packages]
......
{
"_meta": {
"hash": {
"sha256": "f8106fc3c02eec4f6f09d02a65e2d2e152fcc8c9cd241fad260074c399e26bf8"
"sha256": "0e5f74cca8f7d5cd6b854d30b51847857c6afdc56c0e9f1f6c68ea826f5c2f1b"
},
"pipfile-spec": 6,
"requires": {
......@@ -16,6 +16,114 @@
]
},
"default": {
"cycler": {
"hashes": [
"sha256:1d8a5ae1ff6c5cf9b93e8811e581232ad8920aeec647c37316ceac982b08cb2d",
"sha256:cd7b2d1018258d7247a71425e9f26463dfb444d411c39569972f4ce586b0c9d8"
],
"version": "==0.10.0"
},
"kiwisolver": {
"hashes": [
"sha256:0cd53f403202159b44528498de18f9285b04482bab2a6fc3f5dd8dbb9352e30d",
"sha256:1e1bc12fb773a7b2ffdeb8380609f4f8064777877b2225dec3da711b421fda31",
"sha256:225e2e18f271e0ed8157d7f4518ffbf99b9450fca398d561eb5c4a87d0986dd9",
"sha256:232c9e11fd7ac3a470d65cd67e4359eee155ec57e822e5220322d7b2ac84fbf0",
"sha256:31dfd2ac56edc0ff9ac295193eeaea1c0c923c0355bf948fbd99ed6018010b72",
"sha256:33449715e0101e4d34f64990352bce4095c8bf13bed1b390773fc0a7295967b3",
"sha256:401a2e9afa8588589775fe34fc22d918ae839aaaf0c0e96441c0fdbce6d8ebe6",
"sha256:44a62e24d9b01ba94ae7a4a6c3fb215dc4af1dde817e7498d901e229aaf50e4e",
"sha256:50af681a36b2a1dee1d3c169ade9fdc59207d3c31e522519181e12f1b3ba7000",
"sha256:563c649cfdef27d081c84e72a03b48ea9408c16657500c312575ae9d9f7bc1c3",
"sha256:5989db3b3b34b76c09253deeaf7fbc2707616f130e166996606c284395da3f18",
"sha256:5a7a7dbff17e66fac9142ae2ecafb719393aaee6a3768c9de2fd425c63b53e21",
"sha256:5c3e6455341008a054cccee8c5d24481bcfe1acdbc9add30aa95798e95c65621",
"sha256:5f6ccd3dd0b9739edcf407514016108e2280769c73a85b9e59aa390046dbf08b",
"sha256:72c99e39d005b793fb7d3d4e660aed6b6281b502e8c1eaf8ee8346023c8e03bc",
"sha256:78751b33595f7f9511952e7e60ce858c6d64db2e062afb325985ddbd34b5c131",
"sha256:834ee27348c4aefc20b479335fd422a2c69db55f7d9ab61721ac8cd83eb78882",
"sha256:8be8d84b7d4f2ba4ffff3665bcd0211318aa632395a1a41553250484a871d454",
"sha256:950a199911a8d94683a6b10321f9345d5a3a8433ec58b217ace979e18f16e248",
"sha256:a357fd4f15ee49b4a98b44ec23a34a95f1e00292a139d6015c11f55774ef10de",
"sha256:a53d27d0c2a0ebd07e395e56a1fbdf75ffedc4a05943daf472af163413ce9598",
"sha256:acef3d59d47dd85ecf909c359d0fd2c81ed33bdff70216d3956b463e12c38a54",
"sha256:b38694dcdac990a743aa654037ff1188c7a9801ac3ccc548d3341014bc5ca278",
"sha256:b9edd0110a77fc321ab090aaa1cfcaba1d8499850a12848b81be2222eab648f6",
"sha256:c08e95114951dc2090c4a630c2385bef681cacf12636fb0241accdc6b303fd81",
"sha256:c5518d51a0735b1e6cee1fdce66359f8d2b59c3ca85dc2b0813a8aa86818a030",
"sha256:c8fd0f1ae9d92b42854b2979024d7597685ce4ada367172ed7c09edf2cef9cb8",
"sha256:ca3820eb7f7faf7f0aa88de0e54681bddcb46e485beb844fcecbcd1c8bd01689",
"sha256:cf8b574c7b9aa060c62116d4181f3a1a4e821b2ec5cbfe3775809474113748d4",
"sha256:d3155d828dec1d43283bd24d3d3e0d9c7c350cdfcc0bd06c0ad1209c1bbc36d0",
"sha256:f8d6f8db88049a699817fd9178782867bf22283e3813064302ac59f61d95be05",
"sha256:fd34fbbfbc40628200730bc1febe30631347103fc8d3d4fa012c21ab9c11eca9"
],
"markers": "python_version >= '3.6'",
"version": "==1.3.1"
},
"matplotlib": {
"hashes": [
"sha256:01c9de93a2ca0d128c9064f23709362e7fefb34910c7c9e0b8ab0de8258d5eda",
"sha256:41b6e307458988891fcdea2d8ecf84a8c92d53f84190aa32da65f9505546e684",
"sha256:48e1e0859b54d5f2e29bb78ca179fd59b971c6ceb29977fb52735bfd280eb0f5",
"sha256:54a026055d5f8614f184e588f6e29064019a0aa8448450214c0b60926d62d919",
"sha256:556965514b259204637c360d213de28d43a1f4aed1eca15596ce83f768c5a56f",
"sha256:5c988bb43414c7c2b0a31bd5187b4d27fd625c080371b463a6d422047df78913",
"sha256:6a724e3a48a54b8b6e7c4ae38cd3d07084508fa47c410c8757e9db9791421838",
"sha256:6be8df61b1626e1a142c57e065405e869e9429b4a6dab4a324757d0dc4d42235",
"sha256:844a7b0233e4ff7fba57e90b8799edaa40b9e31e300b8d5efc350937fa8b1bea",
"sha256:85f0c9cf724715e75243a7b3087cf4a3de056b55e05d4d76cc58d610d62894f3",
"sha256:a78a3b51f29448c7f4d4575e561f6b0dbb8d01c13c2046ab6c5220eb25c06506",
"sha256:b884715a59fec9ad3b6048ecf3860f3b2ce965e676ef52593d6fa29abcf7d330",
"sha256:b8b53f336a4688cfce615887505d7e41fd79b3594bf21dd300531a4f5b4f746a",
"sha256:c70b6311dda3e27672f1bf48851a0de816d1ca6aaf3d49365fbdd8e959b33d2b",
"sha256:ebfb01a65c3f5d53a8c2a8133fec2b5221281c053d944ae81ff5822a68266617",
"sha256:eeb1859efe7754b1460e1d4991bbd4a60a56f366bc422ef3a9c5ae05f0bc70b5",
"sha256:f15edcb0629a0801738925fe27070480f446fcaa15de65946ff946ad99a59a40",
"sha256:f1c5efc278d996af8a251b2ce0b07bbeccb821f25c8c9846bdcb00ffc7f158aa",
"sha256:f72657f1596199dc1e4e7a10f52a4784ead8a711f4e5b59bea95bdb97cf0e4fd",
"sha256:fc4f526dfdb31c9bd6b8ca06bf9fab663ca12f3ec9cdf4496fb44bc680140318",
"sha256:fcd6f1954943c0c192bfbebbac263f839d7055409f1173f80d8b11a224d236da"
],
"index": "pypi",
"version": "==3.4.3"
},
"numpy": {
"hashes": [
"sha256:09858463db6dd9f78b2a1a05c93f3b33d4f65975771e90d2cf7aadb7c2f66edf",
"sha256:209666ce9d4a817e8a4597cd475b71b4878a85fa4b8db41d79fdb4fdee01dde2",
"sha256:298156f4d3d46815eaf0fcf0a03f9625fc7631692bd1ad851517ab93c3168fc6",
"sha256:30fc68307c0155d2a75ad19844224be0f2c6f06572d958db4e2053f816b859ad",
"sha256:423216d8afc5923b15df86037c6053bf030d15cc9e3224206ef868c2d63dd6dc",
"sha256:426a00b68b0d21f2deb2ace3c6d677e611ad5a612d2c76494e24a562a930c254",
"sha256:466e682264b14982012887e90346d33435c984b7fead7b85e634903795c8fdb0",
"sha256:51a7b9db0a2941434cd930dacaafe0fc9da8f3d6157f9d12f761bbde93f46218",
"sha256:52a664323273c08f3b473548bf87c8145b7513afd63e4ebba8496ecd3853df13",
"sha256:550564024dc5ceee9421a86fc0fb378aa9d222d4d0f858f6669eff7410c89bef",
"sha256:5de64950137f3a50b76ce93556db392e8f1f954c2d8207f78a92d1f79aa9f737",
"sha256:640c1ccfd56724f2955c237b6ccce2e5b8607c3bc1cc51d3933b8c48d1da3723",
"sha256:7fdc7689daf3b845934d67cb221ba8d250fdca20ac0334fea32f7091b93f00d3",
"sha256:805459ad8baaf815883d0d6f86e45b3b0b67d823a8f3fa39b1ed9c45eaf5edf1",
"sha256:92a0ab128b07799dd5b9077a9af075a63467d03ebac6f8a93e6440abfea4120d",
"sha256:9f2dc79c093f6c5113718d3d90c283f11463d77daa4e83aeeac088ec6a0bda52",
"sha256:a5109345f5ce7ddb3840f5970de71c34a0ff7fceb133c9441283bb8250f532a3",
"sha256:a55e4d81c4260386f71d22294795c87609164e22b28ba0d435850fbdf82fc0c5",
"sha256:a9da45b748caad72ea4a4ed57e9cd382089f33c5ec330a804eb420a496fa760f",
"sha256:b160b9a99ecc6559d9e6d461b95c8eec21461b332f80267ad2c10394b9503496",
"sha256:b342064e647d099ca765f19672696ad50c953cac95b566af1492fd142283580f",
"sha256:b5e8590b9245803c849e09bae070a8e1ff444f45e3f0bed558dd722119eea724",
"sha256:bf75d5825ef47aa51d669b03ce635ecb84d69311e05eccea083f31c7570c9931",
"sha256:c01b59b33c7c3ba90744f2c695be571a3bd40ab2ba7f3d169ffa6db3cfba614f",
"sha256:d96a6a7d74af56feb11e9a443150216578ea07b7450f7c05df40eec90af7f4a7",
"sha256:dd0e3651d210068d13e18503d75aaa45656eef51ef0b261f891788589db2cc38",
"sha256:e167b9805de54367dcb2043519382be541117503ce99e3291cc9b41ca0a83557",
"sha256:e42029e184008a5fd3d819323345e25e2337b0ac7f5c135b7623308530209d57",
"sha256:f545c082eeb09ae678dd451a1b1dbf17babd8a0d7adea02897a76e639afca310",
"sha256:fde50062d67d805bc96f1a9ecc0d37bfc2a8f02b937d2c50824d186aa91f2419"
],
"index": "pypi",
"version": "==1.21.2"
},
"paho-mqtt": {
"hashes": [
"sha256:9feb068e822be7b3a116324e01fb6028eb1d66412bf98595ae72698965cb1cae"
......@@ -23,6 +131,59 @@
"index": "pypi",
"version": "==1.5.1"
},
"pillow": {
"hashes": [
"sha256:0b2efa07f69dc395d95bb9ef3299f4ca29bcb2157dc615bae0b42c3c20668ffc",
"sha256:114f816e4f73f9ec06997b2fde81a92cbf0777c9e8f462005550eed6bae57e63",
"sha256:147bd9e71fb9dcf08357b4d530b5167941e222a6fd21f869c7911bac40b9994d",
"sha256:15a2808e269a1cf2131930183dcc0419bc77bb73eb54285dde2706ac9939fa8e",
"sha256:196560dba4da7a72c5e7085fccc5938ab4075fd37fe8b5468869724109812edd",
"sha256:1c03e24be975e2afe70dfc5da6f187eea0b49a68bb2b69db0f30a61b7031cee4",
"sha256:1fd5066cd343b5db88c048d971994e56b296868766e461b82fa4e22498f34d77",
"sha256:29c9569049d04aaacd690573a0398dbd8e0bf0255684fee512b413c2142ab723",
"sha256:2b6dfa068a8b6137da34a4936f5a816aba0ecc967af2feeb32c4393ddd671cba",
"sha256:2cac53839bfc5cece8fdbe7f084d5e3ee61e1303cccc86511d351adcb9e2c792",
"sha256:2ee77c14a0299d0541d26f3d8500bb57e081233e3fa915fa35abd02c51fa7fae",
"sha256:37730f6e68bdc6a3f02d2079c34c532330d206429f3cee651aab6b66839a9f0e",
"sha256:3f08bd8d785204149b5b33e3b5f0ebbfe2190ea58d1a051c578e29e39bfd2367",
"sha256:479ab11cbd69612acefa8286481f65c5dece2002ffaa4f9db62682379ca3bb77",
"sha256:4bc3c7ef940eeb200ca65bd83005eb3aae8083d47e8fcbf5f0943baa50726856",
"sha256:660a87085925c61a0dcc80efb967512ac34dbb256ff7dd2b9b4ee8dbdab58cf4",
"sha256:67b3666b544b953a2777cb3f5a922e991be73ab32635666ee72e05876b8a92de",
"sha256:70af7d222df0ff81a2da601fab42decb009dc721545ed78549cb96e3a1c5f0c8",
"sha256:75e09042a3b39e0ea61ce37e941221313d51a9c26b8e54e12b3ececccb71718a",
"sha256:8960a8a9f4598974e4c2aeb1bff9bdd5db03ee65fd1fce8adf3223721aa2a636",
"sha256:9364c81b252d8348e9cc0cb63e856b8f7c1b340caba6ee7a7a65c968312f7dab",
"sha256:969cc558cca859cadf24f890fc009e1bce7d7d0386ba7c0478641a60199adf79",
"sha256:9a211b663cf2314edbdb4cf897beeb5c9ee3810d1d53f0e423f06d6ebbf9cd5d",
"sha256:a17ca41f45cf78c2216ebfab03add7cc350c305c38ff34ef4eef66b7d76c5229",
"sha256:a2f381932dca2cf775811a008aa3027671ace723b7a38838045b1aee8669fdcf",
"sha256:a4eef1ff2d62676deabf076f963eda4da34b51bc0517c70239fafed1d5b51500",
"sha256:c088a000dfdd88c184cc7271bfac8c5b82d9efa8637cd2b68183771e3cf56f04",
"sha256:c0e0550a404c69aab1e04ae89cca3e2a042b56ab043f7f729d984bf73ed2a093",
"sha256:c11003197f908878164f0e6da15fce22373ac3fc320cda8c9d16e6bba105b844",
"sha256:c2a5ff58751670292b406b9f06e07ed1446a4b13ffced6b6cab75b857485cbc8",
"sha256:c35d09db702f4185ba22bb33ef1751ad49c266534339a5cebeb5159d364f6f82",
"sha256:c379425c2707078dfb6bfad2430728831d399dc95a7deeb92015eb4c92345eaf",
"sha256:cc866706d56bd3a7dbf8bac8660c6f6462f2f2b8a49add2ba617bc0c54473d83",
"sha256:d0da39795049a9afcaadec532e7b669b5ebbb2a9134576ebcc15dd5bdae33cc0",
"sha256:f156d6ecfc747ee111c167f8faf5f4953761b5e66e91a4e6767e548d0f80129c",
"sha256:f4ebde71785f8bceb39dcd1e7f06bcc5d5c3cf48b9f69ab52636309387b097c8",
"sha256:fc214a6b75d2e0ea7745488da7da3c381f41790812988c7a92345978414fad37",
"sha256:fd7eef578f5b2200d066db1b50c4aa66410786201669fb76d5238b007918fb24",
"sha256:ff04c373477723430dce2e9d024c708a047d44cf17166bf16e604b379bf0ca14"
],
"markers": "python_version >= '3.6'",
"version": "==8.3.1"
},
"pyparsing": {
"hashes": [
"sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1",
"sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"
],
"markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.4.7"
},
"pyserial": {
"hashes": [
"sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb",
......@@ -30,6 +191,47 @@
],
"index": "pypi",
"version": "==3.5"
},
"python-dateutil": {
"hashes": [
"sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86",
"sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.8.2"
},
"scipy": {
"hashes": [
"sha256:2a0eeaab01258e0870c4022a6cd329aef3b7c6c2b606bd7cf7bb2ba9820ae561",
"sha256:3304bd5bc32e00954ac4b3f4cc382ca8824719bf348aacbec6347337d6b125fe",
"sha256:3f52470e0548cdb74fb8ddf06773ffdcca7c97550f903b1c51312ec19243a7f7",
"sha256:4729b41a4cdaf4cd011aeac816b532f990bdf97710cef59149d3e293115cf467",
"sha256:4ee952f39a4a4c7ba775a32b664b1f4b74818548b65f765987adc14bb78f5802",
"sha256:611f9cb459d0707dd8e4de0c96f86e93f61aac7475fcb225e9ec71fecdc5cebf",
"sha256:6b47d5fa7ea651054362561a28b1ccc8da9368a39514c1bbf6c0977a1c376764",
"sha256:71cfc96297617eab911e22216e8a8597703202e95636d9406df9af5c2ac99a2b",
"sha256:787749110a23502031fb1643c55a2236c99c6b989cca703ea2114d65e21728ef",
"sha256:90c07ba5f34f33299a428b0d4fa24c30d2ceba44d63f8385b2b05be460819fcb",
"sha256:a496b42dbcd04ea9924f5e92be63af3d8e0f43a274b769bfaca0a297327d54ee",
"sha256:bc61e3e5ff92d2f32bb263621d54a9cff5e3f7c420af3d1fa122ce2529de2bd9",
"sha256:c9951e3746b68974125e5e3445008a4163dd6d20ae0bbdae22b38cb8951dc11b",
"sha256:d1388fbac9dd591ea630da75c455f4cc637a7ca5ecb31a6b6cef430914749cde",
"sha256:d13f31457f2216e5705304d9f28e2826edf75487410a57aa99263fa4ffd792c2",
"sha256:d648aa85dd5074b1ed83008ae987c3fbb53d68af619fce1dee231f4d8bd40e2f",
"sha256:da9c6b336e540def0b7fd65603da8abeb306c5fc9a5f4238665cbbb5ff95cf58",
"sha256:e101bceeb9e65a90dadbc5ca31283403a2d4667b9c178db29109750568e8d112",
"sha256:efdd3825d54c58df2cc394366ca4b9166cf940a0ebddeb87b6c10053deb625ea"
],
"index": "pypi",
"version": "==1.7.1"
},
"six": {
"hashes": [
"sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926",
"sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==1.16.0"
}
},
"develop": {}
......
import json
import logging
import paho.mqtt.client as mqtt
from time import sleep
import serial
from enum import Enum
import cmath
import math
from time import sleep
import time
import paho.mqtt.client as mqtt
import logging
import socket
import array
import struct
import ctypes
import threading
import numpy as np
import scipy.interpolate as scipy
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use("TkAgg")
__CompanyName__ = "Technische Hochschule Luebeck, FB E&I, Center of Excellence CoSA"
__FileDescription__ = "This program forwards uart messages to a dedicated serial port"
__FileDescription__ = "This program forwards binary uLoc uart messages to MQTT"
__version__ = "1.0.0"
__author__ = "Fabian John"
__FileVersion__ = __version__
__InternalName__ = "SerialMqttWrapper"
__InternalName__ = "uLocMQTTAdapter"
__LegalCopyright__ = "\xa9 Technische Hochschule Luebeck. All rights reserved."
__OriginalFilename__ = "SerialMqttWrapper.exe"
__ProductName__ = "SerialMqttWrapper"
__OriginalFilename__ = "uLocMQTTAdapter.exe"
__ProductName__ = "uLocMQTTAdapter"
__ProductVersion__ = __version__
......@@ -37,13 +55,14 @@ except:
# generate standard config file if no file is present
cfg = {
'mqtt': {
'broker_ip': "169.254.251.12",
'root_topic': "cosa/lab/serial1/"
'broker_ip': "192.168.0.1",
'root_topic': "cosa/uLoc/cir/"
},
'serial': {
'port': "Com8", #ttyUSB0 for tag
'baud': 9600,
'lf': ser_lf.CRLF
'port': "Com3", #ttyUSB0 for tag
'baud': 921600,
'lf': ser_lf.CRLF,
'cir_len': 180
},
# ---------------------------
# take logging as it is
......@@ -113,26 +132,83 @@ client.on_message = on_message
logging.debug("Try to connect MQTT")
client.connect("127.0.0.1", 1883, 60)
client.connect(cfg['mqtt']['broker_ip'])
while not client.is_connected():
client.loop(1)
client.loop_start()
logging.debug("establishing serial connection")
ser = serial.Serial(timeout=1)
ser.baudrate = cfg['serial']['baud']
ser.port = cfg['serial']['port']
ser.open()
ser.flush()
while not ser.is_open:
client.loop(1)
sleep(0.1)
b_rec = b''
# 16 byte Meta-Data + 180 complex int16 cir-values are send
# Meta: uint16 RmarkerInt, uint16 RmarkerFrac, float strength, float fpStrength, int32_t rxTimestamp
metaLen = 16
binary_rec_len = metaLen + cfg['serial']['cir_len']*4
start_ms = int(round(time.time() * 1000))
while True:
b_rec += ser.read_until(chr(lf_chr[len(lf_chr)-1]))
if len(b_rec) > 1:
if chr(b_rec[len(b_rec)-1]) == chr(lf_chr[len(lf_chr)-1]):
client.publish(cfg['mqtt']['root_topic'] + "raw", b_rec)
try:
cc = str(ser.readline())
if cc[-12:-7] == 'START':
b_rec = b''
client.loop(.1)
while True:
c = ser.read(1)
if c == b'\r':
c2 = ser.read(1)
if c2 == b'\n':
c = c2
else:
b_rec += c
c = c2
b_rec += c
if len(b_rec) >= binary_rec_len:
milliseconds = int(round(time.time() * 1000)) - start_ms
time_b = struct.pack('i', milliseconds)
b_rec += time_b
if False:
logging.debug("Received enough")
arr_size = 180 * 2
(RmarkerInt, RmarkerFrac) = struct.unpack('HH', b_rec[0:4])
(rssiVal, fpStrength) = struct.unpack('ff', b_rec[4:12])
(rxTimestamp) = struct.unpack('i', b_rec[12:metaLen])
logging.info(str(rxTimestamp))
(cir) = struct.unpack(str(int(arr_size)) + 'h', b_rec[metaLen:metaLen+arr_size*2])
cir_offset = 700
cirR = np.array(cir[0:-2:2]).astype(float) * (math.pow(10, (rssiVal / 10)))
cirI = np.array(cir[1:-1:2]).astype(float) * (math.pow(10, (rssiVal / 10)))
lead_edge = (RmarkerInt - cir_offset) * 1e-9 + RmarkerFrac * 1e-9 / 64
t = np.array(range(len(cirR))).astype(float) * 1e-9 - lead_edge
cirC = cirR + 1j * cirI
#phase = scipy.interp1d(t, cmath.phase(cirC[0]))
cirC = cirC * np.exp(-1j * cmath.phase(cirC[0]))
plt.ion()
plt.cla()
plt.plot(t, cirC.real, t, cirC.imag)
plt.pause(.001)
logging.debug("Plotted")
ctrl = ser.readline()
if ctrl == b'START\r\r\n':
client.publish(cfg['mqtt']['root_topic'] + "raw", b_rec)
b_rec = b''
except Exception as ex:
logging.error(ex)
logging.info('Close serial port')
ser.close()
ser.open()
while not ser.is_open:
sleep(0.1)
logging.info('Restarted serial port')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment