✨ Allow disabling of tool sanity check
Should work around rare cases where the firmware reports invalid tools that aren't invalid. Should usually not be needed, but there are enough people with broken configs out there that this might actually help people to stay running, as meh as it is.
This commit is contained in:
1 parent
2cb8b03f7b
commit
258250131f
5 files changed
+28
-7
No files matched your search
@@ -186,6 +186,7 @@ def getSettings():
|
||||
"firmwareDetection": s.getBoolean(["serial", "firmwareDetection"]),
|
||||
"blockWhileDwelling": s.getBoolean(["serial", "blockWhileDwelling"]),
|
||||
"useParityWorkaround": s.get(["serial", "useParityWorkaround"]),
|
||||
"sanityCheckTools": s.getBoolean(["serial", "sanityCheckTools"]),
|
||||
"sendM112OnError": s.getBoolean(["serial", "sendM112OnError"]),
|
||||
"disableSdPrintingDetection": s.getBoolean(["serial", "disableSdPrintingDetection"]),
|
||||
"ackMax": s.getInt(["serial", "ackMax"]),
|
||||
@@ -485,6 +486,7 @@ def _saveSettings(data):
|
||||
value = data["serial"]["useParityWorkaround"]
|
||||
if value in ("always", "detect", "never"):
|
||||
s.set(["serial", "useParityWorkaround"], value)
|
||||
if "sanityCheckTools" in data["serial"]: s.setBoolean(["serial", "sanityCheckTools"], data["serial"]["sanityCheckTools"])
|
||||
if "sendM112OnError" in data["serial"]: s.setBoolean(["serial", "sendM112OnError"], data["serial"]["sendM112OnError"])
|
||||
if "disableSdPrintingDetection" in data["serial"]: s.setBoolean(["serial", "disableSdPrintingDetection"], data["serial"]["disableSdPrintingDetection"])
|
||||
if "ackMax" in data["serial"]: s.setInt(["serial", "ackMax"], data["serial"]["ackMax"])
|
||||
|
||||
@@ -155,6 +155,7 @@ default_settings = {
|
||||
"sendM112OnError": True,
|
||||
"disableSdPrintingDetection": False,
|
||||
"ackMax": 1,
|
||||
"sanityCheckTools": True,
|
||||
|
||||
"capabilities": {
|
||||
"autoreport_temp": True,
|
||||
|
||||
@@ -195,6 +195,7 @@ $(function() {
|
||||
self.serial_firmwareDetection = ko.observable(undefined);
|
||||
self.serial_blockWhileDwelling = ko.observable(undefined);
|
||||
self.serial_useParityWorkaround = ko.observable(undefined);
|
||||
self.serial_sanityCheckTools = ko.observable(undefined);
|
||||
self.serial_supportResendsWithoutOk = ko.observable(undefined);
|
||||
self.serial_logPositionOnPause = ko.observable(undefined);
|
||||
self.serial_logPositionOnCancel = ko.observable(undefined);
|
||||
|
||||
@@ -466,6 +466,15 @@
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>{{ _('Sanity Checking') }}</legend>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: serial_sanityCheckTools" id="settings-sanityCheckTools"> {{ _('Sanity check tool commands') }} <span class="label label-important">{{ _('Warning') }}</span>
|
||||
<span class="help-block">{{ _('If enabled, OctoPrint will not send tool commands to your printer that exceed the number of extruders configured in the active printer profile, or for which the firmware has reported an "invalid extruder" error. Only uncheck this if OctoPrint or your firmware mistakingly mark valid tools as invalid and be sure to investigate the reason for that, it might be a misconfiguration you need to correct for proper operation.') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -533,6 +533,7 @@ class MachineCom(object):
|
||||
self._blocked_commands = settings().get(["serial", "blockedCommands"])
|
||||
self._pausing_commands = settings().get(["serial", "pausingCommands"])
|
||||
self._emergency_commands = settings().get(["serial", "emergencyCommands"])
|
||||
self._sanity_check_tools = settings().getBoolean(["serial", "sanityCheckTools"])
|
||||
|
||||
self._ack_max = settings().getInt(["serial", "ackMax"])
|
||||
self._clear_to_send = CountedEvent(name="comm.clear_to_send", minimum=None, maximum=self._ack_max)
|
||||
@@ -2045,13 +2046,18 @@ class MachineCom(object):
|
||||
|
||||
invalid_tool = self._currentTool
|
||||
|
||||
# log to terminal and remember as invalid
|
||||
self._log("T{} reported as invalid, reverting to T{}".format(invalid_tool, fallback_tool))
|
||||
self._knownInvalidTools.add(invalid_tool)
|
||||
if self._sanity_check_tools:
|
||||
# log to terminal and remember as invalid
|
||||
self._log("T{} reported as invalid, reverting to T{}".format(invalid_tool, fallback_tool))
|
||||
self._knownInvalidTools.add(invalid_tool)
|
||||
|
||||
# we actually do send a T command here instead of just settings self._currentTool just in case
|
||||
# we had any scripts or plugins modify stuff due to the prior tool change
|
||||
self.sendCommand("T{}".format(fallback_tool), tags={"trigger:revert_invalid_tool",})
|
||||
# we actually do send a T command here instead of just settings self._currentTool just in case
|
||||
# we had any scripts or plugins modify stuff due to the prior tool change
|
||||
self.sendCommand("T{}".format(fallback_tool), tags={"trigger:revert_invalid_tool",})
|
||||
else:
|
||||
# just log to terminal, user disabled sanity check
|
||||
self._log("T{} reported as invalid by the firmware, but you've "
|
||||
"disabled tool sanity checking, ignoring".format(invalid_tool))
|
||||
|
||||
##~~ SD Card handling
|
||||
elif 'SD init fail' in line or 'volume.init failed' in line or 'openRoot failed' in line:
|
||||
@@ -3847,7 +3853,9 @@ class MachineCom(object):
|
||||
return None,
|
||||
|
||||
def _validate_tool(self, tool):
|
||||
return tool < self._printerProfileManager.get_current_or_default()["extruder"]["count"] and not tool in self._knownInvalidTools
|
||||
return not self._sanity_check_tools \
|
||||
or (tool < self._printerProfileManager.get_current_or_default()["extruder"]["count"]
|
||||
and not tool in self._knownInvalidTools)
|
||||
|
||||
def _reset_position_timers(self):
|
||||
if self._cancel_position_timer:
|
||||
|
||||
Reference in new issue
Block a user