Skip to content

Commit

Permalink
add unit, bit def, value desc to generated beacon docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpdx committed Nov 14, 2023
1 parent 4de5e4a commit 58ef471
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
25 changes: 21 additions & 4 deletions docs/scripts/gen_beacon_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,15 @@ def gen_beacon_rst(config: OreSatConfig, file_path: str, url: str):
lines.append(f'{"-" * len(def_title)}\n')
lines.append("\n")
lines.append(".. csv-table::\n")
lines.append(' :header: "Offset", "Card", "Data Name", "Data Type", "Size", "Description"\n')
lines.append(
' :header: "Offset", "Card", "Name", "Unit", "Data Type", "Size", "Description"\n'
)
lines.append("\n")
offset = 0
size = len(sd)
desc = "\nax.25 packet header (see above)\n"
desc = desc.replace("\n", "\n ")
lines.append(f' "{offset}", "c3", "ax25_header", "octet_str", "{size}", "{desc}"\n')
lines.append(f' "{offset}", "c3", "ax25_header", "", "octet_str", "{size}", "{desc}"\n')
offset += size

for obj in config.beacon_def:
Expand All @@ -165,13 +167,28 @@ def gen_beacon_rst(config: OreSatConfig, file_path: str, url: str):

data_type = OD_DATA_TYPES[obj.data_type]
desc = "\n" + obj.description + "\n"
if obj.name in ["start_chars", "revision"]:
desc += f": {obj.value}\n"
if obj.name == "satellite_id":
sat_id = OreSatId(obj.value)
desc += f": {sat_id.value}\n"
if obj.value_descriptions:
desc += "\n\nValue Descriptions:\n"
for value, descr in obj.value_descriptions.items():
desc += f"\n- {value}: {descr}\n"
if obj.bit_definitions:
desc += "\n\nBit Definitions:\n"
for name_, bits in obj.bit_definitions.items():
desc += f"\n- {name_}: {bits}\n"
desc = desc.replace("\n", "\n ")

lines.append(f' "{offset}", "{card}", "{name}", "{data_type}", "{size}", "{desc}"\n')
lines.append(
f' "{offset}", "{card}", "{name}", "{obj.unit}", "{data_type}", "{size}", "{desc}"\n'
)
offset += size

size = 4
lines.append(f' "{offset}", "c3", "crc32", "uint32", "{size}", "packet checksum"\n')
lines.append(f' "{offset}", "c3", "crc32", "", "uint32", "{size}", "packet checksum"\n')
offset += size

lines.append("\n")
Expand Down
6 changes: 2 additions & 4 deletions oresat_configs/base/c3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ objects:
- index: 0x4000
name: status
data_type: uint8
description: the c3 state
value_descriptions:
65: OFFLINE - This state is never actually reachable by the device. Reset vector is PRE_DEPLOY
66: PRE_DEPLOY - Holding state after deployment of satellite but before deployment of antennas. Ensures a minimum amount of time passes before attempting to deploy antennas and going active
67: DEPLOY - Antenna deployment state. Attempts to deploy antennas several times before moving to Standby
66: PRE_DEPLOY - Holding state after deployment of satellite but before deployment of antennas.
67: DEPLOY - Antenna deployment state.
68: STANDBY Satellite is functional but in standby state. Battery level is too low or tx is disabled
69: BEACON- Active beaconing state. Broadcasts telemetry packets via radio periodically
70: EDL - Currently receiving and/or transmitting engineering data link packets with a groundstation
Expand Down
1 change: 0 additions & 1 deletion oresat_configs/base/cfc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ objects:
- subindex: 0x1
name: status
data_type: uint8
description: the camera status
value_descriptions:
0x1: OFF - Camera is off
0x2: STANDBY - Camera is on not doing anything
Expand Down
1 change: 0 additions & 1 deletion oresat_configs/base/gps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ objects:
- index: 0x4000
name: status
data_type: uint8
description: the gps status
value_descriptions:
0: off
1: searching for gps satellites
Expand Down

0 comments on commit 58ef471

Please sign in to comment.