0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-25 02:27:56 +01:00

Merge branch 'feature/printerdriver' of https://github.com/Doodle3D/doodle3d-client into HEAD

This commit is contained in:
Wouter R 2013-10-14 17:47:33 +02:00
commit e29dd1576c
3 changed files with 29 additions and 8 deletions

View File

@ -45,6 +45,8 @@ function Printer() {
this.maxGCodeSize = 10; // max size of gcode in MB's (estimation)
this.stateOverruled = false;
// Events
Printer.UPDATE = "update";
@ -152,8 +154,10 @@ function Printer() {
//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
if(self.state == Printer.STATE_PRINTING || self.state == Printer.STATE_BUFFERING) {
console.log("sending next part");
console.log("Printer:sendPrintPart:gcode part received (state: ",self.state,")");
if(self.state == Printer.PRINTING_STATE || self.state == Printer.BUFFERING_STATE) {
console.log("Printer:sendPrintPart:sending next part");
self.sendPrintPart(sendIndex + sendLength, sendLength);
}
}
@ -195,7 +199,9 @@ function Printer() {
}
this.checkStatus = function() {
//console.log("Printer:checkStatus");
console.log("Printer:checkStatus");
this.stateOverruled = false;
console.log(" stateOverruled: ",this.stateOverruled);
var self = this;
if (communicateWithWifibox) {
$.ajax({
@ -203,7 +209,7 @@ function Printer() {
dataType: 'json',
timeout: this.timeoutTime,
success: function(response){
console.log("Printer:status: ",response.data.state," response: ",response);
console.log(" Printer:status: ",response.data.state); //," response: ",response);
self.handleStatusUpdate(response);
@ -223,12 +229,17 @@ function Printer() {
}
}
this.handleStatusUpdate = function(response) {
console.log("Printer:handleStatusUpdate");
var data = response.data;
if(response.status != "success") {
self.state = Printer.UNKNOWN_STATE;
} else {
// state
self.state = data.state;
console.log(" stateOverruled: ",this.stateOverruled);
if(!this.stateOverruled) {
self.state = data.state;
console.log(" state > ",self.state);
}
// temperature
self.temperature = data.hotend;
@ -248,4 +259,12 @@ function Printer() {
}
$(document).trigger(Printer.UPDATE);
}
this.overruleState = function(newState) {
this.stateOverruled = true;
console.log(" stateOverruled: ",this.stateOverruled);
self.state = newState;
$(document).trigger(Printer.UPDATE);
}
}

View File

@ -191,7 +191,8 @@ function stopPrint() {
console.log("f:stopPrint() >> sendPrintCommands = " + sendPrintCommands);
if (!confirm("Weet je zeker dat je huidige print wilt stoppen?")) return;
if (sendPrintCommands) printer.stop();
setState(Printer.STOPPING_STATE,printer.hasControl);
//setState(Printer.STOPPING_STATE,printer.hasControl);
printer.overruleState(Printer.STOPPING_STATE);
}
@ -211,7 +212,8 @@ function print(e) {
$("#textdump").text("");
if (_points.length > 2) {
setState(Printer.BUFFERING_STATE,printer.hasControl);
//setState(Printer.BUFFERING_STATE,printer.hasControl);
printer.overruleState(Printer.BUFFERING_STATE);
var gcode = generate_gcode();
//startPrint(gencode);

View File

@ -97,7 +97,7 @@
<legend>Access point settings</legend>
<label for="ssid">Wi-Fi box ssid*:</label><input type="text" class="large" name="network.ap.ssid" id="ssid"> <br>
<small>* The text <em>%%MAC_ADDR_TAIL%%</em> will be replaced by the last 6 digits of your Doodle3D Wi-Fi box's MAC address.</small>
<label for="ssid">Password:</label><input type="text" class="large" name="network.ap.key" id="ssid"> <br>
<label for="apKey">Password:</label><input type="text" class="large" name="network.ap.key" id="apKey"> <br>
<label for="ipaddress">Wi-Fi box IP address:</label><input type="text" name="network.ap.address" id="ipaddress"><br>
<label for="netmask">Wi-Fi box netmask:</label><input type="text" name="network.ap.netmask" id="netmask"><br>
<input type="button" name="create" value="Create" class="button" id="createAP"/>