Skip to content

Commit

Permalink
cover: fix up & down methods
Browse files Browse the repository at this point in the history
  • Loading branch information
willoma committed Jul 7, 2023
1 parent c701162 commit b0f7f38
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
38 changes: 20 additions & 18 deletions pycalaos/item/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,6 @@ def _translate(self, state: str):
infos = state.split()
return {"action": OutputShutterAction(infos[0]), "position": int(infos[1])}

def up(self):
self._send("up")

def down(self):
self._send("down")

def stop(self):
self._send("stop")
self._update_state()
Expand All @@ -262,20 +256,28 @@ def set(self, value):
self._send(f"set {value}")
self._state = value

def up(self, value):
if value < 1:
value = 1
elif value > 100:
value = 100
self._send(f"up {value}")
def up(self, value=0):
if value == 0:
self._send(f"up")
return
else:
if value < 1:
value = 1
elif value > 100:
value = 100
self._send(f"up {value}")
self._update_state()

def down(self, value):
if value < 1:
value = 1
elif value > 100:
value = 100
self._send(f"down {value}")
def down(self, value=0):
if value == 0:
self._send(f"down")
return
else:
if value < 1:
value = 1
elif value > 100:
value = 100
self._send(f"down {value}")
self._update_state()

def calibrate(self):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pycalaos"
version = "0.0.23"
version = "0.0.24"
authors = [
{ name = "Willow Maccagnoni", email = "[email protected]" },
]
Expand Down

0 comments on commit b0f7f38

Please sign in to comment.