mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 12:29:02 +08:00
Merge branch 'master' of https://github.com/Ultimaker/Cura
This commit is contained in:
commit
c7a120edd5
@ -251,7 +251,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||
# If the programmer connected, we know its an atmega based version.
|
||||
# Not all that useful, but it does give some debugging information.
|
||||
for baud_rate in self._getBaudrateList(): # Cycle all baud rates (auto detect)
|
||||
Logger.log("d","Attempting to connect to printer with serial %s on baud rate %s", self._serial_port, baud_rate)
|
||||
Logger.log("d", "Attempting to connect to printer with serial %s on baud rate %s", self._serial_port, baud_rate)
|
||||
if self._serial is None:
|
||||
try:
|
||||
self._serial = serial.Serial(str(self._serial_port), baud_rate, timeout = 3, writeTimeout = 10000)
|
||||
@ -260,7 +260,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||
continue
|
||||
else:
|
||||
if not self.setBaudRate(baud_rate):
|
||||
continue # Could not set the baud rate, go to the next
|
||||
continue # Could not set the baud rate, go to the next
|
||||
|
||||
time.sleep(1.5) # Ensure that we are not talking to the bootloader. 1.5 seconds seems to be the magic number
|
||||
sucesfull_responses = 0
|
||||
@ -270,11 +270,13 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||
while timeout_time > time.time():
|
||||
line = self._readline()
|
||||
if line is None:
|
||||
Logger.log("d", "No response from serial connection received.")
|
||||
# Something went wrong with reading, could be that close was called.
|
||||
self.setConnectionState(ConnectionState.closed)
|
||||
return
|
||||
|
||||
if b"T:" in line:
|
||||
Logger.log("d", "Correct response for auto-baudrate detection received.")
|
||||
self._serial.timeout = 0.5
|
||||
sucesfull_responses += 1
|
||||
if sucesfull_responses >= self._required_responses_auto_baud:
|
||||
|
@ -1565,6 +1565,19 @@
|
||||
"settable_per_mesh": false,
|
||||
"settable_per_extruder": true
|
||||
},
|
||||
"max_feedrate_z_override":
|
||||
{
|
||||
"label": "Maximum Z Speed",
|
||||
"description": "The maximal speed with which the bed is moved. Setting this to zero causes the print to use the firmware defaults for the maximum z speed.",
|
||||
"unit": "mm/s",
|
||||
"type": "float",
|
||||
"default_value": 0,
|
||||
"minimum_value": "0",
|
||||
"maximum_value": "299792458000",
|
||||
"maximum_value_warning": "machine_max_feedrate_z",
|
||||
"settable_per_mesh": false,
|
||||
"settable_per_extruder": true
|
||||
},
|
||||
"speed_slowdown_layers":
|
||||
{
|
||||
"label": "Number of Slower Layers",
|
||||
|
@ -19,6 +19,29 @@ Rectangle
|
||||
property real progress: printerConnected ? Cura.MachineManager.printerOutputDevices[0].progress : 0
|
||||
property int backendState: UM.Backend.state
|
||||
|
||||
|
||||
property bool showProgress: {
|
||||
// determine if we need to show the progress bar + percentage
|
||||
if(!printerConnected || !printerAcceptsCommands)
|
||||
return false;
|
||||
|
||||
switch(Cura.MachineManager.printerOutputDevices[0].jobState)
|
||||
{
|
||||
case "printing":
|
||||
case "pre_print": // heating, etc.
|
||||
case "paused":
|
||||
return true;
|
||||
case "wait_cleanup":
|
||||
case "ready": // nut sure if this occurs, "" seems to be the ready state.
|
||||
case "offline":
|
||||
case "abort": // note sure if this jobState actually occurs in the wild
|
||||
case "error": // after clicking abort you apparently get "error"
|
||||
case "": // ready to print
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
property variant statusColor:
|
||||
{
|
||||
if(!printerConnected || !printerAcceptsCommands)
|
||||
@ -96,7 +119,7 @@ Rectangle
|
||||
color: base.statusColor
|
||||
font: UM.Theme.getFont("large")
|
||||
text: Math.round(progress) + "%"
|
||||
visible: printerConnected
|
||||
visible: showProgress
|
||||
}
|
||||
|
||||
Rectangle
|
||||
@ -110,6 +133,7 @@ Rectangle
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
radius: UM.Theme.getSize("progressbar_radius").width
|
||||
color: UM.Theme.getColor("progressbar_background")
|
||||
visible: showProgress
|
||||
|
||||
Rectangle
|
||||
{
|
||||
@ -134,9 +158,8 @@ Rectangle
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
|
||||
text: catalog.i18nc("@label:", "Abort Print")
|
||||
onClicked: Cura.MachineManager.printerOutputDevices[0].setJobState("abort")
|
||||
|
||||
text: catalog.i18nc("@label:", "Abort Print");
|
||||
onClicked: Cura.MachineManager.printerOutputDevices[0].setJobState("abort");
|
||||
|
||||
style: ButtonStyle
|
||||
{
|
||||
@ -206,8 +229,36 @@ Rectangle
|
||||
enabled: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands &&
|
||||
(Cura.MachineManager.printerOutputDevices[0].jobState == "paused" || Cura.MachineManager.printerOutputDevices[0].jobState == "printing")
|
||||
|
||||
text: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? catalog.i18nc("@label:", "Resume") : catalog.i18nc("@label:", "Pause") : ""
|
||||
onClicked: Cura.MachineManager.printerOutputDevices[0].setJobState(Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? "print" : "pause")
|
||||
property bool userClicked: false
|
||||
|
||||
text: {
|
||||
var result = "";
|
||||
if (!printerConnected) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (Cura.MachineManager.printerOutputDevices[0].jobState == "paused")
|
||||
{
|
||||
if (userClicked) {
|
||||
result = catalog.i18nc("@label:", "Resuming...");
|
||||
} else {
|
||||
result = catalog.i18nc("@label:", "Resume");
|
||||
}
|
||||
} else {
|
||||
if (userClicked) {
|
||||
result = catalog.i18nc("@label:", "Pausing...");
|
||||
} else {
|
||||
result = catalog.i18nc("@label:", "Pause");
|
||||
}
|
||||
}
|
||||
userClicked = false;
|
||||
return result;
|
||||
}
|
||||
onClicked: {
|
||||
var newJobState = Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? "print" : "pause";
|
||||
Cura.MachineManager.printerOutputDevices[0].setJobState(newJobState);
|
||||
userClicked = true;
|
||||
}
|
||||
|
||||
style: ButtonStyle
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user