faster hour

This commit is contained in:
j 2021-11-23 12:36:23 +01:00
parent 9c58191722
commit 2a8f137034

View File

@ -178,6 +178,8 @@ class Camera:
n -= step
if self.abort:
return
if self.hour is not None and time.gmtime().tm_hour != self.hour:
return
def sequence(self, steps=[], speed=12, goto_first=True, loop=False, hour_loop=False):
self.sequence_start = 0
@ -185,7 +187,11 @@ class Camera:
#self.goto_preset(steps[0], pan=100, tilt=100, zoom=100)
first = steps[0]
steps = steps[1:]
hour = time.gmtime().tm_hour
if hour_loop:
self.hour = time.gmtime().tm_hour
else:
self.hour = None
while True:
if goto_first:
if isinstance(first, dict):
@ -198,8 +204,8 @@ class Camera:
self.sequence_start = t0 = time.time()
for step in steps:
next_hour = time.gmtime().tm_hour
if hour_loop and next_hour != hour:
hour = next_hour
if hour_loop and next_hour != self.hour:
self.hour = next_hour
break
self.next_target = step
segment_t0 = time.time()