mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-24 18:17:56 +01:00
Sending endcode with API:printer/stop. Refactored start- and endcode generation
This commit is contained in:
parent
9ead4a9416
commit
3e6dde503e
@ -212,11 +212,15 @@ function Printer() {
|
|||||||
|
|
||||||
this.stop = function() {
|
this.stop = function() {
|
||||||
console.log("Printer:stop");
|
console.log("Printer:stop");
|
||||||
|
endCode = generateEndCode();
|
||||||
|
console.log(" endCode: ",endCode);
|
||||||
|
var postData = { gcode: endCode.join("\n")};
|
||||||
var self = this;
|
var self = this;
|
||||||
if (communicateWithWifibox) {
|
if (communicateWithWifibox) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: this.wifiboxURL + "/printer/stop",
|
url: this.wifiboxURL + "/printer/stop",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
data: postData,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
timeout: this.timeoutTime,
|
timeout: this.timeoutTime,
|
||||||
success: function(data){
|
success: function(data){
|
||||||
|
@ -35,7 +35,6 @@ function generate_gcode() {
|
|||||||
gcode = [];
|
gcode = [];
|
||||||
|
|
||||||
console.log("settings: ",settings);
|
console.log("settings: ",settings);
|
||||||
var printerType = settings["printer.type"];
|
|
||||||
var speed = settings["printer.speed"]
|
var speed = settings["printer.speed"]
|
||||||
var normalSpeed = speed;
|
var normalSpeed = speed;
|
||||||
var bottomSpeed = speed*0.5;
|
var bottomSpeed = speed*0.5;
|
||||||
@ -61,24 +60,9 @@ function generate_gcode() {
|
|||||||
var gCodeOffsetX = printerBedWidth/2; //110; // mm
|
var gCodeOffsetX = printerBedWidth/2; //110; // mm
|
||||||
var gCodeOffsetY = printerBedHeight/2; //110; // mm
|
var gCodeOffsetY = printerBedHeight/2; //110; // mm
|
||||||
|
|
||||||
|
var startCode = generateStartCode();
|
||||||
|
var endCode = generateEndCode();
|
||||||
|
|
||||||
var startCode = "";
|
|
||||||
var endCode = "";
|
|
||||||
|
|
||||||
if(settingsWindow.isMarlinPrinter(printerType)) {
|
|
||||||
startCode = settings["printer.startcode.marlin"];
|
|
||||||
endCode = settings["printer.endcode.marlin"];
|
|
||||||
} else {
|
|
||||||
startCode = settings["printer.startcode.x3g"];
|
|
||||||
endCode = settings["printer.endcode.x3g"];
|
|
||||||
}
|
|
||||||
|
|
||||||
startCode = subsituteVariables(startCode,temperature,bedTemperature,preheatTemperature,preheatBedTemperature);
|
|
||||||
startCode = startCode.split("\n");
|
|
||||||
|
|
||||||
endCode = subsituteVariables(endCode,temperature,bedTemperature,preheatTemperature,preheatBedTemperature);
|
|
||||||
endCode = endCode.split("\n");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
console.log("f:generate_gcode >> EFFE CHECKEN:");
|
console.log("f:generate_gcode >> EFFE CHECKEN:");
|
||||||
console.log(" speed: " + speed);
|
console.log(" speed: " + speed);
|
||||||
@ -274,7 +258,39 @@ function generate_gcode() {
|
|||||||
return gcode;
|
return gcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
function subsituteVariables(gcode,temperature,bedTemperature,preheatTemperature,preheatBedTemperature) {
|
function generateStartCode() {
|
||||||
|
var printerType = settings["printer.type"];
|
||||||
|
|
||||||
|
var startCode = "";
|
||||||
|
if(settingsWindow.isMarlinPrinter(printerType)) {
|
||||||
|
startCode = settings["printer.startcode.marlin"];
|
||||||
|
} else {
|
||||||
|
startCode = settings["printer.startcode.x3g"];
|
||||||
|
}
|
||||||
|
startCode = subsituteVariables(startCode);
|
||||||
|
startCode = startCode.split("\n");
|
||||||
|
return startCode;
|
||||||
|
}
|
||||||
|
function generateEndCode() {
|
||||||
|
var printerType = settings["printer.type"];
|
||||||
|
|
||||||
|
var endCode = "";
|
||||||
|
if(settingsWindow.isMarlinPrinter(printerType)) {
|
||||||
|
endCode = settings["printer.endcode.marlin"];
|
||||||
|
} else {
|
||||||
|
endCode = settings["printer.endcode.x3g"];
|
||||||
|
}
|
||||||
|
endCode = subsituteVariables(endCode);
|
||||||
|
endCode = endCode.split("\n");
|
||||||
|
return endCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
function subsituteVariables(gcode) {
|
||||||
|
//,temperature,bedTemperature,preheatTemperature,preheatBedTemperature
|
||||||
|
var temperature = settings["printer.temperature"];
|
||||||
|
var bedTemperature = settings["printer.bed.temperature"];
|
||||||
|
var preheatTemperature = settings["printer.heatup.temperature"];
|
||||||
|
var preheatBedTemperature = settings["printer.heatup.bed.temperature"];
|
||||||
|
|
||||||
gcode = gcode.replace(/{printingTemp}/gi ,temperature);
|
gcode = gcode.replace(/{printingTemp}/gi ,temperature);
|
||||||
gcode = gcode.replace(/{printingBedTemp}/gi ,bedTemperature);
|
gcode = gcode.replace(/{printingBedTemp}/gi ,bedTemperature);
|
||||||
|
Loading…
Reference in New Issue
Block a user