Skip to content

Commit

Permalink
Fix error initializing class Node
Browse files Browse the repository at this point in the history
A recent oresat-configs patch changed class Card from which Node is
subclassed. Cardd now has a few non-init fields and a field that is
init-only so Node needs to be constructed with explicit args now.
  • Loading branch information
ThirteenFish committed Nov 26, 2024
1 parent 6bb2f11 commit 872c365
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions oresat_c3/services/node_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

import json
from dataclasses import asdict, dataclass
from dataclasses import dataclass
from enum import IntEnum
from time import monotonic
from typing import Union
Expand Down Expand Up @@ -108,7 +108,18 @@ def __init__(self, cards: dict, mock_hw: bool = True):
self.opd_addr_to_name = {info.opd_address: name for name, info in cards.items()}
self.node_id_to_name = {info.node_id: name for name, info in cards.items()}

self._data = {name: Node(**asdict(info)) for name, info in cards.items()}
self._data = {
name: Node(
name,
info.nice_name,
info.node_id,
info.processor,
info.opd_address,
info.opd_always_on,
info.child,
)
for name, info in cards.items()
}
self._data["c3"].status = NodeState.ON
self._loops = -1

Expand Down

0 comments on commit 872c365

Please sign in to comment.