def connect(self, port=None, baudrate=None): """ Connects to the printer. If port and/or baudrate is provided, uses these settings, otherwise autodetection will be attempted. """ if self._comm is not None: self._comm.close() import astroprint.printer.marlin.comm as comm self._comm = comm.MachineCom(port, baudrate, callbackObject=self)
def doConnect(self, port, baudrate): """ Connects to the printer. """ if self._comm: self._logger.warn('Printer was already connected') return True if port and baudrate: import astroprint.printer.marlin.comm as comm self._comm = comm.MachineCom(port, baudrate, callbackObject=self) return True return False