faster hour
This commit is contained in:
parent
9c58191722
commit
2a8f137034
12
camera.py
12
camera.py
|
@ -178,6 +178,8 @@ class Camera:
|
||||||
n -= step
|
n -= step
|
||||||
if self.abort:
|
if self.abort:
|
||||||
return
|
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):
|
def sequence(self, steps=[], speed=12, goto_first=True, loop=False, hour_loop=False):
|
||||||
self.sequence_start = 0
|
self.sequence_start = 0
|
||||||
|
@ -185,7 +187,11 @@ class Camera:
|
||||||
#self.goto_preset(steps[0], pan=100, tilt=100, zoom=100)
|
#self.goto_preset(steps[0], pan=100, tilt=100, zoom=100)
|
||||||
first = steps[0]
|
first = steps[0]
|
||||||
steps = steps[1:]
|
steps = steps[1:]
|
||||||
hour = time.gmtime().tm_hour
|
if hour_loop:
|
||||||
|
self.hour = time.gmtime().tm_hour
|
||||||
|
else:
|
||||||
|
self.hour = None
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if goto_first:
|
if goto_first:
|
||||||
if isinstance(first, dict):
|
if isinstance(first, dict):
|
||||||
|
@ -198,8 +204,8 @@ class Camera:
|
||||||
self.sequence_start = t0 = time.time()
|
self.sequence_start = t0 = time.time()
|
||||||
for step in steps:
|
for step in steps:
|
||||||
next_hour = time.gmtime().tm_hour
|
next_hour = time.gmtime().tm_hour
|
||||||
if hour_loop and next_hour != hour:
|
if hour_loop and next_hour != self.hour:
|
||||||
hour = next_hour
|
self.hour = next_hour
|
||||||
break
|
break
|
||||||
self.next_target = step
|
self.next_target = step
|
||||||
segment_t0 = time.time()
|
segment_t0 = time.time()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user