######
# LEAVE THESE IMPORTS!
######
import functions
import time

######
# config values
######

SERIAL_PORT = '/dev/ttyUSB0'
BAUD_RATE = 9600

LENGTH = 10
REPEAT = 10
DELAY = 10

###
# ^ = pullup, v = pulldown
###
triggers = [
    ['-', False],  #0
    ['^', True],  #1
    ['-', False],  #2
    ['-', False],  #3
    ['-', False],  #4
    ['-', False],  #5
    ['-', False],  #6
    ['-', False],  #7
]

### name, enabled, string to match ###
conditions = [
    ["Flag", True, "TS{", "stop_glitch"],
]

def stop_glitch():
    elapsed = functions.get_glitch_elapsed()

    functions.set_trigger_value(1, False)
    functions.set_uart_switch(False)

    functions.glitching_switch(False)
    functions.add_text(f"[auto] glitching stopped (elapsed: {elapsed})")  