Added option to ignore any errors reported by the firmware

Use this carefully. An error reported by your firmware usually hints
at something being off about your printer (e.g. thermistor troubles)
or the firmware not being fully compatible to OctoPrint since
it doesn't recognize a lot of commands.

If you print with this option enabled, it will still fail if you firmware goes
into lockdown, but now it will keep trying to send data to your printer.

That might cause issues. So best not use that option, only if you absolutely
have no other way to get some misbehaving printer to work with
OctoPrint.
This commit is contained in:
Gina Häußge 2016-02-01 16:55:00 +01:00
parent 36ae6dd6b9
commit 0e817d43cc
6 changed files with 27 additions and 6 deletions

View file

@ -338,6 +338,8 @@ class VirtualPrinter():
self._triggerResend(expected=self.lastN)
elif data == "drop_connection":
self._debug_drop_connection = True
elif data == "maxtemp_error":
self.outgoing.put("Error: MAXTEMP triggered!")
else:
try:
sleep_match = VirtualPrinter.sleep_regex.match(data)

View file

@ -85,7 +85,8 @@ def getSettings():
"timeoutSdStatus": s.getFloat(["serial", "timeout", "sdStatus"]),
"log": s.getBoolean(["serial", "log"]),
"additionalPorts": s.get(["serial", "additionalPorts"]),
"longRunningCommands": s.get(["serial", "longRunningCommands"])
"longRunningCommands": s.get(["serial", "longRunningCommands"]),
"ignoreErrorsFromFirmware": s.getBoolean(["serial", "ignoreErrorsFromFirmware"])
},
"folder": {
"uploads": s.getBaseFolder("uploads"),
@ -226,6 +227,7 @@ def setSettings():
if "timeoutSdStatus" in data["serial"].keys(): s.setFloat(["serial", "timeout", "sdStatus"], data["serial"]["timeoutSdStatus"])
if "additionalPorts" in data["serial"] and isinstance(data["serial"]["additionalPorts"], (list, tuple)): s.set(["serial", "additionalPorts"], data["serial"]["additionalPorts"])
if "longRunningCommands" in data["serial"] and isinstance(data["serial"]["longRunningCommands"], (list, tuple)): s.set(["serial", "longRunningCommands"], data["serial"]["longRunningCommands"])
if "ignoreErrorsFromFirmware" in data["serial"]: s.setBoolean(["serial", "ignoreErrorsFromFirmware"], data["serial"]["ignoreErrorsFromFirmware"])
oldLog = s.getBoolean(["serial", "log"])
if "log" in data["serial"].keys(): s.setBoolean(["serial", "log"], data["serial"]["log"])

View file

@ -85,7 +85,8 @@ default_settings = {
"sdStatus": 1
},
"additionalPorts": [],
"longRunningCommands": ["G4", "G28", "G29", "G30", "G32"]
"longRunningCommands": ["G4", "G28", "G29", "G30", "G32"],
"ignoreErrorsFromFirmware": False
},
"server": {
"host": "0.0.0.0",

View file

@ -136,6 +136,7 @@ $(function() {
self.serial_log = ko.observable(undefined);
self.serial_additionalPorts = ko.observable(undefined);
self.serial_longRunningCommands = ko.observable(undefined);
self.serial_ignoreErrorsFromFirmware = ko.observable(undefined);
self.folder_uploads = ko.observable(undefined);
self.folder_timelapse = ko.observable(undefined);
@ -450,6 +451,7 @@ $(function() {
self.serial_log(response.serial.log);
self.serial_additionalPorts(response.serial.additionalPorts.join("\n"));
self.serial_longRunningCommands(response.serial.longRunningCommands.join(", "));
self.serial_ignoreErrorsFromFirmware(response.serial.ignoreErrorsFromFirmware);
self.folder_uploads(response.folder.uploads);
self.folder_timelapse(response.folder.timelapse);
@ -536,7 +538,8 @@ $(function() {
"timeoutSdStatus": self.serial_timeoutSdStatus(),
"log": self.serial_log(),
"additionalPorts": commentableLinesToArray(self.serial_additionalPorts()),
"longRunningCommands": splitTextToArray(self.serial_longRunningCommands(), ",", true)
"longRunningCommands": splitTextToArray(self.serial_longRunningCommands(), ",", true),
"ignoreErrorsFromFirmware": self.serial_ignoreErrorsFromFirmware()
},
"folder": {
"uploads": self.folder_uploads(),

View file

@ -84,4 +84,11 @@
<span class="help-inline">{{ _('Use this to define additional <a href="%%(glob_url)s">glob patterns</a> matching serial ports to list for connecting against, e.g. <code>/dev/ttyAMA*</code>. One entry per line.')|format(glob_url="http://docs.python.org/2/library/glob.html") }}</span>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: serial_ignoreErrorsFromFirmware" id="settings-ignoreErrorsFromFirmware"> {{ _('Ignore any errors from the firmware. Only use this if your firmware sends stuff prefixed with "Error" that is not an actual error. Might mask printer issues, be careful!') }} <span class="label label-important">{{ _('Warning') }}</span>
</label>
</div>
</div>
</form>

View file

@ -242,6 +242,8 @@ class MachineCom(object):
self._resendSwallowRepetitions = settings().getBoolean(["feature", "ignoreIdenticalResends"])
self._resendSwallowRepetitionsCounter = 0
self._ignore_errors = settings().getBoolean(["serial", "ignoreErrorsFromFirmware"])
self._clear_to_send = CountedEvent(max=10, name="comm.clear_to_send")
self._send_queue = TypedQueue()
self._temperature_timer = None
@ -1371,9 +1373,13 @@ class MachineCom(object):
#Ignore unkown command errors, it could be a typo or some missing feature
pass
elif not self.isError():
self._errorValue = line[6:] if line.startswith("Error:") else line[2:]
self._changeState(self.STATE_ERROR)
eventManager().fire(Events.ERROR, {"error": self.getErrorString()})
error_text = line[6:] if line.startswith("Error:") else line[2:]
if not self._ignore_errors:
self._errorValue = error_text
self._changeState(self.STATE_ERROR)
eventManager().fire(Events.ERROR, {"error": self.getErrorString()})
else:
self._log("WARNING! Received an error from the printer's firmware, ignoring that as configured but you might want to investigate what happened here! Error: {}".format(error_text))
return line
def _readline(self):