Skip to content

Commit

Permalink
Make modem transmit queue item format more explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsmonteiro committed Nov 25, 2023
1 parent cf50e69 commit dea1322
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
7 changes: 6 additions & 1 deletion modem/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ def get_c2_mode(self):

def transmit(self, tx_frame_queue):
frame = self.build_frame()
tx_queue_item = [self.get_c2_mode(), 1, 0, frame]
tx_queue_item = {
'mode': self.get_c2_mode(),
'repeat': 1,
'repeat_delay': 0,
'frame': frame
}
tx_frame_queue.put(tx_queue_item)

def run(self, event_queue: queue.Queue, tx_frame_queue: queue.Queue):
Expand Down
10 changes: 4 additions & 6 deletions modem/modem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,14 +1145,12 @@ def worker_transmit(self) -> None:
# we could do a cleanup after a transmission so theres no reason sending twice
queuesize = self.modem_transmit_queue.qsize()
self.log.debug("[MDM] self.modem_transmit_queue", qsize=queuesize)
data = self.modem_transmit_queue.get()
tx = self.modem_transmit_queue.get()

if data[0] in ["morse"]:
self.transmit_morse(repeats=data[1], repeat_delay=data[2], frames=data[3])
if tx['mode'] in ["morse"]:
self.transmit_morse(tx['repeat'], tx['repeat_delay'], tx['frame'])
else:
self.transmit(
mode=data[0], repeats=data[1], repeat_delay=data[2], frames=data[3]
)
self.transmit(tx['mode'], tx['repeat'], tx['repeat_delay'], tx['frame'])
# self.modem_transmit_queue.task_done()

def worker_received(self) -> None:
Expand Down

0 comments on commit dea1322

Please sign in to comment.