[conf] Make config reload command configurable
This commit is contained in:
parent
e2aaf5471c
commit
a25609eea0
|
@ -55,7 +55,8 @@ class KlipperPlugin(
|
||||||
)]
|
)]
|
||||||
),
|
),
|
||||||
configuration = dict(
|
configuration = dict(
|
||||||
path="/home/pi/printer.cfg"
|
path="/home/pi/printer.cfg",
|
||||||
|
reload_command="RESTART"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -67,7 +68,9 @@ class KlipperPlugin(
|
||||||
f.close()
|
f.close()
|
||||||
else:
|
else:
|
||||||
self._logger.info(
|
self._logger.info(
|
||||||
"Error: Klipper config file not found at: {}".format(self._settings.get(["config_path"]))
|
"Error: Klipper config file not found at: {}".format(
|
||||||
|
self._settings.get(["configuration", "path"])
|
||||||
|
)
|
||||||
)
|
)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -78,14 +81,18 @@ class KlipperPlugin(
|
||||||
f.write(data["config"])
|
f.write(data["config"])
|
||||||
f.close()
|
f.close()
|
||||||
self._logger.info(
|
self._logger.info(
|
||||||
"Write Klipper config to {}".format(self._settings.get(["config_path"]))
|
"Write Klipper config to {}".format(
|
||||||
|
self._settings.get(["configuration", "path"])
|
||||||
|
)
|
||||||
)
|
)
|
||||||
# Restart klipply to reload config
|
# Restart klipply to reload config
|
||||||
self._printer.commands("RESTART")
|
self._printer.commands(self._settings.get(["configuration", "reload_command"]))
|
||||||
self.logInfo("Reloading Klipper Configuration.")
|
self.logInfo("Reloading Klipper Configuration.")
|
||||||
else:
|
else:
|
||||||
self._logger.info(
|
self._logger.info(
|
||||||
"Error: Couldn't write Klipper config file: {}".format(self._settings.get(["config_path"]))
|
"Error: Couldn't write Klipper config file: {}".format(
|
||||||
|
self._settings.get(["configuration", "path"])
|
||||||
|
)
|
||||||
)
|
)
|
||||||
data.pop("config", None) # we dont want to write the klipper conf to the octoprint settings
|
data.pop("config", None) # we dont want to write the klipper conf to the octoprint settings
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -3,7 +3,6 @@ $(function() {
|
||||||
function KlipperSettingsViewModel(parameters) {
|
function KlipperSettingsViewModel(parameters) {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.settings = parameters[0];
|
self.settings = parameters[0];
|
||||||
self.klipperConfig = ko.observable();
|
|
||||||
|
|
||||||
self.addMacro = function() {
|
self.addMacro = function() {
|
||||||
self.settings.settings.plugins.klipper.macros.push({
|
self.settings.settings.plugins.klipper.macros.push({
|
||||||
|
|
|
@ -25,6 +25,15 @@
|
||||||
<input type="text" class="input-block-level" data-bind="value: settings.settings.plugins.klipper.configuration.path">
|
<input type="text" class="input-block-level" data-bind="value: settings.settings.plugins.klipper.configuration.path">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">{{ _('Configuration Reload Command') }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<select data-bind="value: settings.settings.plugins.klipper.configuration.reload_command">
|
||||||
|
<option value="RESTART">RESTART</option>
|
||||||
|
<option value="FIRMWARE_RESTART">FIRMWARE_RESTART</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane" id="macros">
|
<div class="tab-pane" id="macros">
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
|
Loading…
Reference in New Issue