mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -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"])
|
||||
|
||||
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.
|
||||
pass #Don't update the time.
|
||||
pass #Don't update the pre-heat remaining 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()
|
||||
if is_preheating:
|
||||
try:
|
||||
remaining_preheat_time = self._json_printer_state["bed"]["pre_heat"]["remaining"]
|
||||
except KeyError: #Error in firmware. If "active" is supported, "remaining" should also be supported.
|
||||
pass #Anyway, don't update.
|
||||
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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue