redesing tab
This commit is contained in:
@@ -20,7 +20,6 @@ class CalibrationtoolsPlugin(
|
|||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
self.collectCommand = False
|
self.collectCommand = False
|
||||||
# self._api = api.API(self)
|
|
||||||
|
|
||||||
def on_after_startup(self):
|
def on_after_startup(self):
|
||||||
self._logger.debug("----------------[ CalibrationTools ]----------------")
|
self._logger.debug("----------------[ CalibrationTools ]----------------")
|
||||||
@@ -36,8 +35,6 @@ class CalibrationtoolsPlugin(
|
|||||||
"js": ["js/CalibrationTools.js"],
|
"js": ["js/CalibrationTools.js"],
|
||||||
"css": ["css/style.css"]
|
"css": ["css/style.css"]
|
||||||
}
|
}
|
||||||
def startExtrusion(self, temps):
|
|
||||||
self._logger.debug("Temperature achieved, extrusion started %s", temps)
|
|
||||||
|
|
||||||
def get_update_information(self):
|
def get_update_information(self):
|
||||||
# Define the configuration for your plugin to use with the Software Update
|
# Define the configuration for your plugin to use with the Software Update
|
||||||
|
|||||||
@@ -5,9 +5,11 @@ import octoprint.plugin
|
|||||||
import flask
|
import flask
|
||||||
|
|
||||||
|
|
||||||
CMD_LOAD_STEPS = "loadSteps"
|
|
||||||
CMD_TEST = "TEST"
|
CMD_TEST = "TEST"
|
||||||
|
CMD_LOAD_STEPS = "loadSteps"
|
||||||
CMD_START_EXTRUSION = "startExtrusion"
|
CMD_START_EXTRUSION = "startExtrusion"
|
||||||
|
CMD_SAVE_E_STEPS = "saveESteps"
|
||||||
|
|
||||||
|
|
||||||
def someTestFunc(self, temps):
|
def someTestFunc(self, temps):
|
||||||
self._logger.debug("a ajuns %s", temps)
|
self._logger.debug("a ajuns %s", temps)
|
||||||
@@ -19,6 +21,7 @@ class API(octoprint.plugin.SimpleApiPlugin):
|
|||||||
return {
|
return {
|
||||||
CMD_LOAD_STEPS: [],
|
CMD_LOAD_STEPS: [],
|
||||||
CMD_START_EXTRUSION: [],
|
CMD_START_EXTRUSION: [],
|
||||||
|
CMD_SAVE_E_STEPS: [],
|
||||||
CMD_TEST: []
|
CMD_TEST: []
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,16 +36,45 @@ class API(octoprint.plugin.SimpleApiPlugin):
|
|||||||
def on_api_command(self, command, data):
|
def on_api_command(self, command, data):
|
||||||
self._logger.debug("api command [%s] received", command)
|
self._logger.debug("api command [%s] received", command)
|
||||||
if command == CMD_LOAD_STEPS:
|
if command == CMD_LOAD_STEPS:
|
||||||
|
if not self._printer.is_ready():
|
||||||
|
self._logger.warning("Printer not ready, operation canceled")
|
||||||
|
return flask.abort(503, {
|
||||||
|
"msg": "Printer not ready, operation canceled"
|
||||||
|
})
|
||||||
|
|
||||||
self._printer.commands("M92")
|
self._printer.commands("M92")
|
||||||
|
|
||||||
return flask.jsonify({
|
return flask.jsonify({
|
||||||
"data": self.data["steps"]
|
"data": self.data["steps"]
|
||||||
})
|
})
|
||||||
|
|
||||||
if command == CMD_START_EXTRUSION:
|
if command == CMD_START_EXTRUSION:
|
||||||
self._logger.debug("Heating the tools")
|
self._logger.debug("Heating the tools")
|
||||||
self._printer.commands("M104 S180")
|
if not self._printer.is_ready():
|
||||||
|
self._logger.warning("Printer not ready, operation canceled")
|
||||||
|
return flask.abort(503, {
|
||||||
|
"msg": "Printer not ready, operation canceled"
|
||||||
|
})
|
||||||
|
|
||||||
|
# Register event to be trigger when temp is achieved
|
||||||
self.registerEventTemp("T0", 180, self.startExtrusion)
|
self.registerEventTemp("T0", 180, self.startExtrusion)
|
||||||
|
|
||||||
|
# Heating the tool
|
||||||
|
self._printer.commands("M104 S180")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if command == CMD_SAVE_E_STEPS:
|
||||||
|
return
|
||||||
|
|
||||||
if command == CMD_TEST:
|
if command == CMD_TEST:
|
||||||
self.registerEventTemp("T0", 100, someTestFunc)
|
# self.registerEventTemp("T0", 100, someTestFunc)
|
||||||
return
|
return flask.abort(503, {
|
||||||
|
"msg": "Printer not ready, operation canceled"
|
||||||
|
})
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def startExtrusion(self, temps, *args):
|
||||||
|
self._logger.debug("Temperature achieved, extrusion started %s, %s", temps, args)
|
||||||
|
|
||||||
|
# Extrude
|
||||||
|
self._printer.extrude(amount=120, speed=50)
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ class Hooks():
|
|||||||
if event["tool"] == tool and curTemp >= event["targetTemp"]:
|
if event["tool"] == tool and curTemp >= event["targetTemp"]:
|
||||||
arg = (temps, *event["args"])
|
arg = (temps, *event["args"])
|
||||||
if isinstance(event["func"], types.FunctionType):
|
if isinstance(event["func"], types.FunctionType):
|
||||||
|
self._logger.debug("addSelf")
|
||||||
arg = (self, *arg)
|
arg = (self, *arg)
|
||||||
threading.Thread(target=event["func"], args=arg).start()
|
threading.Thread(target=event["func"], args=arg).start()
|
||||||
self.events.remove(event)
|
self.events.remove(event)
|
||||||
@@ -88,5 +89,5 @@ class Hooks():
|
|||||||
"func": func,
|
"func": func,
|
||||||
"args": arguments
|
"args": arguments
|
||||||
}
|
}
|
||||||
self._logger.debug("Registering event [%s]", event)
|
self._logger.debug("Registering event [%s, isFunction: %s]", event, isinstance(func, types.FunctionType))
|
||||||
self.events.append(event)
|
self.events.append(event)
|
||||||
|
|||||||
@@ -15,10 +15,16 @@ $(function () {
|
|||||||
self.steps["E"] = ko.observable();
|
self.steps["E"] = ko.observable();
|
||||||
self.results = {};
|
self.results = {};
|
||||||
|
|
||||||
|
self.testParam = {};
|
||||||
|
self.testParam["extrudeTemp"] = ko.observable(210);
|
||||||
|
self.testParam["extrudeLength"] = ko.observable(100);
|
||||||
|
self.testParam["extrudeSpeed"] = ko.observable(50);
|
||||||
|
self.testParam["markLength"] = ko.observable(120);
|
||||||
|
|
||||||
self.results["remainedLength"] = ko.observable(20);
|
self.results["remainedLength"] = ko.observable(20);
|
||||||
self.results["markLength"] = ko.observable(120);
|
|
||||||
self.results["actualExtrusion"] = ko.computed(function () {
|
self.results["actualExtrusion"] = ko.computed(function () {
|
||||||
return (self.results.markLength() - self.results.remainedLength()).toFixed(3);
|
return (self.testParam.markLength() - self.results.remainedLength()).toFixed(3);
|
||||||
});
|
});
|
||||||
|
|
||||||
self.results["newSteps"] = ko.computed(function () {
|
self.results["newSteps"] = ko.computed(function () {
|
||||||
@@ -47,14 +53,15 @@ $(function () {
|
|||||||
OctoPrint.simpleApiCommand("CalibrationTools","loadSteps").done(function (response) {
|
OctoPrint.simpleApiCommand("CalibrationTools","loadSteps").done(function (response) {
|
||||||
self.from_json(response);
|
self.from_json(response);
|
||||||
})
|
})
|
||||||
// OctoPrint.simpleApiGet("CalibrationTools").done(function (response) {
|
|
||||||
// console.log("CalibrationTools");
|
|
||||||
// self.from_json(response);
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.startExtrusion = function () {
|
self.startExtrusion = function () {
|
||||||
OctoPrint.simpleApiCommand("CalibrationTools", "startExtrusion").done(function (response) {
|
OctoPrint.simpleApiCommand("CalibrationTools", "startExtrusion").done(function (response) {
|
||||||
|
new PNotify({
|
||||||
|
title: "Test request",
|
||||||
|
text: "<span style='font-weight:bold; color: red;'>Heating nuzzle has started!!!</span><br> When extrusion stops you have to fulfil <b>Length after extrusion</b> and save the new value ",
|
||||||
|
type: "info"
|
||||||
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -62,8 +69,8 @@ $(function () {
|
|||||||
self.tempRestart = function () {
|
self.tempRestart = function () {
|
||||||
OctoPrint.system.executeCommand("core", "restart");
|
OctoPrint.system.executeCommand("core", "restart");
|
||||||
}
|
}
|
||||||
self.runCommand = function () {
|
self.saveESteps = function () {
|
||||||
OctoPrint.control.sendGcodeWithParameters("G90");
|
OctoPrint.system.executeCommand("core", "restart");
|
||||||
}
|
}
|
||||||
|
|
||||||
self.onAllBound = self.onEventConnected = function () {
|
self.onAllBound = self.onEventConnected = function () {
|
||||||
@@ -76,6 +83,12 @@ $(function () {
|
|||||||
self.test = function () {
|
self.test = function () {
|
||||||
OctoPrint.simpleApiCommand("CalibrationTools", "TEST").done(function (response) {
|
OctoPrint.simpleApiCommand("CalibrationTools", "TEST").done(function (response) {
|
||||||
console.log(response)
|
console.log(response)
|
||||||
|
}).fail(function (response) {
|
||||||
|
new PNotify({
|
||||||
|
title: "Test request",
|
||||||
|
text: response.responseJSON.error.msg,
|
||||||
|
type: "error"
|
||||||
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
<p>Calibration</p>
|
<p>Calibration</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="span8 title">
|
<div class="span8 title">
|
||||||
<!-- <button class="btn" data-bind="click: $root.tempRestart">
|
|
||||||
RESTART
|
|
||||||
</button> -->
|
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span6"></div>
|
<div class="span6"></div>
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
|
<button class="btn" data-bind="click: $root.tempRestart; visible: $root.tempRestart" >
|
||||||
|
RESTART
|
||||||
|
</button>
|
||||||
<button class="btn btn-primary" data-bind="click: $root.test"
|
<button class="btn btn-primary" data-bind="click: $root.test"
|
||||||
title="BTN for testing">
|
title="BTN for testing">
|
||||||
<i class="fas fa-save" data-color="#000000"></i>  
|
<i class="fas fa-save" data-color="#000000"></i>  
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
</blockquote>
|
</blockquote>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro field(label, title, number, binding, enable, unit) %}
|
{% macro field(label, title, type, binding, enable, unit) %}
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
<label for="{{ label }}" class="pull-right" style="margin-top: 5px;" title="{{ title }}">
|
<label for="{{ label }}" class="pull-right" style="margin-top: 5px;" title="{{ title }}">
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
<div class="input-append">
|
<div class="input-append">
|
||||||
<input type="{{ number }}" id="{{ label }}" title="{{ title }}" class="input-small" step="0.01" data-bind="value: {{ binding }}, enable: {{ enable }}">
|
<input type="{{ type }}" id="{{ label }}" title="{{ title }}" class="input-small" step="0.01" data-bind="value: {{ binding }}, enable: {{ enable }}">
|
||||||
<span class="add-on" title="{{ title }}">{{ _(unit) }}</span>
|
<span class="add-on" title="{{ title }}">{{ _(unit) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,20 +1,42 @@
|
|||||||
{% import "macros.jinja2" as snipped %}
|
{% import "macros.jinja2" as snipped %}
|
||||||
|
|
||||||
{{ snipped.subSection("EEPROM values") }}
|
{{ snipped.subSection("Test parameters", true) }}
|
||||||
|
|
||||||
{{ snipped.field("E steps", "Number of steps/mm currently set in EEPROM", "number", "$root.steps.E", "false", "steps/mm") }}
|
<!-- G1 E100 F50 command -->
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span6"></div>
|
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
<button class="btn" data-bind="click: $root.loadESteps, enable: $root.controlViewModel.isOperational() && (!$root.controlViewModel.isPrinting())"
|
<label for="temperature" class="pull-right" style="margin-top: 5px;" title="x">
|
||||||
title="Loads current value of steps/mm from current printer settings by calling M92">
|
Heating
|
||||||
<i class="fas fa-sync-alt" style="color:false" data-color="false"></i>  
|
</label>
|
||||||
Load EEPROM data
|
</div>
|
||||||
</button>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ snipped.subSection("Compute", true) }}
|
<div class="row-fluid">
|
||||||
|
<div class="span6">
|
||||||
|
<label for="extrusionLenSpeed" class="pull-right" style="margin-top: 5px;" title="x">
|
||||||
|
Extrusion length & speed
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="span6">
|
||||||
|
<div class="input-prepend input-append">
|
||||||
|
<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" class="input-mini" step="1"
|
||||||
|
data-bind="value: $root.testParam.extrudeLength">
|
||||||
|
<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" class="input-mini" step="1"
|
||||||
|
data-bind="value: $root.testParam.extrudeSpeed">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{ snipped.field("Extrusion marking length", "The length marked on filament before extrusion. ", "number", "$root.testParam.markLength", "true", "mm") }}
|
||||||
|
|
||||||
<div class="row-fluid" style="margin-bottom: 5px;">
|
<div class="row-fluid" style="margin-bottom: 5px;">
|
||||||
<div class="span6"></div>
|
<div class="span6"></div>
|
||||||
@@ -27,21 +49,42 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{ snipped.subSection("Test results", true) }}
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span6">
|
||||||
|
<label for="eSteps" class="pull-right" style="margin-top: 5px;" title="Current value for number of steps/mm for E axe in EEPROM">
|
||||||
|
E steps
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="span6">
|
||||||
|
<div class="input-append">
|
||||||
|
<input type="number" id="eSteps" title="Current value for number of steps/mm for E axe in EEPROM" class="input-small" step="0.01"
|
||||||
|
data-bind="value: $root.steps.E, enable:false">
|
||||||
|
<span class="add-on" title="Current value for number of steps/mm for E axe in EEPROM">steps/mm</span>
|
||||||
|
<button class="btn" data-bind="click: $root.loadESteps, enable: $root.controlViewModel.isOperational() && (!$root.controlViewModel.isPrinting())"
|
||||||
|
title="Loads current value of steps/mm from EEPROM by calling M92">
|
||||||
|
<i class="fas fa-sync-alt" style="color:false" data-color="false"></i>  
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{ 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("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") }}
|
{{ snipped.field("New steps/mm", "The new number of steps/mm which should be set on EEPROM", "number", "$root.results.newSteps", "false", "steps/mm") }}
|
||||||
{{ snipped.field("Extrusion marking length", "The length marked on filament before extrusion", "number", "$root.results.markLength", "true", "mm") }}
|
<div class="row-fluid" style="margin-bottom: 5px;">
|
||||||
{{ snipped.field("Measured value", "The length between filament mark and extruder entry after extrusion", "number", "$root.results.remainedLength", "true", "mm") }}
|
|
||||||
<div class="row-fluid">
|
|
||||||
<div class="span6"></div>
|
<div class="span6"></div>
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
<button class="btn btn-primary" data-bind="click: $root.saveESteps, enable: $root.controlViewModel.isOperational() && (!$root.controlViewModel.isPrinting())"
|
<button class="btn btn-primary" data-bind="click: $root.saveESteps, enable: $root.controlViewModel.isOperational() && (!$root.controlViewModel.isPrinting())"
|
||||||
title="Saves the new calculated value of steps/mm on printer EEPROM">
|
title="Saves the new calculated value of steps/mm on printer EEPROM">
|
||||||
<i class="fas fa-save" data-color="#000000"></i>  
|
<i class="fas fa-save" data-color="#000000"></i>  
|
||||||
Set new value
|
Save the new value
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{{ snipped.subSection("Process description", true) }}
|
{{ snipped.subSection("Process description", true) }}
|
||||||
{{ snipped.quote("
|
{{ snipped.quote("
|
||||||
First <a href='https://teachingtechyt.github.io/calibration.html#esteps' target='_blank'>Read this</a><br><br>
|
First <a href='https://teachingtechyt.github.io/calibration.html#esteps' target='_blank'>Read this</a><br><br>
|
||||||
@@ -49,5 +92,3 @@ This calibration is best done with the extruder detached from the hot end, so no
|
|||||||
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
|
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.
|
reliable.
|
||||||
", "text-warning" ) }}
|
", "text-warning" ) }}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user