Skip to content

Commit

Permalink
Use DataBrief for telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
AussieSeaweed committed Jan 23, 2025
1 parent 7537bfa commit cead9d1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
python-version: '3.11'
- run: pip install -r requirements.txt
- name: Run style checking
run: flake8 revolution
run: flake8 revolution configurations.py
- name: Run static type checking
run: mypy --strict revolution
run: mypy --strict revolution configurations.py
- name: Run unit tests
run: python -m unittest
- name: Run doctests
Expand Down
8 changes: 4 additions & 4 deletions configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from iclib.mcp23s17 import MCP23S17, PortRegisterBit as PRB
from iclib.mcp4161 import MCP4161
from iclib.nhd_c12864a1z_fsw_fbw_htt import NHDC12864A1ZFSWFBWHTT
from iclib.utilities import ManualCSSPI
from periphery import GPIO, PWM, LockedSPI, Serial, SPI
from iclib.utilities import LockedSPI, ManualCSSPI
from periphery import GPIO, PWM, Serial, SPI

from revolution import (
Application,
Expand All @@ -21,7 +21,7 @@
Power,
PRBS,
Settings,
# Telemetry,
Telemetry,
)

APPLICATION_TYPES: tuple[type[Application], ...] = (
Expand All @@ -31,7 +31,7 @@
# Miscellaneous,
Motor,
Power,
# Telemetry,
Telemetry,
)

CONTEXTS: Contexts = Contexts(
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Sphinx~=8.1.3
battlib==0.0.0.dev2
build~=1.2.2.post1
coverage~=7.6.10
databrief==0.0.1.dev2
door==0.0.4
flake8~=7.1.1
freetype-py~=2.5.1
Expand All @@ -9,5 +11,4 @@ interrogate~=1.7.0
mypy~=1.14.1
numpy~=2.2.2
python-periphery~=2.4.1
Sphinx~=8.1.3
twine~=6.1.0
8 changes: 4 additions & 4 deletions revolution/environment.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from dataclasses import asdict, dataclass, field
from dataclasses import dataclass, field
from enum import auto, Enum
from json import dumps
from logging import getLogger
from queue import Queue
from typing import Any

from databrief import dump
from door.threading2 import AcquirableDoor
from iclib.mcp23s17 import MCP23S17, PortRegisterBit as PRB
from iclib.nhd_c12864a1z_fsw_fbw_htt import NHDC12864A1ZFSWFBWHTT
Expand Down Expand Up @@ -79,8 +79,8 @@ class Contexts:

# Telemetry

def serialize(self) -> str:
return dumps(asdict(self))
def serialize(self) -> bytes:
return dump(self)


@dataclass(frozen=True)
Expand Down
3 changes: 1 addition & 2 deletions revolution/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ def _telemetry(self) -> None:
with self.environment.contexts() as contexts:
assert hasattr(contexts, '_resource')

data = contexts._resource.serialize()
data_token = contexts._resource.serialize()

data_token = data.encode()
checksum_token = md5(data_token).digest()
tokens = (
self.environment.settings.telemetry_begin_token,
Expand Down
2 changes: 1 addition & 1 deletion revolution/tests/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
Miscellaneous,
Motor,
Power,
# Telemetry,
Telemetry,
)

CONTEXTS: Contexts = Contexts(
Expand Down

0 comments on commit cead9d1

Please sign in to comment.