Skip to content

Commit

Permalink
fixed aperture report
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Berenz committed Dec 18, 2024
1 parent dc55468 commit b29aca7
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions nightskycam_serialization/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"CommandRunner",
"StatusRunner",
"ConfigRunner",
"ApertureRunner"
"ApertureRunner",
]
"""The list of runner classes defined and used by nightskycam"""

Expand All @@ -73,7 +73,7 @@ class RunnerClasses(Enum):
ConfigRunner = "ConfigRunner"
StatusRunner = "StatusRunner"
ApertureRunner = "ApertureRunner"


def serialize_status(
system: str, status: Iterable[StatusDict], token: Optional[str] = None
Expand Down Expand Up @@ -153,6 +153,7 @@ class AsiCamRunnerEntries(RunnerStatusDict, total=False):
camera_info: Dict[str, str]
pause: bool


class USBCamRunnerEntries(RunnerStatusDict, total=False):
"""
For serializing the status of nightskycam USBCamRunner
Expand Down Expand Up @@ -214,6 +215,7 @@ class ApertureRunnerEntries(RunnerStatusDict, total=False):
"""
For serializing the status of nightskycam ApertureRunner
"""

use: bool
focus: int
status: str
Expand All @@ -222,22 +224,24 @@ class ApertureRunnerEntries(RunnerStatusDict, total=False):
time_window: str


def get_ApertureRunner_report(
sc: ApertureRunnerEntries
)->Dict[str,str]:
def get_ApertureRunner_report(sc: ApertureRunnerEntries) -> Dict[str, str]:
"""
Returns a summary of selected information
"""
if not sc["use"]:
return {"used":"no"}
r: Dict[str,str] = {}
return {"aperture": "used: no"}
r: Dict[str, str] = {}
try:
r["focus"] = sc['focus']
except KeyError:
r["focus"] = "not set"
r["status"] = f"{sc['status']} ({sc['reason']})"
r["using camera activity"]="yes" if sc["use_zwo_camera"] else "no"
if not r["use_zwo_camera"]:
r["using camera activity"] = "yes" if sc["use_zwo_camera"] else "no"
if not sc["use_zwo_camera"]:
r["time window"] = sc["time_window"]
r["focus"]=str(sc["focus"])
return r
r["focus"] = str(sc["focus"])
return {"aperture": "\n".join([f"{k}: {v}" for k,v in r.items()])}


class CommandRunnerEntries(RunnerStatusDict, total=False):
"""
Expand Down

0 comments on commit b29aca7

Please sign in to comment.