end whats going on if hour changed
This commit is contained in:
parent
2a8f137034
commit
e55b4a678f
13
camera.py
13
camera.py
|
@ -168,17 +168,18 @@ class Camera:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
print('presets loaded')
|
print('presets loaded')
|
||||||
|
|
||||||
|
def hour_changed(self):
|
||||||
|
return self.hour is not None and time.gmtime().tm_hour != self.hour
|
||||||
|
|
||||||
def sleep(self, seconds):
|
def sleep(self, seconds):
|
||||||
n = float(seconds)
|
n = float(seconds)
|
||||||
if self.abort:
|
if self.abort or self.hour_changed():
|
||||||
return
|
return
|
||||||
while n > 0:
|
while n > 0:
|
||||||
step = min(n, 0.5)
|
step = min(n, 0.5)
|
||||||
time.sleep(step)
|
time.sleep(step)
|
||||||
n -= step
|
n -= step
|
||||||
if self.abort:
|
if self.abort or self.hour_changed():
|
||||||
return
|
|
||||||
if self.hour is not None and time.gmtime().tm_hour != self.hour:
|
|
||||||
return
|
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):
|
||||||
|
@ -249,7 +250,7 @@ class Camera:
|
||||||
last = self.status()
|
last = self.status()
|
||||||
|
|
||||||
def goto_preset(self, id, pan, tilt, zoom=1, zoom_last=False):
|
def goto_preset(self, id, pan, tilt, zoom=1, zoom_last=False):
|
||||||
if self.abort:
|
if self.abort or self.hour_changed():
|
||||||
return
|
return
|
||||||
presets = self.get_presets(True)
|
presets = self.get_presets(True)
|
||||||
if isinstance(id, str):
|
if isinstance(id, str):
|
||||||
|
@ -367,7 +368,7 @@ class Camera:
|
||||||
self.continuous(move)
|
self.continuous(move)
|
||||||
if sum(map(abs, move.values())) and not self.abort:
|
if sum(map(abs, move.values())) and not self.abort:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
if self.abort:
|
if self.abort or self.hour_changed():
|
||||||
self.continuous(self.STOP)
|
self.continuous(self.STOP)
|
||||||
return
|
return
|
||||||
self.continuous(self.STOP)
|
self.continuous(self.STOP)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user