mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-04 19:33:22 +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: Lowering max drawing complexity Also showing warning when gcode file is to big Messages auto hide after 2 > 5 seconds Settings validation messages are properly cleared Prevent preheat while buffering/printing/stopping Spelling correction
This commit is contained in:
commit
7cc5b01b37
@ -10,7 +10,7 @@ function Message() {
|
|||||||
this.$element;
|
this.$element;
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var autoHideDelay = 2000;
|
var autoHideDelay = 5000;
|
||||||
var autohideTimeout;
|
var autohideTimeout;
|
||||||
|
|
||||||
this.init = function($element) {
|
this.init = function($element) {
|
||||||
|
@ -46,7 +46,7 @@ function Printer() {
|
|||||||
this.retryStopDelay; // retry setTimout instance
|
this.retryStopDelay; // retry setTimout instance
|
||||||
this.retryPreheatDelay; // retry setTimout instance
|
this.retryPreheatDelay; // retry setTimout instance
|
||||||
|
|
||||||
this.maxGCodeSize = 10; // max size of gcode in MB's (estimation)
|
Printer.MAX_GCODE_SIZE = 10; // max size of gcode in MB's (estimation)
|
||||||
|
|
||||||
this.stateOverruled = false;
|
this.stateOverruled = false;
|
||||||
|
|
||||||
@ -70,6 +70,13 @@ function Printer() {
|
|||||||
|
|
||||||
this.preheat = function() {
|
this.preheat = function() {
|
||||||
console.log("Printer:preheat");
|
console.log("Printer:preheat");
|
||||||
|
|
||||||
|
if( this.state == Printer.BUFFERING_STATE ||
|
||||||
|
this.state == Printer.PRINTING_STATE ||
|
||||||
|
this.state == Printer.STOPPING_STATE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
if (communicateWithWifibox) {
|
if (communicateWithWifibox) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -114,7 +121,8 @@ function Printer() {
|
|||||||
var gcodeSize = gcodeLineSize*gcode.length/1024/1024; // estimate gcode size in MB's
|
var gcodeSize = gcodeLineSize*gcode.length/1024/1024; // estimate gcode size in MB's
|
||||||
console.log(" gcodeSize: ",gcodeSize);
|
console.log(" gcodeSize: ",gcodeSize);
|
||||||
|
|
||||||
if(gcodeSize > this.maxGCodeSize) {
|
if(gcodeSize > Printer.MAX_GCODE_SIZE) {
|
||||||
|
alert("Error: Printer:print: gcode file is probably to big ("+gcodeSize+"MB) (max: "+this.maxGCodeSize+"MB)");
|
||||||
console.log("Error: Printer:print: gcode file is probably to big ("+gcodeSize+"MB) (max: "+this.maxGCodeSize+"MB)");
|
console.log("Error: Printer:print: gcode file is probably to big ("+gcodeSize+"MB) (max: "+this.maxGCodeSize+"MB)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -159,7 +167,7 @@ function Printer() {
|
|||||||
this.gcode = [];
|
this.gcode = [];
|
||||||
btnStop.css("display","block"); // hack
|
btnStop.css("display","block"); // hack
|
||||||
self.removeLeaveWarning();
|
self.removeLeaveWarning();
|
||||||
message.set("Doodle is send to printer...",Message.INFO,true);
|
message.set("Doodle is sent to printer...",Message.INFO,true);
|
||||||
//self.targetTemperature = settings["printer.temperature"]; // slight hack
|
//self.targetTemperature = settings["printer.temperature"]; // slight hack
|
||||||
} else {
|
} else {
|
||||||
// only if the state hasn't bin changed (by for example pressing stop) we send more gcode
|
// only if the state hasn't bin changed (by for example pressing stop) we send more gcode
|
||||||
|
@ -245,16 +245,13 @@ function SettingsWindow() {
|
|||||||
}
|
}
|
||||||
this.displayValidationError = function(key,msg) {
|
this.displayValidationError = function(key,msg) {
|
||||||
var formElement = self.form.find("[name|='"+key+"']");
|
var formElement = self.form.find("[name|='"+key+"']");
|
||||||
console.log("formElement: ",formElement);
|
|
||||||
formElement.addClass("error");
|
formElement.addClass("error");
|
||||||
var errorMsg = "<p class='errorMsg'>"+msg+"</p>"
|
var errorMsg = "<p class='errorMsg'>"+msg+"</p>"
|
||||||
formElement.after(errorMsg);
|
formElement.after(errorMsg);
|
||||||
}
|
}
|
||||||
this.clearValidationErrors = function() {
|
this.clearValidationErrors = function() {
|
||||||
var formElements = self.form.find(".error");
|
self.form.find(".errorMsg").remove();
|
||||||
formElements.each( function(index,element) {
|
self.form.find(".error").removeClass("error");
|
||||||
$(element).removeClass("error");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.readForm = function() {
|
this.readForm = function() {
|
||||||
|
@ -25,7 +25,7 @@ gcodeEnd.push("G90"); // absolute positioning
|
|||||||
gcodeEnd.push("M117 Done "); // display message (20 characters to clear whole screen)*/
|
gcodeEnd.push("M117 Done "); // display message (20 characters to clear whole screen)*/
|
||||||
|
|
||||||
|
|
||||||
var MAX_POINTS_TO_PRINT = 400000; //80000; //40000;
|
var MAX_POINTS_TO_PRINT = 200000; //400000; //80000; //40000;
|
||||||
var gcode = [];
|
var gcode = [];
|
||||||
|
|
||||||
function generate_gcode() {
|
function generate_gcode() {
|
||||||
@ -139,9 +139,11 @@ function generate_gcode() {
|
|||||||
//console.log(" pointsToPrint: ",pointsToPrint);
|
//console.log(" pointsToPrint: ",pointsToPrint);
|
||||||
//console.log(" MAX_POINTS_TO_PRINT: ",MAX_POINTS_TO_PRINT);
|
//console.log(" MAX_POINTS_TO_PRINT: ",MAX_POINTS_TO_PRINT);
|
||||||
|
|
||||||
|
console.log("pointsToPrint: ",pointsToPrint);
|
||||||
|
|
||||||
if(pointsToPrint > MAX_POINTS_TO_PRINT) {
|
if(pointsToPrint > MAX_POINTS_TO_PRINT) {
|
||||||
alert("Sorry, your doodle to to complex and / or to high");
|
alert("Sorry, your doodle to to complex and / or to high");
|
||||||
console.log("WARNING: to many points to convert to gcode");
|
console.log("ERROR: to many points to convert to gcode");
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user