1
0
mirror of https://github.com/gryf/linak-ctrl.git synced 2025-12-19 04:10:18 +01:00

Handle keyboard interrupt exception for status with loop.

This commit is contained in:
2021-02-28 10:12:16 +01:00
parent a6d87afc42
commit 53b0f85ebb

View File

@@ -115,12 +115,15 @@ class LinakDevice:
def get_position(self, loop=False):
if loop:
try:
while True:
report = self._get_report()
LOG.warning('Position: %s, height: %.2fcm, moving: %s',
report.position, report.position_in_cm,
report.moving)
time.sleep(0.2)
except KeyboardInterrupt:
return
else:
report = self._get_report()
LOG.warning('Position: %s, height: %scm, moving: %s',