forked from viewit/KX-Bridge-Release
fix(mqtt): ignore transient 'updated' kobra_state between print/report events
This commit is contained in:
@@ -1325,8 +1325,10 @@ class KobraXBridge:
|
||||
def _on_print(self, payload: dict):
|
||||
d = payload.get("data") or {}
|
||||
kobra_state = payload.get("state", "")
|
||||
self._state["print_state"] = KOBRA_TO_KLIPPER_STATE.get(kobra_state, "printing")
|
||||
|
||||
if kobra_state:
|
||||
self._state["print_state"] = KOBRA_TO_KLIPPER_STATE.get(kobra_state, "printing")
|
||||
if kobra_state != "" and kobra_state != "updated":
|
||||
self._state["kobra_state"] = kobra_state
|
||||
|
||||
# Automatically switch on the camera at print start (settings option).
|
||||
@@ -1435,7 +1437,8 @@ class KobraXBridge:
|
||||
kobra_state = proj_state or d.get("state", "")
|
||||
if kobra_state:
|
||||
self._state["print_state"] = KOBRA_TO_KLIPPER_STATE.get(kobra_state, "standby")
|
||||
self._state["kobra_state"] = kobra_state
|
||||
if kobra_state != "" and kobra_state != "updated":
|
||||
self._state["kobra_state"] = kobra_state
|
||||
# Hide the upload banner after the print ends (Issue #29) - the state also
|
||||
# arrives via info/report (project.state) depending on the printer, not only print/report.
|
||||
if kobra_state in ("finished", "stoped", "canceled"):
|
||||
|
||||
Reference in New Issue
Block a user