mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-25 10:37: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: 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;
|
||||
|
||||
var self = this;
|
||||
var autoHideDelay = 2000;
|
||||
var autoHideDelay = 5000;
|
||||
var autohideTimeout;
|
||||
|
||||
this.init = function($element) {
|
||||
|
@ -46,7 +46,7 @@ function Printer() {
|
||||
this.retryStopDelay; // 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;
|
||||
|
||||
@ -70,6 +70,13 @@ function Printer() {
|
||||
|
||||
this.preheat = function() {
|
||||
console.log("Printer:preheat");
|
||||
|
||||
if( this.state == Printer.BUFFERING_STATE ||
|
||||
this.state == Printer.PRINTING_STATE ||
|
||||
this.state == Printer.STOPPING_STATE) {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
if (communicateWithWifibox) {
|
||||
$.ajax({
|
||||
@ -114,7 +121,8 @@ function Printer() {
|
||||
var gcodeSize = gcodeLineSize*gcode.length/1024/1024; // estimate gcode size in MB's
|
||||
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)");
|
||||
return;
|
||||
}
|
||||
@ -159,7 +167,7 @@ function Printer() {
|
||||
this.gcode = [];
|
||||
btnStop.css("display","block"); // hack
|
||||
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
|
||||
} else {
|
||||
// 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) {
|
||||
var formElement = self.form.find("[name|='"+key+"']");
|
||||
console.log("formElement: ",formElement);
|
||||
formElement.addClass("error");
|
||||
var errorMsg = "<p class='errorMsg'>"+msg+"</p>"
|
||||
formElement.after(errorMsg);
|
||||
}
|
||||
this.clearValidationErrors = function() {
|
||||
var formElements = self.form.find(".error");
|
||||
formElements.each( function(index,element) {
|
||||
$(element).removeClass("error");
|
||||
});
|
||||
self.form.find(".errorMsg").remove();
|
||||
self.form.find(".error").removeClass("error");
|
||||
}
|
||||
|
||||
this.readForm = function() {
|
||||
|
@ -25,7 +25,7 @@ gcodeEnd.push("G90"); // absolute positioning
|
||||
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 = [];
|
||||
|
||||
function generate_gcode() {
|
||||
@ -139,9 +139,11 @@ function generate_gcode() {
|
||||
//console.log(" pointsToPrint: ",pointsToPrint);
|
||||
//console.log(" MAX_POINTS_TO_PRINT: ",MAX_POINTS_TO_PRINT);
|
||||
|
||||
console.log("pointsToPrint: ",pointsToPrint);
|
||||
|
||||
if(pointsToPrint > MAX_POINTS_TO_PRINT) {
|
||||
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 [];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user