0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-22 09:17:56 +01:00

hack: delay preheat to have a proper connection with printer

This commit is contained in:
peteruithoven 2014-02-12 17:27:41 +01:00
parent 26c864a301
commit daba2ef1c6

View File

@ -21,6 +21,10 @@ var hasControl;
var gcodeGenerateDelayer; var gcodeGenerateDelayer;
var gcodeGenerateDelay = 50; var gcodeGenerateDelay = 50;
var preheatDelay;
var preheatDelayTime = 15*1000;
function initButtonBehavior() { function initButtonBehavior() {
console.log("f:initButtonBehavior"); console.log("f:initButtonBehavior");
@ -428,7 +432,9 @@ function setState(newState,newHasControl) {
message.set("Printer connected",Message.INFO,true); message.set("Printer connected",Message.INFO,true);
console.log(" preheat: ",settings["printer.heatup.enabled"]); console.log(" preheat: ",settings["printer.heatup.enabled"]);
if(settings["printer.heatup.enabled"]) { if(settings["printer.heatup.enabled"]) {
printer.preheat(); // HACK: we delay the preheat because the driver needs time to connect
clearTimeout(preheatDelay);
preheatDelay = setTimeout(printer.preheat,preheatDelayTime); // retry after delay
} }
} else if(prevState == Printer.PRINTING_STATE && newState == Printer.STOPPING_STATE) { } else if(prevState == Printer.PRINTING_STATE && newState == Printer.STOPPING_STATE) {
console.log("stopmsg show"); console.log("stopmsg show");