mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-04 20:43:58 -06:00
Use the new CuraEngine GCode protocol instead of temp files.
This commit is contained in:
parent
c0d39ff287
commit
8d21136530
2 changed files with 11 additions and 15 deletions
|
@ -93,7 +93,7 @@ class PrinterConnection(SignalEmitter):
|
|||
return
|
||||
self._gcode = gcode_list
|
||||
#Reset line number. If this is not done, first line is sometimes ignored
|
||||
self._gcode.insert(0,"M110 N0")
|
||||
self._gcode.insert(0, "M110")
|
||||
self._gcode_position = 0
|
||||
self._print_start_time_100 = None
|
||||
self._is_printing = True
|
||||
|
@ -150,8 +150,7 @@ class PrinterConnection(SignalEmitter):
|
|||
self.setIsConnected(True)
|
||||
return
|
||||
self.setIsConnected(False)
|
||||
|
||||
|
||||
|
||||
## Set the baud rate of the serial. This can cause exceptions, but we simply want to ignore those.
|
||||
def setBaudRate(self, baud_rate):
|
||||
try:
|
||||
|
@ -159,9 +158,7 @@ class PrinterConnection(SignalEmitter):
|
|||
return True
|
||||
except Exception as e:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
|
||||
def setIsConnected(self, state):
|
||||
self._is_connecting = False
|
||||
if self._is_connected != state:
|
||||
|
@ -358,4 +355,3 @@ class PrinterConnection(SignalEmitter):
|
|||
#ret.remove(prev)
|
||||
#ret.insert(0, prev)
|
||||
return ret
|
||||
|
|
@ -113,15 +113,15 @@ class USBPrinterManager(SignalEmitter,PluginObject):
|
|||
})
|
||||
else:
|
||||
Application.getInstance().removeOutputDevice(serial_port)
|
||||
|
||||
def _writeToSerial(self, serial_port):
|
||||
for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()):
|
||||
if type(node) is not SceneNode or not node.getMeshData():
|
||||
continue
|
||||
|
||||
gcode = getattr(node.getMeshData(), 'gcode', False)
|
||||
self.sendGCodeByPort(serial_port,gcode.split('\n'))
|
||||
|
||||
|
||||
gcode_list = getattr(Application.getInstance().getController().getScene(), 'gcode_list', None)
|
||||
if gcode_list:
|
||||
final_list = []
|
||||
for gcode in gcode_list:
|
||||
final_list += gcode.split('\n')
|
||||
self.sendGCodeByPort(serial_port, gcode_list)
|
||||
|
||||
## Get a list of printer connection objects that are connected.
|
||||
def getActiveConnections(self):
|
||||
return [connection for connection in self._printer_connections if connection.isConnected()]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue