|
|
|
@ -56,18 +56,23 @@ if __name__ == '__main__':
|
|
|
|
|
with open('cards/' + cardID + '.json') as card_data:
|
|
|
|
|
data = json.load(card_data)
|
|
|
|
|
event["name"] = data['name']
|
|
|
|
|
if data['secretTools']:
|
|
|
|
|
locked = False
|
|
|
|
|
with open('locked_till.txt', 'rb') as f:
|
|
|
|
|
txt = f.read()
|
|
|
|
|
t = float(txt)
|
|
|
|
|
locked = time.time() < t
|
|
|
|
|
if data['secretTools'] and not locked:
|
|
|
|
|
GPIO.output(pin_config['tools_grn_LED'], GPIO.HIGH)
|
|
|
|
|
else:
|
|
|
|
|
GPIO.output(pin_config['tools_red_LED'], GPIO.HIGH)
|
|
|
|
|
if data['fridge']:
|
|
|
|
|
if data['fridge'] and not locked:
|
|
|
|
|
GPIO.output(pin_config['fridge_grn_LED'], GPIO.HIGH)
|
|
|
|
|
else:
|
|
|
|
|
GPIO.output(pin_config['fridge_red_LED'], GPIO.HIGH)
|
|
|
|
|
timeout = time.time() + 5 # 5 seconds timeout
|
|
|
|
|
wait = True
|
|
|
|
|
while wait:
|
|
|
|
|
if data['secretTools'] and GPIO.input(pin_config['tools_btn']) == 0:
|
|
|
|
|
if data['secretTools'] and GPIO.input(pin_config['tools_btn']) == 0 and not locked:
|
|
|
|
|
GPIO.output(pin_config['fridge_grn_LED'], GPIO.LOW)
|
|
|
|
|
GPIO.output(pin_config['tools_grn_LED'], GPIO.LOW)
|
|
|
|
|
GPIO.output(pin_config['fridge_red_LED'], GPIO.LOW)
|
|
|
|
@ -76,7 +81,7 @@ if __name__ == '__main__':
|
|
|
|
|
wait = False
|
|
|
|
|
# Open tools
|
|
|
|
|
subprocess.call("/home/pi/ELAB-RFID-I2C/RPi/i2c_challenge 0x30", shell=True)
|
|
|
|
|
if data['fridge'] and GPIO.input(pin_config['fridge_btn']) == 0:
|
|
|
|
|
if data['fridge'] and GPIO.input(pin_config['fridge_btn']) == 0 and not locked:
|
|
|
|
|
GPIO.output(pin_config['fridge_grn_LED'], GPIO.LOW)
|
|
|
|
|
GPIO.output(pin_config['tools_grn_LED'], GPIO.LOW)
|
|
|
|
|
GPIO.output(pin_config['fridge_red_LED'], GPIO.LOW)
|
|
|
|
|