From d711133b86e711d6af0184259c5b17242048ba98 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 7 Dec 2020 11:30:14 +0100 Subject: [PATCH] no elevation --- camera.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/camera.py b/camera.py index 74da3a6..b36a84f 100644 --- a/camera.py +++ b/camera.py @@ -289,11 +289,11 @@ class Camera: #print(current, delta, move) current, delta = get_delta() changed = False - if 'azimuth' in delta and 'azimuth' in direction: + if delta and 'azimuth' in delta and 'azimuth' in direction: if pan and (not delta['azimuth'] or (delta['azimuth'] >= 0) != direction['azimuth']): pan = 0 changed = True - else: + elif delta: print('why no azimuth? delta: %s direction: %s' % (delta, direction)) ''' if pan > 0: @@ -303,9 +303,13 @@ class Camera: pan = max(pan, delta['azimuth']) changed = True ''' - if tilt and (not delta['elevation'] or (delta['elevation'] >= 0) != direction['elevation']): - tilt = 0 - changed = True + if delta and 'elevation' in delta and 'elevation' in direction: + if tilt and delta and (not delta['elevation'] or (delta['elevation'] >= 0) != direction['elevation']): + tilt = 0 + changed = True + elif delta: + print('why no elevation? delta: %s direction: %s' % (delta, direction)) + ''' if tilt > 0: tilt = min(tilt, delta['elevation'])