def get_status(printer_address): """ Returns the current printer status. """ info_result = send_gcode(printer_address, GCode.GET_STATUS) printer_info = {} printer_info_fields = ['Status', 'MachineStatus', 'MoveMode', 'Endstop'] for field in printer_info_fields: regex_string = regex_for_field(field) printer_info[field] = re.search(regex_string, info_result).groups()[0] return printer_info
def get_info(printer_address): """ Returns an object with basic printer information such as name etc.""" info_result = send_gcode(printer_address, GCode.GET_INFO) printer_info = {} info_fields = ['Type', 'Name', 'Firmware', 'SN', 'X', 'Tool Count'] for field in info_fields: regex_string = regex_for_field(field) printer_info[field] = re.search(regex_string, info_result).groups()[0] return printer_info
def get_status(printer_address): """ Returns the current printer status. """ send_and_receive(printer_address, request_control_message) info_result = send_and_receive(printer_address, request_status) printer_info = {} printer_info_fields = ['Status', 'MachineStatus', 'MoveMode', 'Endstop'] for field in printer_info_fields: regex_string = regex_for_field(field) printer_info[field] = re.search(regex_string, info_result).groups()[0] return printer_info
def get_info(printer_address): """ Returns an object with basic printer information such as name etc.""" send_and_receive(printer_address, request_control_message) info_result = send_and_receive(printer_address, request_info_message) printer_info = {} info_fields = ['Type', 'Name', 'Firmware', 'SN', 'X', 'Tool Count'] for field in info_fields: regex_string = regex_for_field(field) printer_info[field] = re.search(regex_string, info_result).groups()[0] return printer_info