polychemprint3.tools.laser6W module

Implements the Tool base class for Danny’s arduino-uno controlled 6W LASER.

First created on Wed Feb 12 2020
Revised: 12/02/2020
Author: Bijal Patel
class polychemprint3.tools.laser6W.laser6W(name='BlueLASER6W', units='percent', devAddress='/dev/ttyACM1', baudRate=115200, commsTimeOut=0.001, __verbose__=1, **kwargs)

Bases: polychemprint3.utility.serialDeviceSpec.serialDeviceSpec, polychemprint3.tools.toolSpec.toolSpec

Implements the Tool base class for Danny’s 6W LASER.

activate()

Makes required connections and returns status bool.

Returns:True if ready to use False if not ready
Return type:bool
checkIfSerialConnectParamsSet()

Goes through connection parameters and sees if all are set.

Returns:True if all parameters are set, false if any unset
Return type:bool
deactivate()

Closes communication and returns status bool.

Returns:True if deactivated False if not deactivated
Return type:bool
disengage()

Toggles Dispense off.

Returns:
  • [1, “Dispense Off”]
  • [0, “Error (Dispense already off”])
  • [-1, ‘Failed engaging dispense ‘ + inst.__str__()]
engage()

Toggles Dispense on.

Returns:
  • [1, “Dispense On”]
  • [0, “Error (Dispense Already On”])
  • [-1, ‘Failed engaging dispense ‘ + inst.__str__()]
getState()

Returns active state of tool.

Parameters
none
Returns
[1, “Tool On”]
[0, “Tool Off”]
[-1, “Error: Tool activation state cannot be determined + Error]
handShakeSerial()

Perform communications handshake with Tool.

Returns:
  • [1, “Handshake Successful”]
  • [0, ‘Handshake Failed, Received (+ message received’]) – if unexpected input received
  • [-1, “Error (Handshake with Tool Failed + error text”])
loadLogSelf(jsonString)

loads json log back into dict.

Parameters:jsonString (String) – json string to be loaded back in
readTime()

Reads in from serial device until timeout.

Returns:
  • [1, inp String of all text read in, empty string if nothing]
  • [0, ‘Read failed + Error’ if exception caught]
setValue(value)

Set Laser PWM value in percent 1-100.

Parameters:value (String) – New value of pressure out of 100
Returns:
  • [output of writeSerialCommand]
  • [-1, “Error (value could not be set for LASER + error text”])
startSerial()

Creates and connects pySerial device.

Returns:
  • [1, “Connected Succesfully to Serial Device”]
  • [0, ‘Not all connection parameters set’]
  • [-1, “Error (Could not connect to serial device: + error text”])
stopSerial()

Terminates communication.

Returns:
  • [1, “Terminated successfully”]
  • [-1, “Error (Tool could not be stopped + error text”])
writeLogSelf()

Generates json string containing dict to be written to log file.

Returns:logJson – log in json string format
Return type:String