Skip to content

Commit

Permalink
serialno
Browse files Browse the repository at this point in the history
  • Loading branch information
anarkiwi committed May 15, 2024
1 parent cf18033 commit 4361a1b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions gamutrf/grinferenceoutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def __init__(
):
self.q = queue.Queue()
self.running = True
self.serialno = 0
self.reporter_thread = threading.Thread(
target=self.run_reporter_thread,
args=(
Expand All @@ -65,7 +66,7 @@ def __init__(
self.set_msg_handler(pmt.intern("inference"), self.receive_pdu)

def receive_pdu(self, pdu):
self.q.put((bytes(pmt.to_python(pmt.cdr(pdu)))))
self.q.put(json.loads(bytes(pmt.to_python(pmt.cdr(pdu))).decode("utf8")))

def stop(self):
self.running = False
Expand Down Expand Up @@ -110,7 +111,8 @@ def run_reporter_thread(
item = self.q.get(block=True, timeout=1)
except queue.Empty:
continue
logging.info("inference output %s", item)
logging.info("inference output %u: %s", self.serialno, item)
self.serialno += 1
if zmq_pub is not None:
zmq_pub.send_string(json.dumps(item) + DELIM, flags=zmq.NOBLOCK)
if mqtt_reporter is not None:
Expand Down

0 comments on commit 4361a1b

Please sign in to comment.