Merge branch 'maintenance' into devel

This commit is contained in:
GitHub Nightly Merge Action committed 2023-12-06 00:12:29 +00:00
commit 01e9bc959a
5 files changed
+125 -7

No files matched your search

+8
View File
@@ -201,6 +201,14 @@ Error
Payload:
* ``error``: the error string
* ``reason``: the reason for the error, one of ``firmware``, ``resend``, ``resend_loop``, ``timeout``,
``connection``, ``start_print``, ``autodetect`` or unset.
* ``m112``: whether this error will cause an emergency stop command ``M112`` to be sent to the printer
In case of errors with reason ``firmware``, the following additional fields might be present in the payload:
* ``faq``: a link to the FAQ entry for the error
* ``log``: the last lines from the communication log
PrinterStateChanged
The state of the printer changed.
@@ -337,6 +337,46 @@ function DataUpdater(allViewModels, connectCallback, disconnectCallback) {
),
{error: _.escape(payload.error)}
);
const modal = $("#firmwareErrorModal");
if (modal.length) {
$("#firmwareErrorModalError", modal).text(payload.error);
if (payload.m112) {
$("#firmwareErrorModalDisconnect", modal).hide();
$("#firmwareErrorModalM112", modal).show();
} else {
$("#firmwareErrorModalDisconnect", modal).show();
$("#firmwareErrorModalM112", modal).hide();
}
if (payload.faq) {
$("#firmwareErrorModalFaq a", modal).attr(
"href",
"https://faq.octoprint.org/" + payload.faq
);
$("#firmwareErrorModalFaq", modal).show();
} else {
$("#firmwareErrorModalFaq", modal).hide();
}
const log = $("#firmwareErrorModalLog", modal);
if (payload.log) {
log.empty();
_.each(payload.log, (line) => {
log.append(
'<span class="line">' +
_.escape(line) +
"\n" +
"</span>"
);
});
}
modal.modal("show");
log.scrollTop(log.prop("scrollHeight"));
}
break;
}
case "resend":
@@ -0,0 +1,34 @@
<div id="firmwareErrorModal" class="modal hide fade-in">
<div class="modal-header">
<a href="javascript:void(0)" class="close" data-dismiss="modal" aria-hidden="true">&times;</a>
<h3>{{ _('There was an error reported by your printer') }}</h3>
</div>
<div class="modal-body">
<p>{% trans %}
Your printer's firmware reported an error:
{% endtrans %}</p>
<p style="text-align: center"><strong class="text-error" id="firmwareErrorModalError"></strong></p>
<p id="firmwareErrorModalDisconnect">{% trans %}
Due to this error, OctoPrint was not able to continue to communicate with your printer and
disconnected.
{% endtrans %}</p>
<p id="firmwareErrorModalM112">{% trans %}
Due to this error, OctoPrint was not able to continue to communicate with your printer and
sent an emergency stop command <code>M112</code> to ensure all heaters are turned off, then disconnected.
{% endtrans %}</p>
<p id="firmwareErrorModalFaq">{% trans %}
You might be able to find more information on this error and how to solve it
<a target="_blank" rel="noreferrer noopener">in this FAQ entry</a>!
{% endtrans %}</p>
<p>{% trans %}
Here's the last communication with your printer before this error occurred:
{% endtrans %}</p>
<pre id="firmwareErrorModalLog" class="pre-scrollable pre-output" style="min-height: 200px; max-height: 200px"></pre>
<p><strong>{% trans %}
This error is not caused by OctoPrint, it is a problem that was reported by your printer's firmware to which OctoPrint reacted!
{% endtrans %}</strong></p>
</div>
<div class="modal-footer">
<a href="javascript:void(0)" class="btn" data-dismiss="modal" aria-hidden="true">{{ _('Close') }}</a>
</div>
</div>
+1
View File
@@ -174,6 +174,7 @@
{% include 'dialogs/files.jinja2' %}
{% include 'dialogs/temperature.jinja2' %}
{% include 'dialogs/timelapse.jinja2' %}
{% include 'dialogs/firmwareerror.jinja2' %}
<!-- End of dialogs -->
<!-- Overlays -->
+42 -7
View File
@@ -4072,18 +4072,53 @@ class MachineCom:
def _trigger_error(self, text, reason, close=True):
self._errorValue = text
self._changeState(self.STATE_ERROR)
eventManager().fire(
Events.ERROR, {"error": self.getErrorString(), "reason": reason}
trigger_m112 = (
self._send_m112_on_error
and not self.isSdPrinting()
and reason not in ("connection", "autodetect")
)
payload = self._payload_for_error(reason, close and trigger_m112)
eventManager().fire(Events.ERROR, payload)
if close:
if (
self._send_m112_on_error
and not self.isSdPrinting()
and reason not in ("connection", "autodetect")
):
if trigger_m112:
self._trigger_emergency_stop(close=False)
self.close(is_error=True)
_error_faqs = {
"mintemp": ("mintemp",),
"maxtemp": ("maxtemp",),
"thermal-runaway": ("runaway",),
"heating-failed": ("heating failed",),
"probing-failed": (
"probing failed",
"bed leveling",
"reference point",
"bltouch",
),
}
def _payload_for_error(self, reason, trigger_m112):
error = self.getErrorString()
payload = {
"error": error,
"reason": reason,
"m112": trigger_m112,
}
if reason == "firmware":
payload["log"] = list(self._terminal_log)
error_lower = error.lower()
for faq, triggers in self._error_faqs.items():
if any(trigger in error_lower for trigger in triggers):
payload["faq"] = "firmware-" + faq
break
return payload
def _readline(self):
if self._serial is None:
return None