Tab content user value in calibration process
This commit is contained in:
@@ -11,6 +11,7 @@ CMD_LOAD_STEPS = "loadSteps"
|
|||||||
CMD_START_EXTRUSION = "startExtrusion"
|
CMD_START_EXTRUSION = "startExtrusion"
|
||||||
CMD_SAVE_E_STEPS = "saveESteps"
|
CMD_SAVE_E_STEPS = "saveESteps"
|
||||||
|
|
||||||
|
|
||||||
class API(octoprint.plugin.SimpleApiPlugin):
|
class API(octoprint.plugin.SimpleApiPlugin):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_api_commands():
|
def get_api_commands():
|
||||||
@@ -52,7 +53,7 @@ class API(octoprint.plugin.SimpleApiPlugin):
|
|||||||
})
|
})
|
||||||
|
|
||||||
if command == CMD_START_EXTRUSION:
|
if command == CMD_START_EXTRUSION:
|
||||||
self._logger.debug("Heating the tools")
|
self._logger.debug("Heating the extruder [%s]", data)
|
||||||
if not self._printer.is_ready():
|
if not self._printer.is_ready():
|
||||||
self._logger.warning("Printer not ready, operation canceled")
|
self._logger.warning("Printer not ready, operation canceled")
|
||||||
return flask.abort(503, {
|
return flask.abort(503, {
|
||||||
@@ -60,14 +61,18 @@ class API(octoprint.plugin.SimpleApiPlugin):
|
|||||||
})
|
})
|
||||||
|
|
||||||
# Register event to be trigger when temp is achieved
|
# Register event to be trigger when temp is achieved
|
||||||
self.registerEventTemp("T0", 180, self.startExtrusion)
|
self.registerEventTemp("T0", int(data["extrudeTemp"]), self.startExtrusion, data["extrudeLength"], data["extrudeSpeed"])
|
||||||
|
|
||||||
# Heating the tool
|
# Heating the tool
|
||||||
self._printer.commands("M104 S180")
|
self._printer.commands("M104 S%(extrudeTemp)s" % data)
|
||||||
return
|
return
|
||||||
|
|
||||||
if command == CMD_SAVE_E_STEPS:
|
if command == CMD_SAVE_E_STEPS:
|
||||||
self._printer.commands(["M92 E%(newESteps)s" % data, "M500"])
|
cmds = ["M92 E%(newESteps)s" % data, "M500"]
|
||||||
|
if self.
|
||||||
|
cmds = cmds + ["M104 S0"]
|
||||||
|
self._printer.commands()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if command == CMD_TEST:
|
if command == CMD_TEST:
|
||||||
@@ -76,11 +81,12 @@ class API(octoprint.plugin.SimpleApiPlugin):
|
|||||||
|
|
||||||
############## HANDLERS ##############
|
############## HANDLERS ##############
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def startExtrusion(self, temps, *args):
|
def startExtrusion(self, temps, extrudeLength, extrudeSpeed, *args):
|
||||||
self._logger.debug("Temperature achieved, extrusion started %s, %s", temps, args)
|
self._logger.debug("Temperature achieved, extrusion started [temps:%s, extrudeLength:%s, extrudeSpeed:%s, args:%s]",
|
||||||
|
temps, extrudeLength, extrudeSpeed, args)
|
||||||
|
|
||||||
# Extrude
|
# Extrude
|
||||||
self._printer.extrude(amount=120, speed=50)
|
self._printer.extrude(amount=int(extrudeLength), speed=int(extrudeSpeed))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def m92GCodeResponse(self, line, event):
|
def m92GCodeResponse(self, line, event):
|
||||||
@@ -100,4 +106,4 @@ class API(octoprint.plugin.SimpleApiPlugin):
|
|||||||
self._logger.debug("Finished data collection")
|
self._logger.debug("Finished data collection")
|
||||||
self.collectCommand = False
|
self.collectCommand = False
|
||||||
if event:
|
if event:
|
||||||
event.set()
|
event.set()
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ class Hooks():
|
|||||||
self.events.remove(event)
|
self.events.remove(event)
|
||||||
|
|
||||||
# Registering a temp event
|
# Registering a temp event
|
||||||
|
# Trigger a function when the temparature
|
||||||
def registerEventTemp(self, tool, targetTemp, func, *arguments):
|
def registerEventTemp(self, tool, targetTemp, func, *arguments):
|
||||||
if func is None or not isinstance(func, collections.Callable):
|
if func is None or not isinstance(func, collections.Callable):
|
||||||
self._logger.warn("registerEventTemp: Attempt to register event without a function")
|
self._logger.warn("registerEventTemp: Attempt to register event without a function")
|
||||||
|
|||||||
@@ -62,15 +62,25 @@ $(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.startExtrusion = function () {
|
self.startExtrusion = function () {
|
||||||
OctoPrint.simpleApiCommand("CalibrationTools", "startExtrusion").done(function (response) {
|
OctoPrint.simpleApiCommand("CalibrationTools", "startExtrusion", {
|
||||||
|
"extrudeTemp": self.testParam.extrudeTemp(),
|
||||||
|
"extrudeLength": self.testParam.extrudeLength(),
|
||||||
|
"extrudeSpeed": self.testParam.extrudeSpeed()
|
||||||
|
}).done(function (response) {
|
||||||
new PNotify({
|
new PNotify({
|
||||||
title: "E axe calibration started",
|
title: "E axe calibration started",
|
||||||
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 ",
|
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: "warning",
|
type: "warning"
|
||||||
hide: false
|
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
})
|
}).fail(function (response) {
|
||||||
|
new PNotify({
|
||||||
|
title: "Error on starting extrusion ",
|
||||||
|
text: response.responseJSON.error,
|
||||||
|
type: "error",
|
||||||
|
hide: false
|
||||||
|
});
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
self.tempRestart = function () {
|
self.tempRestart = function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user