Example #1
0
File: s3g.py Project: jetty840/s3g
  def get_tool_status(self, tool_index):
    """
    Retrieve some information about the tool
    @param int tool_index: The tool we would like to query for information
    @return A dictionary containing status information about the tool_index
      ExtruderReady : The extruder has reached target temp
      ExtruderNotPluggedIn : The extruder thermocouple is not detected by the bot
      ExturderOverMaxTemp : The temperature measured at the extruder is greater than max allowed
      ExtruderNotHeating : In the first 40 seconds after target temp was set, the extruder is not heating up as expected
      ExtruderDroppingTemp : After reaching and maintaining temperature, the extruder temp has dropped 30 degrees below target
      PlatformError: an error was detected with the platform heater (if the tool supports one).  
        The platform heater will fail if an error is detected with the sensor (thermocouple) 
        or if the temperature reading appears to be unreasonable.
      ExtruderError: An error was detected with the extruder heater (if the tool supports one).  
        The extruder heater will fail if an error is detected with the sensor (thermocouple) or 
        if the temperature reading appears to be unreasonable
    """
    response = self.tool_query(tool_index, slave_query_command_dict['GET_TOOL_STATUS'])

    [resonse_code, bitfield] = Encoder.unpack_response('<BB', response)

    bitfield = Encoder.decode_bitfield(bitfield)

    returnDict = {
      "ExtruderReady"        : bitfield[0], 
      "ExtruderNotPluggedIn" : bitfield[1],
      "ExtruderOverMaxTemp"  : bitfield[2],
      "ExtruderNotHeating"   : bitfield[3],
      "ExtruderDroppingTemp" : bitfield[4],
      "PlatformError"        : bitfield[6],
      "ExtruderError"        : bitfield[7],
    }
    return returnDict
Example #2
0
File: s3g.py Project: jetty840/s3g
  def get_motherboard_status(self):
    """
    Retrieve bits of information about the motherboard
    @return: A python dictionary of various flags and whether theywere set or not at reset
    POWER_ERRPR : An error was detected with the system power.
    HEAT_SHUTDOWN : The heaters were shutdown because the bot was inactive for over 20 minutes
    """
    payload = struct.pack(
      '<B',
      host_query_command_dict['GET_MOTHERBOARD_STATUS'],
    )
  
    response = self.writer.send_query_payload(payload)
    

    [response_code, bitfield] = Encoder.unpack_response('<BB', response)

    bitfield = Encoder.decode_bitfield(bitfield)
    flags = {
    'POWER_ERROR'   : bitfield[7],
    'HEAT_SHUTDOWN' : bitfield[6],
    }
    return flags