Skip to content

Commit

Permalink
change of the way to call sleep between records
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardosgeral committed Mar 1, 2019
1 parent bd6c5fd commit f0487fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions bash/raspbian-post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ echo '=> Install developer packages'
#
sudo apt-get install -y python3-pandas
sudo apt-get install -y libpq-dev # required to install psycopg2-binary
sudo apt-get install fswebcam # required to take the pictures through the USB port
sudo pip3 install --upgrade pip
python3 -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
sudo pip3 install pygsheets
Expand Down
13 changes: 7 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ def read_display_write(e_rdw): # read and display data in page "record" and writ

while end_rdw.is_set() == False and time.time() < stop+int(inp['interval']):
if time.time() < stop+int(inp['interval']):
t1=time.time()
LED.greenOn()
e_rdw.wait()
current = time.time()
Expand Down Expand Up @@ -402,18 +403,18 @@ def read_display_write(e_rdw): # read and display data in page "record" and writ
row += 1
LED.greenOff()

if ip != 'No internet connection':
delay = 0.16 # interval to write down the readings-- NOTE: -0.16 s because of the time to write values in the database
else:
delay=0

# time to timelapse :)
if doTimelapse == 1:
# take picture in a different threat
t_pics = cm.capture(picsLocation, testname[:-4], testtype, elapsed, data['flow'])
t_pics.start()
#t_pics.join() # takes too long. don't use
sleep(float(inp['interval'])-delay-0.012) # Interval between records # also added a small 0.012 delay
t2=time.time()
delta=t2-t1
if delta >= float(inp['interval']):
delta=float(inp['interval'])-0.5 # half second interval if delta is bigger than interval

sleep(float(inp['interval'])-delta) # Interval between records


### time to make video
Expand Down

0 comments on commit f0487fe

Please sign in to comment.