Exemple #1
0
def button_select_click(channel):
    global current_mode, ready_to_shutdown, automatic_mode
    automatic_mode = True
    if current_mode == MODE_STOP:
        if not ready_to_shutdown:
            display("STP?")
            ready_to_shutdown = True
        else:
            display("SHUT")
        if not (EXTERNAL_DEBUG_MODE):
            GPIO.cleanup()
            os.system("sudo shutdown now -h")
        else:
            print("DEBUG : SHUTDOWN BUTTON CLICKED")
            exit
    else:
        if not (_current is None):
            _current.onSelect()
Exemple #2
0
def button_select_click(channel):
    global current_mode, ready_to_shutdown, automatic_mode
    automatic_mode = True
    if current_mode == MODE_STOP:
        if not ready_to_shutdown :
            display("STP?")
            ready_to_shutdown = True
        else :
            display("SHUT")
	    if not(EXTERNAL_DEBUG_MODE):
		GPIO.cleanup()
	        os.system("sudo shutdown now -h")
	    else:
		print("DEBUG : SHUTDOWN BUTTON CLICKED")
	    exit
    else :
        if not(_current is None):
            _current.onSelect()
Exemple #3
0
                else:
                    _ledComm.sendLedReset()
                    print "LED Reset"

            delta = (datetime.now() - timer_current)
            sleepduration = (delta.total_seconds() +
                             delta.microseconds / 1000000)

            if sleepduration < TOTAL_SLEEP:
                print "Sleep : " + str(TOTAL_SLEEP - sleepduration)
                time.sleep(TOTAL_SLEEP - sleepduration)
            else:
                print "No sleep"
            timer_lastloop = timer_current
#except:
    try:
        if not (_current is None):
            _current.onStop()
        display("ERR")

        # 3 attempts to light off the led strip
        _ledComm.sendLedReset()
        time.sleep(2)
        _ledComm.sendLedReset()
        time.sleep(2)
        _ledComm.sendLedReset()
    except:
        pass

GPIO.cleanup()
Exemple #4
0
                print "Sent to LED"
            else:
                _ledComm.sendLedReset()
                print "LED Reset"

        delta = (datetime.now() - timer_current)
        sleepduration = (delta.total_seconds() + delta.microseconds / 1000000)

        if sleepduration < TOTAL_SLEEP:
            print "Sleep : " + str(TOTAL_SLEEP - sleepduration)
            time.sleep(TOTAL_SLEEP - sleepduration)
        else:
            print "No sleep"
        timer_lastloop = timer_current
#except:
    try:
        if not(_current is None):
            _current.onStop()
        display("ERR")

        # 3 attempts to light off the led strip
        _ledComm.sendLedReset()
        sleep(2)
        _ledComm.sendLedReset()
        sleep(2)
        _ledComm.sendLedReset()
    except:
        pass

GPIO.cleanup()