Esempio n. 1
0
def touch_handler(channel, event):
    if channel == 1:
        cfg.blue = not cfg.blue
        if cfg.blue:
            hw.light_blue_on()
            hw.output_one_on()
        else:
            hw.light_blue_off()
            hw.output_one_off()
    if channel == 2:
        cfg.yellow = not cfg.yellow
        if cfg.yellow:
            hw.light_yellow_on()
            hw.output_two_on()
        else:
            hw.light_yellow_off()
            hw.output_two_off()
    if channel == 3:
        cfg.chocks = not cfg.chocks
        if cfg.chocks:
            cfg.watchdog_running = False
            chocks_on()
        else:
            cfg.watchdog_running = True
            chocks_off()
    if channel == 4:
        hw.light_green_blink(0.1)
        cfg.green = True
        time.sleep(5)
        if cfg.chocks:
            hw.light_green_on()
            os.system("sudo -s shutdown -h now")
        else:
            hw.light_green_off()
            cfg.green = False
Esempio n. 2
0
def signal_handler(signal, frame):
    hw.light_blue_blink(0.1)
    cfg.watchdog_active = False
    cfg.camera_active = False
    brakes_on()
    wd.join()
    hw.light_blue_off()
    sys.exit(0)