Skip to content

Commit

Permalink
debugging calibration mode
Browse files Browse the repository at this point in the history
  • Loading branch information
src1138 committed May 23, 2024
1 parent dd61897 commit 3339add
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions motioneye_scripts/VMFB-MC.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ def sensorsOn(pin=None):
if GPIO.input(PBKA) == 1:
PBKASuspend(pin)
GPIO.output(SIR,1)
global sensorTimer
if sensorTimer.is_alive() is True:
sensorTimer.cancel()
sensorTimer = threading.Timer(sensorTimeout,sensorsOff)
sensorTimer = threading.Timer(sensorTimeout, sensorsOff)
sensorTimer.start()
# Add event detect for DEP and DIS, especially when using a comparator you need a bouncetime
# around 1000ms
Expand Down Expand Up @@ -170,9 +171,10 @@ def motorOn(pin=None):
#print("Start motorOn()")
logEvent("MTR","ON",pin)
GPIO.output(MTR,1)
global motorTimer
if motorTimer.is_alive() is True:
motorTimer.cancel()
motorTimer = threading.Timer(motorTimeout,motorOff)
motorTimer = threading.Timer(motorTimeout, motorOff)
motorTimer.start()
#print("End motorOn()")

Expand Down Expand Up @@ -208,9 +210,10 @@ def timedDispense(pin="TO"):
motorOn(pin)
else:
logEvent("TMR","SUSPENDED",pin)
global timedDispenseTimer
if timedDispenseTimer.is_alive() is True:
timedDispenseTimer.cancel()
timedDispenseTimer = threading.Timer(timedDispensePeriod,timedDispense)
timedDispenseTimer = threading.Timer(timedDispensePeriod, timedDispense)
timedDispenseTimer.start()
#print("End timedDispense()")

Expand All @@ -227,11 +230,12 @@ def TMRSuspend(pin=None):
def TMREnable(pin=None):
#print("Start TMREnable()")
event="DISABLED"
global timedDispenseTimer
if GPIO.input(TMR) == 1:
event="ENABLED"
if timedDispenseTimer.is_alive() is True:
timedDispenseTimer.cancel()
timedDispenseTimer = threading.Timer(timedDispensePeriod,timedDispense)
timedDispenseTimer = threading.Timer(timedDispensePeriod, timedDispense)
timedDispenseTimer.start()
else:
if timedDispenseTimer.is_alive() is True:
Expand All @@ -257,12 +261,14 @@ def PBKAEnable(pin=None):
#print("Start PBKAEnable()")
event="DISABLED"
if GPIO.input(PBKA) == 1:
global PBKAOffTimer
event="ENABLED"
if PBKAOffTimer.is_alive() is True:
PBKAOffTimer.cancel()
PBKAOffTimer = threading.Timer(pbkaOffPeriod, PBKAOn)
PBKAOffTimer.start()
else:
global PBKAOnTimer
if PBKAOnTimer.is_alive() is True:
PBKAOnTimer.cancel()
if PBKAOffTimer.is_alive() is True:
Expand All @@ -276,6 +282,7 @@ def PBKAOn(pin="TO"):
#print("Start PBKAOn()")
logEvent("PBKA","SINK",pin)
GPIO.output(SIR,1)
global PBKAOnTimer
if PBKAOnTimer.is_alive() is True:
PBKAOnTimer.cancel()
PBKAOnTimer = threading.Timer(pbkaOnPeriod, PBKAOff)
Expand All @@ -287,6 +294,7 @@ def PBKAOff(pin="TO"):
#print("Start PBKAOff()")
logEvent("PBKA","IDLE",pin)
GPIO.output(SIR,0)
global PBKAOffTimer
if PBKAOffTimer.is_alive() is True:
PBKAOffTimer.cancel()
PBKAOffTimer = threading.Timer(pbkaOffPeriod, PBKAOn)
Expand Down

0 comments on commit 3339add

Please sign in to comment.