Settings PID

This commit is contained in:
sergiuToporjinschi
2022-02-02 00:07:03 +02:00
parent 3e83707069
commit 24dd595d43
5 changed files with 32 additions and 6 deletions
+6
View File
@@ -13,6 +13,12 @@ defaultSettings = {
"extrudeLength": 100,
"extrudeSpeed": 50,
"markLength": 120
},
"pid": {
"fanSpeed": 255,
"noCycles": 5,
"hotEndIndex": 0,
"targetTemp": 200,
}
}
@@ -1,6 +1,8 @@
$(function () {
function CalibrationToolsPIDTuneViewModel(parameters) {
var self = this;
self.loginStateViewModel = parameters[0];
self.settingsViewModel = parameters[1];
self.bedCurrentTemp = ko.observable(0);
self.bedCurrentTarget = ko.observable(0);
@@ -9,6 +11,14 @@ $(function () {
self.bedCurrentTemp(bedState.bed.actual);
self.bedCurrentTarget(bedState.bed.target);
});
self.onBeforeBinding = self.onUserLoggedIn = self.onUserLoggedOut = function () {
self.testParam.extrudeTemp(self.settingsViewModel.settings.plugins.CalibrationTools.pid.fanSpeed());
self.testParam.extrudeLength(self.settingsViewModel.settings.plugins.CalibrationTools.pid.noCycles());
self.testParam.extrudeSpeed(self.settingsViewModel.settings.plugins.CalibrationTools.pid.hotEndIndex());
self.testParam.markLength(self.settingsViewModel.settings.plugins.CalibrationTools.pid.targetTemp());
self.is_admin(self.loginStateViewModel.isAdmin());
}
}
OCTOPRINT_VIEWMODELS.push({
// This is the constructor to call for instantiating the plugin
@@ -12,17 +12,21 @@
</div>
{{ snipped.field("Extrusion temperature", "The temperature used to extrude in testing&#013;Is better to be a bit higher then usual for reducing the nuzzle pressure",
"number", "settings.plugins.CalibrationTools.eSteps.extrudeTemp", "true", "&ordmC", 1) }}
"number", "settings.plugins.CalibrationTools.eSteps.extrudeTemp", "true", "&ordmC", 1, 180, 200) }}
{{ snipped.field("Filament extrusion length", "The length of filament to be extruded in testing",
"number", "settings.plugins.CalibrationTools.eSteps.extrudeLength", "true", "mm", 1) }}
"number", "settings.plugins.CalibrationTools.eSteps.extrudeLength", "true", "mm", 1, 50) }}
{{ snipped.field("Filament extrusion speed", "How fast the filament should be extruded in test&#013;A lower value is recommended for avoiding skipping steps",
"number", "settings.plugins.CalibrationTools.eSteps.extrudeSpeed", "true", "mm/s", 1) }}
"number", "settings.plugins.CalibrationTools.eSteps.extrudeSpeed", "true", "mm/s", 1, 10, 400) }}
{{ snipped.field("Filament mark length", "The length marked on filament",
"number", "settings.plugins.CalibrationTools.eSteps.markLength", "true", "mm") }}
"number", "settings.plugins.CalibrationTools.eSteps.markLength", "true", "mm", 50) }}
{{ snipped.subSection("X-Y-Z-Steps", true) }}
{{ snipped.subSection("PID", true) }}
{{ snipped.subSection("PID", true) }}
{{ snipped.field("Fan speed", "Default value for fan speed while tuning", "number", "settings.plugins.CalibrationTools.pid.fanSpeed", "true", "", 1, 0, 255) }}
{{ snipped.field("Number of cycles", "Default number of cycles to sample while tuning", "number", "settings.plugins.CalibrationTools.pid.noCycles", "true", "", 1, 3, 200) }}
{{ snipped.field("HotEnd index", "Default number of cycles to sample while tuning", "number", "settings.plugins.CalibrationTools.pid.hotEndIndex", "true", "", 1, 0) }}
{{ snipped.field("Target temperature", "Default target temperature for tuning", "number", "settings.plugins.CalibrationTools.pid.targetTemp", "true", "&ordmC", 1, 3, 200) }}
@@ -22,6 +22,7 @@
{% set step = step|default('0.01') %}
{% set min = min|default("") %}
{% set max = max|default("") %}
{% set unit = unit|trim|default("") %}
<div class="row-fluid">
<div class="span6">
<label for="{{ label }}" class="pull-right" style="margin-top: 5px;" title="{{ title }}">
@@ -31,7 +32,9 @@
<div class="span6">
<div class="input-append">
<input type="{{ type }}" id="{{ label }}" title="{{ title }}" class="input-small" step="{{ step }}" min="{{ min }}" max="{{ max }}" data-bind="value: {{ binding }}, enable: {{ enable }}">
{% if unit != "" %}
<span class="add-on" title="{{ title }}">{{ _(unit) }}</span>
{% endif %}
</div>
</div>
</div>
@@ -42,6 +45,7 @@
{% set step = step|default('0.01') %}
{% set min = min|default("") %}
{% set max = max|default("") %}
{% set unit = unit|trim|default("") %}
<div class="row-fluid">
<div class="span6">
<label for="{{ label }}" class="pull-right" style="margin-top: 5px;" title="{{ title }}">
@@ -52,7 +56,9 @@
<div class="input-append input-prepend">
<span class="add-on" title="{{ title }}">{{ _(label) }}</span>
<input type="{{ type }}" id="{{ label }}" title="{{ title }}" class="input-small" step="{{ step }}" min="{{ min }}" max="{{ max }}" data-bind="value: {{ binding }}, enable: {{ enable }}">
{% if unit != "" %}
<span class="add-on" title="{{ title }}">{{ _(unit) }}</span>
{% endif %}
</div>
</div>
</div>
@@ -13,7 +13,7 @@
<div class="input-prepend input-append">
{{ snipped.linkToMarlin("M104", "Marlin website") }}
<span class="add-on" title="Command to preheat the tool before testing">M104&nbsp;&nbsp;&nbsp;S</span>
<input type="number" id="temperature" class="input-mini" step="1" min="0" max="280"
<input type="number" id="temperature" class="input-mini" step="1" min="180" max="280"
title="The temperature used to extrude in testing (&#186;C)&#013;Is better to be a bit higher then usual for reducing the nuzzle pressure" data-bind="value: $root.testParam.extrudeTemp">
</div>
</div>