adapted that start and end time are not required
This commit is contained in:
parent
876ba42d7f
commit
2af579448c
@ -33,7 +33,7 @@ class Configuration():
|
|||||||
|
|
||||||
# timestamps
|
# timestamps
|
||||||
self.now = datetime.datetime.now()
|
self.now = datetime.datetime.now()
|
||||||
self.start_clock = None
|
self.start_clock = [datetime.datetime.now().hour, datetime.datetime.now().minute]
|
||||||
self.end_clock = None
|
self.end_clock = None
|
||||||
|
|
||||||
# paths
|
# paths
|
||||||
@ -90,8 +90,10 @@ class Configuration():
|
|||||||
self.gain = int(line.split(':')[1].strip())
|
self.gain = int(line.split(':')[1].strip())
|
||||||
# ToDo: add option to start now !!!
|
# ToDo: add option to start now !!!
|
||||||
elif 'StartTime' in line:
|
elif 'StartTime' in line:
|
||||||
|
if len(np.array(line.strip().replace(' ', '').split(':')[1:])) > 1:
|
||||||
self.start_clock = np.array(line.strip().replace(' ', '').split(':')[1:], dtype=int)
|
self.start_clock = np.array(line.strip().replace(' ', '').split(':')[1:], dtype=int)
|
||||||
elif 'EndTime' in line:
|
elif 'EndTime' in line:
|
||||||
|
if len(np.array(line.strip().replace(' ', '').split(':')[1:])) > 1:
|
||||||
self.end_clock = np.array(line.strip().replace(' ', '').split(':')[1:], dtype=int)
|
self.end_clock = np.array(line.strip().replace(' ', '').split(':')[1:], dtype=int)
|
||||||
elif 'Gain' in line:
|
elif 'Gain' in line:
|
||||||
self.gain = int(line.split(':')[1].strip())
|
self.gain = int(line.split(':')[1].strip())
|
||||||
@ -262,6 +264,7 @@ class Recorder():
|
|||||||
self.record()
|
self.record()
|
||||||
|
|
||||||
def record(self):
|
def record(self):
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if datetime.datetime.now().hour == self.config.start_clock[0] and datetime.datetime.now().minute == self.config.start_clock[1]:
|
if datetime.datetime.now().hour == self.config.start_clock[0] and datetime.datetime.now().minute == self.config.start_clock[1]:
|
||||||
break
|
break
|
||||||
@ -377,6 +380,7 @@ class Recorder():
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
(np.array(data[last_idx:], dtype=np.float32) / self.config.gain).tofile(self.f)
|
(np.array(data[last_idx:], dtype=np.float32) / self.config.gain).tofile(self.f)
|
||||||
|
if hasattr(self.config.end_clock, '__len__'):
|
||||||
if datetime.datetime.now().hour * 60 + datetime.datetime.now().minute >= self.config.end_clock[0] * 60 + self.config.end_clock[1]:
|
if datetime.datetime.now().hour * 60 + datetime.datetime.now().minute >= self.config.end_clock[0] * 60 + self.config.end_clock[1]:
|
||||||
self.f.flush()
|
self.f.flush()
|
||||||
GPIO.output(self.LED1_pin, GPIO.LOW)
|
GPIO.output(self.LED1_pin, GPIO.LOW)
|
||||||
|
Loading…
Reference in New Issue
Block a user