Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

Commit

Permalink
shutter: fix clear, error
Browse files Browse the repository at this point in the history
  • Loading branch information
jordens committed Oct 23, 2018
1 parent c5631b4 commit 2fecc58
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
14 changes: 10 additions & 4 deletions ptb/shutter_protocol.py
Expand Up @@ -37,11 +37,17 @@ async def status(self):
`True` means that there is an error.
"""
ret = (await self.ask(b"e")).strip()
return tuple(bool(int(_)) for _ in ret)
return tuple(c != b"0"[0] for c in ret)

def clear(self):
"""Clear all error flags."""
self.do(b"r")
async def clear(self):
"""Clear all error flags.
Returns:
tuple(bool): Error flag on all channels after clearing.
`True` means that there is an error.
"""
ret = (await self.ask(b"r")).strip()
return tuple(c != b"0"[0] for c in ret)

async def passthrough(self, shutter, cmd):
"""Execute a low level command.
Expand Down
5 changes: 3 additions & 2 deletions test_shutter.py
Expand Up @@ -9,12 +9,13 @@
async def test(dev):
print(dev)
print(await dev.status())
print(await dev.clear())
print(await dev.version())
for i in b"WZ": # STWXYZ
print(i, await dev.passthrough(1, i))
print(chr(i), await dev.passthrough(1, i))

def main():
logging.basicConfig(level=logging.DEBUG)
#logging.basicConfig(level=logging.DEBUG)
loop = asyncio.get_event_loop()
loop.set_debug(False)
async def run():
Expand Down

0 comments on commit 2fecc58

Please sign in to comment.