mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 01:07: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() {
|
||||
console.log("Printer:stop");
|
||||
endCode = generateEndCode();
|
||||
console.log(" endCode: ",endCode);
|
||||
var postData = { gcode: endCode.join("\n")};
|
||||
var self = this;
|
||||
if (communicateWithWifibox) {
|
||||
$.ajax({
|
||||
url: this.wifiboxURL + "/printer/stop",
|
||||
type: "POST",
|
||||
data: postData,
|
||||
dataType: 'json',
|
||||
timeout: this.timeoutTime,
|
||||
success: function(data){
|
||||
|
@ -142,6 +142,7 @@ function SettingsWindow() {
|
||||
self.hideSettings(function() {
|
||||
enableButton(self.btnOK,self.submitwindow);
|
||||
});
|
||||
self.signin();
|
||||
} else {
|
||||
enableButton(self.btnOK,self.submitwindow);
|
||||
}
|
||||
@ -151,13 +152,11 @@ function SettingsWindow() {
|
||||
}
|
||||
|
||||
this.showSettings = function() {
|
||||
console.log("f:showSettings()");
|
||||
|
||||
this.loadSettings(); // reload settings
|
||||
// this.window.css("display","table");
|
||||
this.loadSettings(function() { // reload settings
|
||||
$("#contentOverlay").fadeIn(375, function() {
|
||||
document.body.removeEventListener('touchmove',prevent,false);
|
||||
});
|
||||
});
|
||||
}
|
||||
this.hideSettings = function(complete) {
|
||||
$("#contentOverlay").fadeOut(375, function() {
|
||||
@ -167,7 +166,7 @@ function SettingsWindow() {
|
||||
});
|
||||
}
|
||||
|
||||
this.loadSettings = function() {
|
||||
this.loadSettings = function(complete) {
|
||||
if (!communicateWithWifibox) {
|
||||
console.log(" communicateWithWifibox is false: settings aren't being loaded from wifibox...")
|
||||
return;
|
||||
@ -184,6 +183,7 @@ function SettingsWindow() {
|
||||
console.log(" settings: ",settings);
|
||||
self.fillForm();
|
||||
$(document).trigger(SettingsWindow.SETTINGS_LOADED);
|
||||
if(complete) complete();
|
||||
}
|
||||
}).fail(function() {
|
||||
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
|
||||
*/
|
||||
|
@ -35,7 +35,6 @@ function generate_gcode() {
|
||||
gcode = [];
|
||||
|
||||
console.log("settings: ",settings);
|
||||
var printerType = settings["printer.type"];
|
||||
var speed = settings["printer.speed"]
|
||||
var normalSpeed = speed;
|
||||
var bottomSpeed = speed*0.5;
|
||||
@ -61,23 +60,8 @@ function generate_gcode() {
|
||||
var gCodeOffsetX = printerBedWidth/2; //110; // mm
|
||||
var gCodeOffsetY = printerBedHeight/2; //110; // mm
|
||||
|
||||
|
||||
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");
|
||||
var startCode = generateStartCode();
|
||||
var endCode = generateEndCode();
|
||||
|
||||
/*
|
||||
console.log("f:generate_gcode >> EFFE CHECKEN:");
|
||||
@ -274,7 +258,39 @@ function generate_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(/{printingBedTemp}/gi ,bedTemperature);
|
||||
|
Loading…
Reference in New Issue
Block a user