mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 09:17:56 +01:00
Merge branch 'feature/printerdriver' of https://github.com/Doodle3D/doodle3d-client into feature/printerdriver
# By peteruithoven # Via peteruithoven * 'feature/printerdriver' of https://github.com/Doodle3D/doodle3d-client: Sending endcode with API:printer/stop. Refactored start- and endcode generation Seperate CGI-bin signin request Open Settings window after settings are loaded
This commit is contained in:
commit
69b50cc55d
@ -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){
|
||||||
|
@ -142,6 +142,7 @@ function SettingsWindow() {
|
|||||||
self.hideSettings(function() {
|
self.hideSettings(function() {
|
||||||
enableButton(self.btnOK,self.submitwindow);
|
enableButton(self.btnOK,self.submitwindow);
|
||||||
});
|
});
|
||||||
|
self.signin();
|
||||||
} else {
|
} else {
|
||||||
enableButton(self.btnOK,self.submitwindow);
|
enableButton(self.btnOK,self.submitwindow);
|
||||||
}
|
}
|
||||||
@ -151,13 +152,11 @@ function SettingsWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.showSettings = function() {
|
this.showSettings = function() {
|
||||||
console.log("f:showSettings()");
|
this.loadSettings(function() { // reload settings
|
||||||
|
|
||||||
this.loadSettings(); // reload settings
|
|
||||||
// this.window.css("display","table");
|
|
||||||
$("#contentOverlay").fadeIn(375, function() {
|
$("#contentOverlay").fadeIn(375, function() {
|
||||||
document.body.removeEventListener('touchmove',prevent,false);
|
document.body.removeEventListener('touchmove',prevent,false);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.hideSettings = function(complete) {
|
this.hideSettings = function(complete) {
|
||||||
$("#contentOverlay").fadeOut(375, function() {
|
$("#contentOverlay").fadeOut(375, function() {
|
||||||
@ -167,7 +166,7 @@ function SettingsWindow() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadSettings = function() {
|
this.loadSettings = function(complete) {
|
||||||
if (!communicateWithWifibox) {
|
if (!communicateWithWifibox) {
|
||||||
console.log(" communicateWithWifibox is false: settings aren't being loaded from wifibox...")
|
console.log(" communicateWithWifibox is false: settings aren't being loaded from wifibox...")
|
||||||
return;
|
return;
|
||||||
@ -184,6 +183,7 @@ function SettingsWindow() {
|
|||||||
console.log(" settings: ",settings);
|
console.log(" settings: ",settings);
|
||||||
self.fillForm();
|
self.fillForm();
|
||||||
$(document).trigger(SettingsWindow.SETTINGS_LOADED);
|
$(document).trigger(SettingsWindow.SETTINGS_LOADED);
|
||||||
|
if(complete) complete();
|
||||||
}
|
}
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
console.log("Settings:loadSettings: failed");
|
console.log("Settings:loadSettings: failed");
|
||||||
@ -332,6 +332,20 @@ function SettingsWindow() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.signin = function() {
|
||||||
|
$.ajax({
|
||||||
|
url: self.wifiboxCGIBinURL + "/network/signin",
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
timeout: self.timeoutTime,
|
||||||
|
success: function(response){
|
||||||
|
console.log("Settings:signin response: ",response);
|
||||||
|
}
|
||||||
|
}).fail(function() {
|
||||||
|
console.log("Settings:signin: failed");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Networks ui
|
* Networks ui
|
||||||
*/
|
*/
|
||||||
|
@ -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,23 +60,8 @@ 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 startCode = "";
|
var endCode = generateEndCode();
|
||||||
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:");
|
||||||
@ -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