Skip to content

Commit 212fd5d

Browse files
committed
Start working on parsing
1 parent 0ee629e commit 212fd5d

File tree

4 files changed

+17
-22
lines changed

4 files changed

+17
-22
lines changed

Dockerfile

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
11
# Python-slim base image
22
FROM python:3.11-slim
33

4-
MAINTAINER Jacob Terkuc
4+
LABEL MAINTAINER="Jacob Terkuc"
5+
LABEL MAINTAINER="Elias Hawa"
56

67
# Update and upgrade packages
78
RUN apt-get update && apt-get upgrade -y && pip install --upgrade pip
89

9-
# Install Virtual Env
10-
RUN pip install virtualenv
11-
1210
# Set the working directory in the container
1311
WORKDIR /app/ground-station
1412

1513
# Copy files
16-
COPY . .
17-
18-
# Set up VENV and "source"
19-
ENV VIRTUAL_ENV=/app/ground-station
20-
RUN python3 -m venv $VIRTUAL_ENV
21-
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
14+
COPY requirements.txt .
2215

2316
# Install any needed packages specified in requirements.txt
2417
RUN pip install -r requirements.txt
2518

19+
# Copy files
20+
COPY . .
21+
2622
# Expose port 33845
2723
EXPOSE 33845/udp
2824

modules/misc/config.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class RadioParameters:
6666
preamble_len: int = 6
6767
cyclic_redundancy: bool = True
6868
iqi: bool = False
69-
sync_word: str = "0x43"
69+
# sync_word: str = "0x43"
7070

7171
def __post_init__(self):
7272
if self.frequency not in range(*LF_RANGE) and self.frequency not in range(*HF_RANGE):
@@ -83,9 +83,9 @@ def __post_init__(self):
8383
if self.preamble_len not in range(*PREAMBLE_RANGE):
8484
raise ValueError(f"Preamble length '{self.preamble_len}' not within allowed range of {PREAMBLE_RANGE}")
8585

86-
if int(self.sync_word, 16) not in range(*SYNC_RANGE):
87-
raise ValueError(f"Sync word '{self.sync_word}' not within allowed range of {SYNC_RANGE}")
88-
self.sync_word = self.sync_word[2:] # Remove 0x
86+
# if int(self.sync_word, 16) not in range(*SYNC_RANGE):
87+
# raise ValueError(f"Sync word '{self.sync_word}' not within allowed range of {SYNC_RANGE}")
88+
# self.sync_word = self.sync_word[2:] # Remove 0x
8989

9090
@classmethod
9191
def from_json(cls, data: JSON) -> Self:
@@ -103,7 +103,7 @@ def from_json(cls, data: JSON) -> Self:
103103
preamble_len=data.get("preamble_len", 6),
104104
cyclic_redundancy=data.get("cyclic_redundancy", True),
105105
iqi=data.get("iqi", False),
106-
sync_word=data.get("sync_word", "0x43"),
106+
# sync_word=data.get("sync_word", "0x43"),
107107
)
108108

109109
def __iter__(self):
@@ -116,7 +116,7 @@ def __iter__(self):
116116
yield "preamble_len", self.preamble_len
117117
yield "cyclic_redundancy", self.cyclic_redundancy
118118
yield "iqi", self.iqi
119-
yield "sync_word", self.sync_word
119+
# yield "sync_word", self.sync_word
120120

121121

122122
@dataclass

modules/serial/rn2483_radio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"preamble_len": "prlen",
3737
"cyclic_redundancy": "crc",
3838
"iqi": "iqi",
39-
"sync_word": "sync",
39+
# "sync_word": "sync",
4040
}
4141

4242

modules/telemetry/v2/block.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,11 @@ class BlockHeader:
6262
#Parse packet header
6363
def parse_packet_header(header_bytes: bytes) -> PacketHeader:
6464
try:
65+
logger.info(header_bytes)
6566
callsign_bytes = header_bytes[:18]
66-
callsign = ''
67-
for c in callsign_bytes:
68-
callsign += chr(c)
69-
timestamp, num_blocks, packet_num = struct.unpack("<HBB", header_bytes[18:])
70-
return PacketHeader(callsign.decode("hex"), timestamp, num_blocks, packet_num)
67+
callsign = bytes.fromhex(callsign_bytes)
68+
timestamp, num_blocks, packet_num = struct.unpack("<HBB", bytes(header_bytes[18:]))
69+
return PacketHeader(callsign, timestamp, num_blocks, packet_num)
7170
except ValueError as e:
7271
raise InvalidHeaderFieldValueError(e)
7372

0 commit comments

Comments
 (0)