def loadRecipe(recipe):
# Setup the command
cmd = 'AE LoadSetup,' + recipe
# Send the load request
log.debugf('Issue recipe load for %s', recipe)
resp = project.rasco.serial.sendCmd(cmd)
return resp
def sendCmd(command):
# Open Serial
try:
open()
except:
log.warnf('Unable to open RS232 connection on %s', port)
return False
command = start + command + end
system.serial.write(port,hello)
log.trace('Wrote hello to RS232')
try:
x = system.serial.readUntil(port,ready,False)
log.trace('Received ready from RS232')
system.serial.write(port,command)
log.tracef('Wrote %s to RS232', command)
x = system.serial.readUntil(port,hello,False)
log.trace('Received hello from RS232')
system.serial.write(port,ready)
log.trace('Wrote ready to RS232')
resp = system.serial.readUntil(port,end,False)
resp = "".join([i for i in resp if ord(i) in range(32, 127)])
except:
log.warnf('Failed to execute %s to RS232', command)
close()
return False
log.debugf('Executed %s to RS232', command)
# Close serial
close()
return resp