Skip to content

Commit dbba535

Browse files
committed
Updated TPS1000 SUP
1 parent b160357 commit dbba535

File tree

1 file changed

+18
-28
lines changed

1 file changed

+18
-28
lines changed

src/geocompy/tps1000/sup.py

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
"""
1515
from __future__ import annotations
1616

17-
from enum import Enum
18-
1917
from ..data import (
2018
toenum,
21-
enumparser
19+
enumparser,
20+
parsebool,
21+
AUTOPOWER
2222
)
2323
from ..protocols import (
2424
GeoComSubsystem,
@@ -34,16 +34,8 @@ class TPS1000SUP(GeoComSubsystem):
3434
allows to automatically display status information.
3535
3636
"""
37-
class ONOFF(Enum):
38-
OFF = 0
39-
ON = 1
40-
41-
class AUTOPOWER(Enum):
42-
DISABLED = 0 # : Automatic poweroff disabled.
43-
SLEEP = 1 # : Put instument into sleep mode.
44-
OFF = 2 # : Poweroff instrument.
4537

46-
def get_config(self) -> GeoComResponse[tuple[ONOFF, AUTOPOWER, int]]:
38+
def get_config(self) -> GeoComResponse[tuple[bool, AUTOPOWER, int]]:
4739
"""
4840
RPC 14001, ``SUP_GetConfig``
4941
@@ -53,7 +45,7 @@ def get_config(self) -> GeoComResponse[tuple[ONOFF, AUTOPOWER, int]]:
5345
-------
5446
GeoComResponse
5547
Params:
56-
- `ONOFF`: Low temperature shutdown.
48+
- `bool`: Low temperature shutdown enabled.
5749
- `AUTOPOWER`: Current shutdown mechanism.
5850
- `int`: Idling timeout [ms].
5951
@@ -65,16 +57,16 @@ def get_config(self) -> GeoComResponse[tuple[ONOFF, AUTOPOWER, int]]:
6557
return self._request(
6658
14001,
6759
parsers=(
68-
enumparser(self.ONOFF),
69-
enumparser(self.AUTOPOWER),
60+
parsebool,
61+
enumparser(AUTOPOWER),
7062
int
7163
)
7264
)
7365

7466
def set_config(
7567
self,
76-
lowtemp: ONOFF | str,
77-
autopower: AUTOPOWER | str = AUTOPOWER.OFF,
68+
lowtemp: bool,
69+
autopower: AUTOPOWER | str = AUTOPOWER.SHUTDOWN,
7870
timeout: int = 600_000
7971
) -> GeoComResponse[None]:
8072
"""
@@ -84,10 +76,10 @@ def set_config(
8476
8577
Parameters
8678
----------
87-
lowtemp : ONOFF | str
88-
Low temperature shutdown.
79+
lowtemp : bool
80+
Enable low temperature shutdown.
8981
autopower : AUTOPOWER | str, optional
90-
Automatic poweroff action.
82+
Automatic poweroff action, by default AUTOPOWER.SHUTDOWN
9183
timeout : int, optional
9284
Idling timeout [60000, 6000000] [ms], by default 600000
9385
@@ -102,16 +94,15 @@ def set_config(
10294
get_config
10395
10496
"""
105-
_autopower = toenum(self.AUTOPOWER, autopower)
106-
_lowtemp = toenum(self.ONOFF, lowtemp)
97+
_autopower = toenum(AUTOPOWER, autopower)
10798
return self._request(
10899
14002,
109-
[_lowtemp.value, _autopower.value, timeout]
100+
[lowtemp, _autopower.value, timeout]
110101
)
111102

112103
def switch_low_temp_control(
113104
self,
114-
state: ONOFF | str
105+
enabled: bool
115106
) -> GeoComResponse[None]:
116107
"""
117108
RPC 14003, ``SUP_SwitchLowTempControl``
@@ -122,8 +113,8 @@ def switch_low_temp_control(
122113
123114
Parameters
124115
----------
125-
state : ONOFF | str
126-
Low temperature shutdown.
116+
enabled : bool
117+
Enable low temperature shutdown.
127118
128119
Returns
129120
-------
@@ -135,8 +126,7 @@ def switch_low_temp_control(
135126
set_config
136127
137128
"""
138-
_state = toenum(self.ONOFF, state)
139129
return self._request(
140130
14003,
141-
[_state.value]
131+
[enabled]
142132
)

0 commit comments

Comments
 (0)