Added a "fake ack" button to terminal tab, as counter measure for lost "ok"s
In case an ok gets lost on the line, this allows to have the communication between OctoPrint and the printer take up again.
This commit is contained in:
1 parent
4ea6bcd1de
commit
fb5aaffdc1
7 files changed
+64
-2
No files matched your search
@@ -97,6 +97,14 @@ class PrinterInterface(object):
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def fake_ack(self):
|
||||
"""
|
||||
Fakes an acknowledgement for the communication layer. If the communication between OctoPrint and the printer
|
||||
gets stuck due to lost "ok" responses from the server due to communication issues, this can be used to get
|
||||
things going again.
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def commands(self, commands):
|
||||
"""
|
||||
Sends the provided ``commands`` to the printer.
|
||||
|
||||
@@ -212,6 +212,12 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
return self._comm.getTransport()
|
||||
getTransport = util.deprecated("getTransport has been renamed to get_transport", since="1.2.0-dev-590", includedoc="Replaced by :func:`get_transport`")
|
||||
|
||||
def fake_ack(self):
|
||||
if self._comm is None:
|
||||
return
|
||||
|
||||
self._comm.fakeOk()
|
||||
|
||||
def commands(self, commands):
|
||||
"""
|
||||
Sends one or more gcode commands to the printer.
|
||||
|
||||
@@ -33,7 +33,8 @@ def connectionState():
|
||||
def connectionCommand():
|
||||
valid_commands = {
|
||||
"connect": [],
|
||||
"disconnect": []
|
||||
"disconnect": [],
|
||||
"fake_ack": []
|
||||
}
|
||||
|
||||
command, data, response = get_json_command_from_request(request, valid_commands)
|
||||
@@ -68,6 +69,8 @@ def connectionCommand():
|
||||
printer.connect(port=port, baudrate=baudrate, profile=printerProfile)
|
||||
elif command == "disconnect":
|
||||
printer.disconnect()
|
||||
elif command == "fake_ack":
|
||||
printer.fake_ack()
|
||||
|
||||
return NO_CONTENT
|
||||
|
||||
|
||||
@@ -173,6 +173,16 @@ $(function() {
|
||||
}
|
||||
};
|
||||
|
||||
self.fakeAck = function() {
|
||||
$.ajax({
|
||||
url: API_BASEURL + "connection",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
contentType: "application/json; charset=UTF-8",
|
||||
data: JSON.stringify({"command": "fake_ack"})
|
||||
});
|
||||
};
|
||||
|
||||
self.handleKeyDown = function(event) {
|
||||
var keyCode = event.keyCode;
|
||||
|
||||
|
||||
@@ -20,3 +20,12 @@
|
||||
<small class="muted">{{ _('Hint: Use the arrow up/down keys to recall commands sent previously') }}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div><small><a href="#" class="muted" onclick="$(this).children().toggleClass('icon-caret-right icon-caret-down').parent().parent().parent().next().slideToggle('fast')"><i class="icon-caret-right"></i> {{ _('Advanced options') }}</a></small></div>
|
||||
<div class="hide">
|
||||
<button class="btn btn-block" type="button" data-bind="click: fakeAck, enable: isOperational() && loginState.isUser()">{{ _("Fake Acknowledgement") }}</button>
|
||||
<small class="muted">{{ _("If acknowledgements (\"ok\"s) sent by the firmware get lost due to issues with the serial communication to your printer, OctoPrint's communication with it can become stuck. If that happens, this can help. Please be advised that such occurences hint at general communication issues with your printer which will probably negatively influence your printing results and which you should therefore try to resolve!") }}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -412,6 +412,9 @@ class MachineCom(object):
|
||||
def setTemperatureOffset(self, offsets):
|
||||
self._tempOffsets.update(offsets)
|
||||
|
||||
def fakeOk(self):
|
||||
self._clear_to_send.set()
|
||||
|
||||
def sendCommand(self, cmd, cmd_type=None, processed=False):
|
||||
cmd = cmd.encode('ascii', 'replace')
|
||||
if not processed:
|
||||
|
||||
Reference in new issue
Block a user