mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-11 00:37:50 -06:00
Interpret cancelling pre-heat properly
If someone on a different computer cancels the pre-heat, this is now correctly updated locally. Contributes to issue CURA-3360.
This commit is contained in:
parent
d60014fa30
commit
39920c95f3
1 changed files with 19 additions and 8 deletions
|
@ -533,16 +533,27 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||||
self._updatePrinterState(self._json_printer_state["status"])
|
self._updatePrinterState(self._json_printer_state["status"])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
remaining_preheat_time = self._json_printer_state["bed"]["pre_heat"]["remaining"]
|
is_preheating = self._json_printer_state["bed"]["pre_heat"]["active"]
|
||||||
except KeyError: #Old firmware doesn't support that.
|
except KeyError: #Old firmware doesn't support that.
|
||||||
pass #Don't update the time.
|
pass #Don't update the pre-heat remaining time.
|
||||||
else:
|
else:
|
||||||
#Only update if time estimate is significantly off (>5000ms).
|
if is_preheating:
|
||||||
#Otherwise we get issues with latency causing the timer to count inconsistently.
|
try:
|
||||||
if abs(self._preheat_bed_timer.remainingTime() - remaining_preheat_time * 1000) > 5000:
|
remaining_preheat_time = self._json_printer_state["bed"]["pre_heat"]["remaining"]
|
||||||
self._preheat_bed_timer.setInterval(remaining_preheat_time * 1000)
|
except KeyError: #Error in firmware. If "active" is supported, "remaining" should also be supported.
|
||||||
self._preheat_bed_timer.start()
|
pass #Anyway, don't update.
|
||||||
self.preheatBedRemainingTimeChanged.emit()
|
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()
|
||||||
|
else: #Not pre-heating. Must've cancelled.
|
||||||
|
if self._preheat_bed_timer.isActive():
|
||||||
|
self._preheat_bed_timer.setInterval(0)
|
||||||
|
self._preheat_bed_timer.stop()
|
||||||
|
self.preheatBedRemainingTimeChanged.emit()
|
||||||
|
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue