mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Sync remaining pre-heat time with printer
If multiple instances of Cura are running or Cura is restarted, it now properly syncs the remaining pre-heat time with the printer, so that all instances display the proper time. There's still a bug in here that pressing cancel has no effect the first time since the remaining pre-heat time is updated immediately from the printer before the command to cancel got through remotely. I'll see what I can do to amend that. Also, cancelling is not yet synced. Contributes to issue CURA-3360.
This commit is contained in:
parent
537de489bf
commit
d60014fa30
1 changed files with 12 additions and 0 deletions
|
@ -532,6 +532,18 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
|||
self._updateHeadPosition(head_x, head_y, head_z)
|
||||
self._updatePrinterState(self._json_printer_state["status"])
|
||||
|
||||
try:
|
||||
remaining_preheat_time = self._json_printer_state["bed"]["pre_heat"]["remaining"]
|
||||
except KeyError: #Old firmware doesn't support that.
|
||||
pass #Don't update the time.
|
||||
else:
|
||||
#Only update if time estimate is significantly off (>5000ms).
|
||||
#Otherwise we get issues with latency causing the timer to count inconsistently.
|
||||
if abs(self._preheat_bed_timer.remainingTime() - remaining_preheat_time * 1000) > 5000:
|
||||
self._preheat_bed_timer.setInterval(remaining_preheat_time * 1000)
|
||||
self._preheat_bed_timer.start()
|
||||
self.preheatBedRemainingTimeChanged.emit()
|
||||
|
||||
|
||||
def close(self):
|
||||
Logger.log("d", "Closing connection of printer %s with ip %s", self._key, self._address)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue