Skip to content

Commit

Permalink
Process zmq connection while resetting to ensure first line is displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
woodcoder committed Feb 12, 2024
1 parent 7dbc23e commit ea15e4e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ui/driver/driver_pi.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,14 @@ def send_data(self, cmd, data=[]):

self.HDLC.sendFrame(payload)

if cmd == comms.CMD_RESET and not hasattr(self, 'context'):
# defer this 'til after the initial reset is sent as it slows startup
import zmq
self.context = zmq.Context()
self.socket = self.context.socket(zmq.PUB)
self.socket.bind('tcp://*:%s' % LINE_PUBLISHING_PORT)

def _publish_line(self, row, content):
if not hasattr(self, 'context'):
# defer this 'til needed as it slows startup
import zmq
self.context = zmq.Context()
self.socket = self.context.socket(zmq.PUB)
self.socket.bind('tcp://*:%s' % LINE_PUBLISHING_PORT)
brl = ''.join([braille.pin_num_to_unicode(ch) for ch in content])
brf = ''.join(braille.pin_nums_to_alphas(content))
self.socket.send_pyobj(
Expand Down

0 comments on commit ea15e4e

Please sign in to comment.