fix(tx): minor corrections and improvements

This commit is contained in:
2025-12-05 15:22:31 +01:00
parent 5914817d22
commit 0f4f05af03
2 changed files with 95 additions and 12 deletions

View File

@@ -21,25 +21,26 @@ async def tcp_client(file_2_send: str, callsign: str, rs_coding: bool = True):
try:
while message := file_to_send.read(DATA_LEN if rs_coding == True else (PACKET_LEN - HEADER_LEN)):
sent.append([i for i in message])
frame = bytes(framing.encode_packet([i for i in message], callsign, seq, rs_coding))
frame = bytes(framing.encode_packet([i for i in message], callsign, seq%256, rs_coding))
writer.write(frame)
seq += 1
sleep(0.1)
print(seq)
sleep(0.01)
else:
frame = bytes(framing.encode_packet([], callsign, seq, rs_coding))
for _ in range(0,16):
frame = bytes(framing.encode_packet([], callsign, seq%256, rs_coding))
for _ in range(0,4):
writer.write(frame)
sleep(0.1)
sleep(0.01)
sent.append([])
except KeyboardInterrupt:
return sent
rs_coding = False
filename = "loremipsum"
rs_coding = True
filename = "/home/lacko/live_output/2025-11-01_12-39_elektro_lrit_1.691 GHz/IMAGES/ELEKTRO-L3/2025-11-01_12-30-00/msu_gs_Color IR Merge.png"
sent = asyncio.run(tcp_client(filename, "HA5PLS", rs_coding))
with open("packets.json") as packetfile:
with open("packets.json", mode="w") as packetfile:
json.dump(sent, packetfile)