Add max timeouts configuration to settings

This commit is contained in:
Gina Häußge 2016-07-21 18:46:54 +02:00
parent 4f11f6362b
commit 9eb1485e84
3 changed files with 35 additions and 2 deletions

View file

@ -92,7 +92,10 @@ def getSettings():
"ignoreErrorsFromFirmware": s.getBoolean(["serial", "ignoreErrorsFromFirmware"]),
"disconnectOnErrors": s.getBoolean(["serial", "disconnectOnErrors"]),
"triggerOkForM29": s.getBoolean(["serial", "triggerOkForM29"]),
"supportResendsWithoutOk": s.getBoolean(["serial", "supportResendsWithoutOk"])
"supportResendsWithoutOk": s.getBoolean(["serial", "supportResendsWithoutOk"]),
"maxTimeoutsIdle": s.getInt(["serial", "maxCommunicationTimeouts", "idle"]),
"maxTimeoutsPrinting": s.getInt(["serial", "maxCommunicationTimeouts", "printing"]),
"maxTimeoutsLong": s.getInt(["serial", "maxCommunicationTimeouts", "long"])
},
"folder": {
"uploads": s.getBaseFolder("uploads"),
@ -240,6 +243,9 @@ def setSettings():
if "disconnectOnErrors" in data["serial"]: s.setBoolean(["serial", "disconnectOnErrors"], data["serial"]["disconnectOnErrors"])
if "triggerOkForM29" in data["serial"]: s.setBoolean(["serial", "triggerOkForM29"], data["serial"]["triggerOkForM29"])
if "supportResendsWithoutOk" in data["serial"]: s.setBoolean(["serial", "supportResendsWithoutOk"], data["serial"]["supportResendsWithoutOk"])
if "maxTimeoutsIdle" in data["serial"]: s.setInt(["serial", "maxCommunicationTimeouts", "idle"], data["serial"]["maxTimeoutsIdle"])
if "maxTimeoutsPrinting" in data["serial"]: s.setInt(["serial", "maxCommunicationTimeouts", "printing"], data["serial"]["maxTimeoutsPrinting"])
if "maxTimeoutsLong" in data["serial"]: s.setInt(["serial", "maxCommunicationTimeouts", "long"], data["serial"]["maxTimeoutsLong"])
oldLog = s.getBoolean(["serial", "log"])
if "log" in data["serial"].keys(): s.setBoolean(["serial", "log"], data["serial"]["log"])

View file

@ -144,6 +144,9 @@ $(function() {
self.serial_disconnectOnErrors = ko.observable(undefined);
self.serial_triggerOkForM29 = ko.observable(undefined);
self.serial_supportResendsWithoutOk = ko.observable(undefined);
self.serial_maxTimeoutsIdle = ko.observable(undefined);
self.serial_maxTimeoutsPrinting = ko.observable(undefined);
self.serial_maxTimeoutsLong = ko.observable(undefined);
self.folder_uploads = ko.observable(undefined);
self.folder_timelapse = ko.observable(undefined);
@ -464,6 +467,9 @@ $(function() {
self.serial_disconnectOnErrors(response.serial.disconnectOnErrors);
self.serial_triggerOkForM29(response.serial.triggerOkForM29);
self.serial_supportResendsWithoutOk(response.serial.supportResendsWithoutOk);
self.serial_maxTimeoutsIdle(response.serial.maxTimeoutsIdle);
self.serial_maxTimeoutsPrinting(response.serial.maxTimeoutsPrinting);
self.serial_maxTimeoutsLong(response.serial.maxTimeoutsLong);
self.folder_uploads(response.folder.uploads);
self.folder_timelapse(response.folder.timelapse);
@ -556,7 +562,10 @@ $(function() {
"ignoreErrorsFromFirmware": self.serial_ignoreErrorsFromFirmware(),
"disconnectOnErrors": self.serial_disconnectOnErrors(),
"triggerOkForM29": self.serial_triggerOkForM29(),
"supportResendsWithoutOk": self.serial_supportResendsWithoutOk()
"supportResendsWithoutOk": self.serial_supportResendsWithoutOk(),
"maxTimeoutsIdle": self.serial_maxTimeoutsIdle(),
"maxTimeoutsPrinting": self.serial_maxTimeoutsPrinting(),
"maxTimeoutsLong": self.serial_maxTimeoutsLong()
},
"folder": {
"uploads": self.folder_uploads(),

View file

@ -126,6 +126,24 @@
<input type="checkbox" data-bind="checked: serial_supportResendsWithoutOk" id="settings-supportResendsWithoutOk"> {{ _('Simulate an additional `ok` for resend requests') }}
</label>
</div>
<div class="control-group" title="{{ _('Maximum consecutive communication timeouts while idle. More than this and the printer will be considered to be gone. Set to 0 to disable.') }}">
<label class="control-label" for="settings-serialMaxTimeoutsIdle">{{ _('Max. consecutive timeouts while idle') }}</label>
<div class="controls">
<input type="number" min="0" class="input-mini text-right" id="settings-serialMaxTimeoutsIdle" data-bind="value: serial_maxTimeoutsIdle">
</div>
</div>
<div class="control-group" title="{{ _('Maximum consecutive communication timeouts while printing. More than this and the printer will be considered to be gone. Set to 0 to disable.') }}">
<label class="control-label" for="settings-serialMaxTimeoutsPrinting">{{ _('Max. consecutive timeouts while printing') }}</label>
<div class="controls">
<input type="number" min="0" class="input-mini text-right" id="settings-serialMaxTimeoutsPrinting" data-bind="value: serial_maxTimeoutsPrinting">
</div>
</div>
<div class="control-group" title="{{ _('Maximum consecutive communication timeouts while a long running command is active. More than this and the printer will be considered to be gone. Set to 0 to disable.') }}">
<label class="control-label" for="settings-serialMaxTimeoutsLong">{{ _('Max. consecutive timeouts during long running commands') }}</label>
<div class="controls">
<input type="number" min="0" class="input-mini text-right" id="settings-serialMaxTimeoutsLong" data-bind="value: serial_maxTimeoutsLong">
</div>
</div>
</div>
</div>