Migrate from info to debug
This commit is contained in:
@@ -9,13 +9,15 @@ from __future__ import absolute_import
|
||||
#
|
||||
# Take a look at the documentation on what other plugin mixins are available.
|
||||
|
||||
|
||||
import octoprint.plugin
|
||||
import re
|
||||
from octoprint_CalibrationTools import (
|
||||
api
|
||||
)
|
||||
|
||||
class CalibrationtoolsPlugin(octoprint.plugin.StartupPlugin,
|
||||
class CalibrationtoolsPlugin(
|
||||
octoprint.plugin.StartupPlugin,
|
||||
octoprint.plugin.TemplatePlugin,
|
||||
octoprint.plugin.SettingsPlugin,
|
||||
octoprint.plugin.AssetPlugin,
|
||||
@@ -34,21 +36,18 @@ class CalibrationtoolsPlugin(octoprint.plugin.StartupPlugin,
|
||||
self._api = api.API(self)
|
||||
|
||||
def on_after_startup(self):
|
||||
self._logger.info("----------------[CalibrationTools]----------------")
|
||||
self._logger.debug("----------------[CalibrationTools]----------------")
|
||||
self.collectCommand = True
|
||||
self._printer.commands("M92")
|
||||
|
||||
# API handling
|
||||
def get_api_commands(self):
|
||||
self._logger.info("get_api_commands")
|
||||
return self._api.get_api_commands()
|
||||
|
||||
def on_api_command(self, command, data):
|
||||
self._logger.info("on_api_command")
|
||||
return self._api.on_api_command(command, data)
|
||||
|
||||
def on_api_get(self, request):
|
||||
self._logger.info("on_api_get")
|
||||
return self._api.on_api_get(request)
|
||||
|
||||
##~~ AssetPlugin mixin
|
||||
@@ -60,9 +59,7 @@ class CalibrationtoolsPlugin(octoprint.plugin.StartupPlugin,
|
||||
"css": ["css/style.css"]
|
||||
}
|
||||
|
||||
# self._printer.commands(commands)
|
||||
# extrude(amount, speed=None, tags=None, *args, **kwargs)
|
||||
# set_temperature(heater, value, tags=None, *args, **kwargs)
|
||||
|
||||
##~~ Softwareupdate hook
|
||||
def comm_protocol_gcode_received(self, comm, line, *args, **kwargs):
|
||||
if not self.collectCommand: return line
|
||||
@@ -83,20 +80,20 @@ class CalibrationtoolsPlugin(octoprint.plugin.StartupPlugin,
|
||||
self.m92Data["E"] = float(eValue)
|
||||
|
||||
# Send the new data to the UI to be reloaded
|
||||
self._logger.info(line)
|
||||
self._logger.info("gCode: %s", command)
|
||||
self._logger.info("X: %s", xValue)
|
||||
self._logger.info("Y: %s", yValue)
|
||||
self._logger.info("Z: %s", zValue)
|
||||
self._logger.info("E: %s", eValue)
|
||||
self._logger.info("Finished data collection, updating UI")
|
||||
self._logger.debug(line)
|
||||
self._logger.debug("gCode: %s", command)
|
||||
self._logger.debug("X: %s", xValue)
|
||||
self._logger.debug("Y: %s", yValue)
|
||||
self._logger.debug("Z: %s", zValue)
|
||||
self._logger.debug("E: %s", eValue)
|
||||
self._logger.debug("Finished data collection")
|
||||
self.collectCommand = False
|
||||
return line
|
||||
|
||||
def comm_protocol_gcode_sending(self, comm, phase, cmd, cmd_type, gcode, subcode=None, tags=None, *args, **kwargs):
|
||||
# https://docs.octoprint.org/en/master/plugins/hooks.html#protocol_gcodephase_hook
|
||||
self._logger.debug("sending GCODE")
|
||||
if cmd == "M92":
|
||||
self._logger.info("{} detected, collecting data".format(cmd))
|
||||
self._logger.debug("{} detected, collecting data".format(cmd))
|
||||
self.collectCommand = True
|
||||
|
||||
def get_update_information(self):
|
||||
@@ -138,5 +135,8 @@ def __plugin_load__():
|
||||
|
||||
global __plugin_hooks__
|
||||
__plugin_hooks__ = {
|
||||
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
|
||||
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information,
|
||||
"octoprint.comm.protocol.gcode.received": __plugin_implementation__.comm_protocol_gcode_received,
|
||||
"octoprint.comm.protocol.gcode.sending": __plugin_implementation__.comm_protocol_gcode_sending
|
||||
# "octoprint.comm.protocol.atcommand.sending": __plugin_implementation__.comm_protocol_atcommand_sending
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
from __future__ import absolute_import, division, unicode_literals
|
||||
|
||||
import flask
|
||||
CMD_LOAD_STEPS_EEPROM = "loadSteps"
|
||||
CMD_LOAD_STEPS = "loadSteps"
|
||||
|
||||
|
||||
class API:
|
||||
@@ -16,11 +16,11 @@ class API:
|
||||
@staticmethod
|
||||
def get_api_commands():
|
||||
return {
|
||||
CMD_LOAD_STEPS_EEPROM: []
|
||||
CMD_LOAD_STEPS: []
|
||||
}
|
||||
|
||||
def on_api_get(self, request):
|
||||
self._logger.info("on api get")
|
||||
self._logger.debug("api.on_api_get")
|
||||
return flask.jsonify(
|
||||
{
|
||||
"data": self.m92Data
|
||||
@@ -28,8 +28,8 @@ class API:
|
||||
)
|
||||
|
||||
def on_api_command(self, command, data):
|
||||
if command == CMD_LOAD_STEPS_EEPROM:
|
||||
self._logger.info("CMD_LOAD_STEPS_EEPROM")
|
||||
self._logger.debug("api command [%s] received", command)
|
||||
if command == CMD_LOAD_STEPS:
|
||||
self._printer.commands("M92")
|
||||
return flask.jsonify({
|
||||
"data": self.m92Data
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
#tab_plugin_CalibrationTools .tab-content {
|
||||
#tab_plugin_CalibrationTools .tab-content, #tab_plugin_CalibrationTools .tab-content > .tab-pane {
|
||||
border: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
//Notification
|
||||
// new PNotify({
|
||||
// title: "Success",
|
||||
// text: _.sprintf(text, {
|
||||
// command: _.escape(commandSpec.name)
|
||||
// }),
|
||||
// type: "success"
|
||||
// });
|
||||
|
||||
|
||||
|
||||
$(function () {
|
||||
function CalibrationToolsViewModel(parameters) {
|
||||
var self = this;
|
||||
@@ -54,19 +43,7 @@ $(function () {
|
||||
self.steps["E"](response.data.E);
|
||||
}
|
||||
|
||||
self.calibrateESteps = function () {
|
||||
// OctoPrint.simpleApiCommand("loadSteps")
|
||||
// OctoPrint.control.sendGcodeWithParameters("M92").done(function (responseM92) {
|
||||
// OctoPrint.simpleApiGet("CalibrationTools").done(function (response) {
|
||||
// console.log("CalibrationTools");
|
||||
// self.from_json(response);
|
||||
// });
|
||||
// });
|
||||
console.log("calibrateESteps");
|
||||
console.log(self.steps.E(), self.results.remainedLength(), self.results.newSteps());
|
||||
}
|
||||
|
||||
self.loadStepsFromEPROM = function () {
|
||||
self.loadESteps = function () {
|
||||
OctoPrint.simpleApiCommand("CalibrationTools","loadSteps").done(function (response) {
|
||||
self.from_json(response);
|
||||
})
|
||||
|
||||
@@ -17,17 +17,17 @@
|
||||
</blockquote>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro field(label, number, binding, enable, unit) %}
|
||||
{% macro field(label, title, number, binding, enable, unit) %}
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<label for="{{ label }}" class="pull-right" style="margin-top: 5px;">
|
||||
<label for="{{ label }}" class="pull-right" style="margin-top: 5px;" title="{{ title }}">
|
||||
{{ _(label) }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="span6">
|
||||
<div class="input-append">
|
||||
<input type="{{ number }}" id="{{ label }}" class="input-small" step="0.01" data-bind="value: {{ binding }}, enable: {{ enable }}">
|
||||
<span class="add-on">{{ _(unit) }}</span>
|
||||
<input type="{{ number }}" id="{{ label }}" title="{{ title }}" class="input-small" step="0.01" data-bind="value: {{ binding }}, enable: {{ enable }}">
|
||||
<span class="add-on" title="{{ title }}">{{ _(unit) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
{{ snipped.subSection("EEPROM values") }}
|
||||
|
||||
{{ snipped.field("E steps", "number", "$root.steps.E", "false", "steps/mm") }}
|
||||
{{ snipped.field("E steps", "Number of steps/mm currently set in EEPROM", "number", "$root.steps.E", "false", "steps/mm") }}
|
||||
<div class="row-fluid">
|
||||
<div class="span6"></div>
|
||||
<div class="span6">
|
||||
<button class="btn" data-bind="click: $root.loadStepsFromEPROM, enable: $root.controlViewModel.isOperational() && (!$root.controlViewModel.isPrinting())">
|
||||
<button class="btn" data-bind="click: $root.loadESteps, enable: $root.controlViewModel.isOperational() && (!$root.controlViewModel.isPrinting())"
|
||||
title="Loads current value of steps/mm from current printer settings by calling M92">
|
||||
<i class="fas fa-sync-alt" style="color:false" data-color="false"></i>  
|
||||
Load EEPROM data
|
||||
</button>
|
||||
@@ -15,16 +16,28 @@
|
||||
|
||||
{{ snipped.subSection("Compute", true) }}
|
||||
|
||||
{{ snipped.field("Actual extrusion", "number", "$root.results.actualExtrusion", "false", "mm") }}
|
||||
{{ snipped.field("New steps value", "number", "$root.results.newSteps", "false", "steps/mm") }}
|
||||
{{ snipped.field("Extrusion marking length", "number", "$root.results.markLength", "true", "mm") }}
|
||||
{{ snipped.field("Measured value", "number", "$root.results.remainedLength", "true", "mm") }}
|
||||
<div class="row-fluid" style="margin-bottom: 5px;">
|
||||
<div class="span6"></div>
|
||||
<div class="span6">
|
||||
<button class="btn btn-success" data-bind="click: $root.startExtrusion, enable: $root.controlViewModel.isOperational() && (!$root.controlViewModel.isPrinting())"
|
||||
title="This will trigger M90, M83, G1 E100 F50, M82, G90 in order for extruding filament">
|
||||
<i class="fas fa-play" style="color:false" data-color="false"></i>  
|
||||
Start extrusion
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ 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("Extrusion marking length", "The length marked on filament before extrusion", "number", "$root.results.markLength", "true", "mm") }}
|
||||
{{ 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">
|
||||
<button class="btn btn-primary" data-bind="click: $root.calibrateESteps, enable: $root.controlViewModel.isOperational() && (!$root.controlViewModel.isPrinting())">
|
||||
<i class="fas fa-play" data-color="#000000"></i>  
|
||||
Start calibration
|
||||
<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">
|
||||
<i class="fas fa-save" data-color="#000000"></i>  
|
||||
Set new value
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -33,6 +46,6 @@
|
||||
{{ 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 minimise 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.
|
||||
", "text-warning" ) }}
|
||||
Reference in New Issue
Block a user