Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion applications/flight/lib/radio_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MAX_PACKET_LEN = 240
PACKET_DATA_LEN = MAX_PACKET_LEN - 1
PACKET_DATA_LEN = MAX_PACKET_LEN - 2
14 changes: 10 additions & 4 deletions applications/flight/lib/radio_utils/image_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(self, filepath: str) -> None:
self.found_scan = False
self.file_err = False
self.scan_size = ((self.packet_size - 1) // 64) * 64
self.count = 0
self.priority = 2

def packet(self) -> bool:
Expand Down Expand Up @@ -94,11 +95,15 @@ def packet(self) -> bool:
else:
"""mid packet"""
packet[0] = IMAGE_MID
packet[1] = self.count
packet[2:] = data

packet[1:] = data
# update cursor and count
self.cursor += self.sent_packet_len - 1
self.count += 1

# always needs an ack for these packets
return packet, True
# no longer using Acks for image packets
return packet, False

def done(self) -> bool:
return (self.length <= self.cursor) or self.file_err
Expand All @@ -110,7 +115,8 @@ def ack(self) -> None:
if self.found_scan:
self.in_scan = True
# cursor moves by packet len minus the 1 byte header
self.cursor += self.sent_packet_len - 1
# self.cursor += self.sent_packet_len - 1
# self.count += 1

def __repr__(self) -> str:
return f'<Image: {self.filepath}'