import fido

def firstRun():

    if fido.calibrations.FROM_DISK != True:
        print('calibrations not read from disk')
        
    if fido.configurations.FROM_DISK != True:
        print('configurations not read from disk')

    if fido.constants.FROM_DISK != True:
        print('constants not read from disk')

    if fido.protocols.FROM_DISK != True:
        print('protocols not read from disk')

    print('Press Enter to turn on Red Light')
    input()
    fido.LEDindicators.on1()
    fido.time.sleep(2)
    fido.LEDindicators.off1()
    
    print('Press Enter to turn on Yellow Light')
    input()
    fido.LEDindicators.on2()
    fido.time.sleep(2)
    fido.LEDindicators.off2()

    print('Press Enter and IV will Click')
    input()
    fido.actuator.stateSet(fido.IV)
    fido.time.sleep(1)
    fido.actuator.stateSet(fido.NONE)
    
    print('Press Enter and NAV will Click')
    input()
    fido.actuator.stateSet(fido.NAV)
    fido.time.sleep(1)
    fido.actuator.stateSet(fido.NONE)

    print('Press Enter and PV will Click')
    input()
    fido.actuator.stateSet(fido.PV)
    fido.time.sleep(1)
    fido.actuator.stateSet(fido.NONE)

    print('Press Enter and EV will Click')
    input()
    fido.actuator.stateSet(fido.EV)
    fido.time.sleep(1)
    fido.actuator.stateSet(fido.NONE)

    print('Press Enter and VV will Click')
    input()
    fido.actuator.stateSet(fido.VV)
    fido.time.sleep(1)
    fido.actuator.stateSet(fido.NONE)

    print('Press Enter and WV will Click')
    input()
    fido.actuator.stateSet(fido.WV)
    fido.time.sleep(1)
    fido.actuator.stateSet(fido.NONE)

    print('Press Enter and DV will Click')
    input()
    fido.actuator.stateSet(fido.DV)
    fido.time.sleep(1)
    fido.actuator.stateSet(fido.NONE)

    print('Press Enter and SV will Click')
    input()
    fido.actuator.stateSet(fido.SV)
    fido.time.sleep(1)
    fido.actuator.stateSet(fido.NONE)

    print('Press Enter and SBV will Click')
    input()
    fido.actuator.stateSet(fido.SBV)
    fido.time.sleep(1)
    fido.actuator.stateSet(fido.NONE)

    print('Press Enter and VCV will Click')
    input()
    fido.actuator.stateSet(fido.VCV)
    fido.time.sleep(1)
    fido.actuator.stateSet(fido.NONE)
    
    print('Press Enter and the Vacuum Pump will run')
    input()
    if fido.signals.vacuumraw()<3600:
        print('vacuum sensor is reading low')
    fido.vacuumPump.on()
    fido.time.sleep(3)
    if fido.signals.vacuumraw()>10:
        print('vacuum sensor not reading low enough')
    fido.vacuumPump.off()
    fido.actuator.stateSet(fido.VCV)
    fido.actuator.stateSet(fido.NONE)
    
    print('Press enter to run Clamp and Arm')
    input()
    fido.calClamp()
    fido.arm.pick()
    fido.arm.filter()
    fido.arm.drop()
    fido.arm.clear()
    
    print('Press enter to test cylinder')
    input()
    for x in range(12):
        print(f'seeking tube {x+1}')
        fido.cylinder.tube(x+1)
        
    print('Press Enter to Run PV')
    input()
    fido.actuator.stateSet(fido.PV)
    fido.pv.deliver(4000,500)
    fido.actuator.stateSet(fido.NONE)

    print('Press Enter to Run Decon')
    input()
    fido.actuator.stateSet(fido.DV)
    fido.decon.deliver(4000,500)
    fido.actuator.stateSet(fido.NONE)
    
    print('Place tag on clamp then Press Enter')
    input()
    fido.nfc.read_tag()
    
    print('Insert EMPTY Cylinder, align to tube 1, close lid, press return')
    input()
    fido.signals.countDistance()
    
    print('Connect syringe to waste port, press enter')
    input()
    fido.clamp.fullclose()
    fido.actuator.stateSet(fido.WV+fido.EV)
    fido.signals.flowClear()
    print('Depress syringe then press enter')
    input()
    fido.actuator.stateSet(0)
    if (fido.signals.flowAmount()==0.0):
        print('No flow pulses counted')
    else:
        print('Flow pulses detected')
        
    
    
    
    
