diff --git a/bash/raspbian-post-install.sh b/bash/raspbian-post-install.sh index aedbaba..0c9b0fe 100644 --- a/bash/raspbian-post-install.sh +++ b/bash/raspbian-post-install.sh @@ -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 diff --git a/main.py b/main.py index 3301093..215668f 100644 --- a/main.py +++ b/main.py @@ -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() @@ -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