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_SAVE_E_STEPS = "saveESteps"
|
||||
|
||||
|
||||
class API(octoprint.plugin.SimpleApiPlugin):
|
||||
@staticmethod
|
||||
def get_api_commands():
|
||||
@@ -52,7 +53,7 @@ class API(octoprint.plugin.SimpleApiPlugin):
|
||||
})
|
||||
|
||||
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():
|
||||
self._logger.warning("Printer not ready, operation canceled")
|
||||
return flask.abort(503, {
|
||||
@@ -60,14 +61,18 @@ class API(octoprint.plugin.SimpleApiPlugin):
|
||||
})
|
||||
|
||||
# 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
|
||||
self._printer.commands("M104 S180")
|
||||
self._printer.commands("M104 S%(extrudeTemp)s" % data)
|
||||
return
|
||||
|
||||
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
|
||||
|
||||
if command == CMD_TEST:
|
||||
@@ -76,11 +81,12 @@ class API(octoprint.plugin.SimpleApiPlugin):
|
||||
|
||||
############## HANDLERS ##############
|
||||
@staticmethod
|
||||
def startExtrusion(self, temps, *args):
|
||||
self._logger.debug("Temperature achieved, extrusion started %s, %s", temps, args)
|
||||
def startExtrusion(self, temps, extrudeLength, extrudeSpeed, *args):
|
||||
self._logger.debug("Temperature achieved, extrusion started [temps:%s, extrudeLength:%s, extrudeSpeed:%s, args:%s]",
|
||||
temps, extrudeLength, extrudeSpeed, args)
|
||||
|
||||
# Extrude
|
||||
self._printer.extrude(amount=120, speed=50)
|
||||
self._printer.extrude(amount=int(extrudeLength), speed=int(extrudeSpeed))
|
||||
|
||||
@staticmethod
|
||||
def m92GCodeResponse(self, line, event):
|
||||
|
||||
@@ -62,6 +62,7 @@ class Hooks():
|
||||
self.events.remove(event)
|
||||
|
||||
# Registering a temp event
|
||||
# Trigger a function when the temparature
|
||||
def registerEventTemp(self, tool, targetTemp, func, *arguments):
|
||||
if func is None or not isinstance(func, collections.Callable):
|
||||
self._logger.warn("registerEventTemp: Attempt to register event without a function")
|
||||
|
||||
@@ -62,14 +62,24 @@ $(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({
|
||||
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 ",
|
||||
type: "warning",
|
||||
hide: false
|
||||
type: "warning"
|
||||
});
|
||||
console.log(response);
|
||||
}).fail(function (response) {
|
||||
new PNotify({
|
||||
title: "Error on starting extrusion ",
|
||||
text: response.responseJSON.error,
|
||||
type: "error",
|
||||
hide: false
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user