E-Steps is working
This commit is contained in:
@@ -7,6 +7,8 @@ from octoprint_CalibrationTools import (api, hooks, models)
|
||||
|
||||
defaultSettings = {
|
||||
"eSteps": {
|
||||
"userControlsTemp": True,
|
||||
"turnOffHeater": True,
|
||||
"extrudeTemp": 210,
|
||||
"extrudeLength": 100,
|
||||
"extrudeSpeed": 50,
|
||||
|
||||
@@ -34,8 +34,9 @@ class API(octoprint.plugin.SimpleApiPlugin):
|
||||
)
|
||||
|
||||
def on_api_command(self, command, data):
|
||||
self._logger.debug("api command [%s] received", command)
|
||||
self._logger.debug("api command [%s] received payload [%s]", command, data)
|
||||
if command == CMD_LOAD_STEPS:
|
||||
self._logger.debug("Load steps from EEPROM")
|
||||
if not self._printer.is_ready():
|
||||
self._logger.warning("Printer not ready, operation canceled")
|
||||
return flask.abort(503, {
|
||||
@@ -64,6 +65,7 @@ class API(octoprint.plugin.SimpleApiPlugin):
|
||||
return
|
||||
|
||||
if command == CMD_SAVE_E_STEPS:
|
||||
self._printer.commands(["M92 E%(newESteps)s" % data, "M500"])
|
||||
return
|
||||
|
||||
if command == CMD_TEST:
|
||||
|
||||
@@ -13,8 +13,7 @@ class Hooks():
|
||||
events = []
|
||||
|
||||
def gCodeReceived(self, comm, line, *args, **kwargs):
|
||||
if not self.collectCommand:
|
||||
return line
|
||||
if not self.collectCommand: return line
|
||||
self._logger.debug("collectCommand is true, collecting info")
|
||||
|
||||
reg = re.compile("echo:\s*(?P<command>(?P<gCode>M\d{1,3}) X(?P<xVal>\d{1,3}.\d{1,3}) Y(?P<yVal>\d{1,3}.\d{1,3}) Z(?P<zVal>\d{1,3}.\d{1,3}) E(?P<eVal>\d{1,3}.\d{1,3}))")
|
||||
|
||||
@@ -14,7 +14,6 @@ $(function () {
|
||||
self.steps["Y"] = ko.observable();
|
||||
self.steps["Z"] = ko.observable();
|
||||
self.steps["E"] = ko.observable();
|
||||
self.results = {};
|
||||
|
||||
self.testParam = {};
|
||||
self.testParam["extrudeTemp"] = ko.observable(210);
|
||||
@@ -22,17 +21,23 @@ $(function () {
|
||||
self.testParam["extrudeSpeed"] = ko.observable(50);
|
||||
self.testParam["markLength"] = ko.observable(120);
|
||||
|
||||
self.results = {};
|
||||
self.results["remainedLength"] = ko.observable(20);
|
||||
|
||||
self.results["actualExtrusion"] = ko.computed(function () {
|
||||
return (self.testParam.markLength() - self.results.remainedLength()).toFixed(3);
|
||||
});
|
||||
|
||||
self.results["newSteps"] = ko.computed(function () {
|
||||
return (self.steps.E() / self.results.actualExtrusion() * 100).toFixed(3);
|
||||
});
|
||||
self.results["newStepsDisplay"] = ko.computed(function () {
|
||||
return "M92 E" + self.results.newSteps() ;
|
||||
});
|
||||
|
||||
self.onBeforeBinding = self.onUserLoggedIn = self.onUserLoggedOut = function () {
|
||||
self.testParam.extrudeTemp(self.settingsViewModel.settings.plugins.CalibrationTools.eSteps.extrudeTemp());
|
||||
self.testParam.extrudeLength(self.settingsViewModel.settings.plugins.CalibrationTools.eSteps.extrudeLength());
|
||||
self.testParam.extrudeSpeed(self.settingsViewModel.settings.plugins.CalibrationTools.eSteps.extrudeSpeed());
|
||||
self.testParam.markLength(self.settingsViewModel.settings.plugins.CalibrationTools.eSteps.markLength());
|
||||
self.is_admin(self.loginStateViewModel.isAdmin());
|
||||
}
|
||||
|
||||
@@ -51,7 +56,7 @@ $(function () {
|
||||
}
|
||||
|
||||
self.loadESteps = function () {
|
||||
OctoPrint.simpleApiCommand("CalibrationTools","loadSteps").done(function (response) {
|
||||
OctoPrint.simpleApiCommand("CalibrationTools", "loadSteps").done(function (response) {
|
||||
self.from_json(response);
|
||||
})
|
||||
}
|
||||
@@ -71,7 +76,15 @@ $(function () {
|
||||
OctoPrint.system.executeCommand("core", "restart");
|
||||
}
|
||||
self.saveESteps = function () {
|
||||
OctoPrint.system.executeCommand("core", "restart");
|
||||
OctoPrint.simpleApiCommand("CalibrationTools", "saveESteps", {
|
||||
"newESteps": self.results.newSteps()
|
||||
}).done(function () {
|
||||
new PNotify({
|
||||
title: "Saved",
|
||||
text: self.results.newSteps() + " steps/mm had been set for E axe",
|
||||
type: "info"
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
self.onAllBound = self.onEventConnected = function () {
|
||||
|
||||
@@ -1,29 +1,26 @@
|
||||
{% import "macros.jinja2" as snipped %}
|
||||
{{ snipped.subSection("E-Steps default settings", true) }}
|
||||
<div class="row-fluid">
|
||||
<div class="span6"><label class="checkbox pull-right" style="margin-top: 5px;" for="userControlsTemp">Let me to control temperature</label></div>
|
||||
<div class="span6"><input id="userControlsTemp" type="checkbox" data-bind="checked: settings.plugins.CalibrationTools.eSteps.userControlsTemp"></div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span6"><label class="checkbox pull-right" style="margin-top: 5px;" for="turnOffHeater">Cooldown extruder when saving to EEPROM</label></div>
|
||||
<div class="span6"><input id="turnOffHeater" type="checkbox" data-bind="checked: settings.plugins.CalibrationTools.eSteps.turnOffHeater"></div>
|
||||
</div>
|
||||
|
||||
{{ snipped.field("Extrusion temperature", "The temperature used to extrude in testing
Is better to be a bit higher then usual for reducing the nuzzle pressure",
|
||||
"number", "settings.plugins.CalibrationTools.eSteps.extrudeTemp", "true", "ºC", 1) }}
|
||||
"number", "settings.plugins.CalibrationTools.eSteps.extrudeTemp", "true", "ºC", 1) }}
|
||||
|
||||
{{ 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) }}
|
||||
|
||||
{{ snipped.field("Filament extrusion speed", "How fast the filament should be extruded in test
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) }}
|
||||
|
||||
{{ 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") }}
|
||||
|
||||
<!-- <div class="row-fluid">
|
||||
<div class="span6">
|
||||
<label for="temperature" class="pull-right" style="margin-top: 5px;" title="x">
|
||||
Heating
|
||||
</label>
|
||||
</div>
|
||||
<div class="span6">
|
||||
<div class="input-prepend input-append">
|
||||
<span class="add-on" title="Command to preheat the tool before testing">M104    S</span>
|
||||
<input type="number" id="temperature" title="The temperature used to extrude in testing
Is better to be a bit higher then usual for reducing the nuzzle pressure" class="input-mini" step="1"
|
||||
data-bind="value: $root.testParam.extrudeTemp">
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
{{ snipped.subSection("X-Y-Z-Steps", true) }}
|
||||
|
||||
{{ snipped.subSection("PID", true) }}
|
||||
@@ -11,9 +11,10 @@
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro quote(content, class) %}
|
||||
{% macro quote(content, cite, class) %}
|
||||
<blockquote>
|
||||
<p class="{{ class }}">{{ _(content) }}</p>
|
||||
<small>{{ cite }}</small>
|
||||
</blockquote>
|
||||
{% endmacro %}
|
||||
|
||||
@@ -27,7 +28,7 @@
|
||||
</div>
|
||||
<div class="span6">
|
||||
<div class="input-append">
|
||||
<input type="{{ type }}" id="{{ label }}" title="{{ title }}" class="input-small" step="{{ step }}" data-bind="value: {{ binding }}, enable: {{ enable }}">
|
||||
<input type="{{ type }}" id="{{ label }}" title="{{ title }}" class="input-small" step="{{ step }}" data-bind="value: {{ binding }}, enable: {{ enable }}">
|
||||
<span class="add-on" title="{{ title }}">{{ _(unit) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
Something in documentation tab...
|
||||
|
||||
<strong data-bind="text: gettext('test')"></strong>
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
{{ snipped.subSection("Test parameters", true) }}
|
||||
|
||||
<!-- G1 E100 F50 command -->
|
||||
<!-- M104 S210 command -->
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<label for="temperature" class="pull-right" style="margin-top: 5px;" title="x">
|
||||
@@ -11,13 +11,14 @@
|
||||
</div>
|
||||
<div class="span6">
|
||||
<div class="input-prepend input-append">
|
||||
<span class="add-on" title="Command to preheat the tool before testing">M104    S</span>
|
||||
<span class="add-on" title="Command to preheat the tool before testing">M104 S</span>
|
||||
<input type="number" id="temperature" title="The temperature used to extrude in testing (ºC)
Is better to be a bit higher then usual for reducing the nuzzle pressure" class="input-mini" step="1"
|
||||
data-bind="value: $root.testParam.extrudeTemp">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- G1 E100 F50 command -->
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<label for="extrusionLenSpeed" class="pull-right" style="margin-top: 5px;" title="x">
|
||||
@@ -26,10 +27,10 @@
|
||||
</div>
|
||||
<div class="span6">
|
||||
<div class="input-prepend input-append">
|
||||
<span class="add-on" title="Command to extrude filament for testing">G1   E</span>
|
||||
<span class="add-on" title="Command to extrude filament for testing">G1 E</span>
|
||||
<input type="number" id="extrusionLenSpeed" title="The length of filament to be extruded in testing (in millimeters)" class="input-mini" step="1"
|
||||
data-bind="value: $root.testParam.extrudeLength">
|
||||
<span class="add-on" title="Command to extrude filament for testing">   F</span>
|
||||
<span class="add-on" title="Command to extrude filament for testing"> F</span>
|
||||
<input type="number" id="extrusionLenSpeed" title="The speed to extrude filament in testing
Lowest possible (mm/s)" class="input-mini" step="1"
|
||||
data-bind="value: $root.testParam.extrudeSpeed">
|
||||
</div>
|
||||
@@ -72,7 +73,22 @@
|
||||
|
||||
{{ snipped.field("Length after extrusion", "The remained length between filament mark and extruder entry", "number", "$root.results.remainedLength", "true", "mm") }}
|
||||
{{ snipped.field("Actual extrusion", "How much filament has been extruded", "number", "$root.results.actualExtrusion", "false", "mm") }}
|
||||
{{ snipped.field("New steps/mm", "The new number of steps/mm which should be set on EEPROM", "number", "$root.results.newSteps", "false", "steps/mm") }}
|
||||
|
||||
<!-- M92 E900 -->
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<label for="newESteps" class="pull-right" style="margin-top: 5px;" title="The new calculated number of steps/mm for E axe">
|
||||
New E axe steps/mm
|
||||
</label>
|
||||
</div>
|
||||
<div class="span6">
|
||||
<div class="input-prepend input-append">
|
||||
<span class="add-on" title="Command to change number of steps/mm for E axe" data-bind="text: $root.results.newStepsDisplay"></span>
|
||||
<span class="add-on" title="Command for saving steps in EEPROM">M500</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid" style="margin-bottom: 5px;">
|
||||
<div class="span6"></div>
|
||||
<div class="span6">
|
||||
@@ -87,10 +103,9 @@
|
||||
|
||||
{{ snipped.subSection("Process description", true) }}
|
||||
{{ snipped.quote("
|
||||
First <a href='https://teachingtechyt.github.io/calibration.html#esteps' target='_blank'>Read this</a><br><br>
|
||||
This calibration is best done with the extruder detached from the hot end, so no restriction is present on the movement. If it is convenient, you can partially disassemble the printer so the output of the extruder is
|
||||
open and the filament exits in free air. If this is inconvenient, the process below aims to minimize restrictions by extruding very slowly and with a slightly higher temperature. The results from this should still be
|
||||
reliable.
|
||||
", "text-warning" ) }}
|
||||
|
||||
<strong data-bind="text: gettext('test')"></strong>
|
||||
", "
|
||||
<a href='https://teachingtechyt.github.io/calibration.html#esteps' target='_blank'>teachingtechyt.github.io</a>
|
||||
", "text-warning") }}
|
||||
Reference in New Issue
Block a user