Exemplo n.º 1
0
def StartFan():
    success = False
    readFlags()  # diavazei ta flags
    if not myFlags.Door:
        success = standardMotorFunction('31', 'StartFan')
    else:
        app.logger.error("[StartFan] Door OPEN :")
        addError("[StartFan] Door OPEN")
    return success
Exemplo n.º 2
0
def Motor_2_Stop():
    success = False
    readFlags()  # diavazei ta flags
    if not myFlags.Door:
        success = standardMotorFunction('20', 'Motor_2_Stop')
    else:
        app.logger.error("[Motor_2_Stop] Door OPEN :")
        addError("[Motor_2_Stop] Door OPEN")
    return success
Exemplo n.º 3
0
def StopMotors():
    success = False
    if Motor_1_Stop() and Motor_2_Stop():
        app.logger.debug("ALL motors STOPPED")
        addLog("[StopMotors] Motors STOPPED")
        success = True
    else:
        app.logger.error("Could NOT Stop motors")
        addError("[StopMotors] Could NOT Stop motors")
    return success
Exemplo n.º 4
0
def StirLeft():
    success = False
    if Motor_1_Right() and Motor_2_Right():
        app.logger.debug("Started stirring LEFT")
        addLog("Started stirring LEFT")
        success = True
    else:
        app.logger.error("Could not Stir LEFT")
        addError("[StirLeft] Could NOT Stir LEFT")
    return success
Exemplo n.º 5
0
def StirBackward():
    success = False
    if Motor_1_Right() and Motor_2_Left():
        app.logger.debug("Started stirring BACKWARD")
        addLog("Started stirring BACKWARD")
        success = True
    else:
        app.logger.error("Could not Stir BACKWARD")
        addError("[StirBackward] Could NOT Stir BACKWARD")
    return success
Exemplo n.º 6
0
def standardMotorFunction(serialcommand, func):
    x = ""
    success = True
    try:
        myFlags.ser.close()
        myFlags.ser.open()
    except Exception as e:
        app.logger.error("[" + func + "] Cannot Initialize Serial :", e)
        addError("[" + func + "] Cannot Initialize Serial")
    else:
        while x == "":
            x = myFlags.ser.readline()
            time.sleep(.5)
            myFlags.ser.write(serialcommand + '\r\n'.encode())
            print x
        addLog(func + "Started")
        success = True
        myFlags.ser.close()
    return success