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
|
||||
self.now = datetime.datetime.now()
|
||||
self.start_clock = None
|
||||
self.start_clock = [datetime.datetime.now().hour, datetime.datetime.now().minute]
|
||||
self.end_clock = None
|
||||
|
||||
# paths
|
||||
@ -90,8 +90,10 @@ class Configuration():
|
||||
self.gain = int(line.split(':')[1].strip())
|
||||
# ToDo: add option to start now !!!
|
||||
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)
|
||||
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)
|
||||
elif 'Gain' in line:
|
||||
self.gain = int(line.split(':')[1].strip())
|
||||
@ -262,6 +264,7 @@ class Recorder():
|
||||
self.record()
|
||||
|
||||
def record(self):
|
||||
|
||||
while True:
|
||||
if datetime.datetime.now().hour == self.config.start_clock[0] and datetime.datetime.now().minute == self.config.start_clock[1]:
|
||||
break
|
||||
@ -377,6 +380,7 @@ class Recorder():
|
||||
|
||||
else:
|
||||
(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]:
|
||||
self.f.flush()
|
||||
GPIO.output(self.LED1_pin, GPIO.LOW)
|
||||
|
Loading…
Reference in New Issue
Block a user