Fixed wrong replacement for __progress placeholder in events
Data reported from printer backend is already percent, multiplying it with 100 again produces wrong values.
This commit is contained in:
parent
41f0ed0124
commit
d15262e7cc
1 changed files with 4 additions and 4 deletions
|
|
@ -397,7 +397,7 @@ class CommandTrigger(GenericEventListener):
|
|||
|
||||
currentData = self._printer.get_current_data()
|
||||
|
||||
if "currentZ" in currentData.keys() and currentData["currentZ"] is not None:
|
||||
if "currentZ" in currentData and currentData["currentZ"] is not None:
|
||||
params["__currentZ"] = str(currentData["currentZ"])
|
||||
|
||||
if "job" in currentData and "file" in currentData["job"] and "name" in currentData["job"]["file"] \
|
||||
|
|
@ -405,9 +405,9 @@ class CommandTrigger(GenericEventListener):
|
|||
params["__filename"] = currentData["job"]["file"]["name"]
|
||||
params["__filepath"] = currentData["job"]["file"]["path"]
|
||||
params["__fileorigin"] = currentData["job"]["file"]["origin"]
|
||||
if "progress" in currentData.keys() and currentData["progress"] is not None \
|
||||
and "completion" in currentData["progress"].keys() and currentData["progress"]["completion"] is not None:
|
||||
params["__progress"] = str(round(currentData["progress"]["completion"] * 100))
|
||||
if "progress" in currentData and currentData["progress"] is not None \
|
||||
and "completion" in currentData["progress"] and currentData["progress"]["completion"] is not None:
|
||||
params["__progress"] = str(round(currentData["progress"]["completion"]))
|
||||
|
||||
# now add the payload keys as well
|
||||
if isinstance(payload, dict):
|
||||
|
|
|
|||
Loading…
Reference in a new issue