0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-12-22 13:13:48 +01:00

Makerbot start- and endcode settings

This commit is contained in:
peteruithoven 2013-10-28 01:11:13 +01:00
parent 636d00370a
commit 96a48b38d9
4 changed files with 85 additions and 19 deletions

View File

@ -44,8 +44,7 @@ function SettingsWindow() {
this.retryLoadSettingsDelay; // retry setTimout instance
this.retrySaveSettingsDelay; // retry setTimout instance
this.retryRetrieveNetworkStatusDelay;// retry setTimout instance
this.apFieldSet;
this.clientFieldSet;
this.networks;
@ -108,7 +107,8 @@ function SettingsWindow() {
self.form.submit(function (e) { self.submitwindow(e) });
self.loadSettings();
self.printerSelector = self.form.find("#printerType");
var btnAP = self.form.find("label[for='ap']");
var btnClient = self.form.find("label[for='client']");
var btnRefresh = self.form.find("#refreshNetworks");
@ -117,14 +117,17 @@ function SettingsWindow() {
var networkSelector = self.form.find("#network");
self.apFieldSet = self.form.find("#apSettings");
self.clientFieldSet = self.form.find("#clientSettings");
self.gcodeSettings = self.form.find("#gcodeSettings");
self.x3gSettings = self.form.find("#x3gSettings");
btnAP.on('touchstart mousedown',self.showAPSettings);
btnClient.on('touchstart mousedown',self.showClientSettings);
btnRefresh.on('touchstart mousedown',self.refreshNetworks);
btnConnect.on('touchstart mousedown',self.connectToNetwork);
btnCreate.on('touchstart mousedown',self.createAP);
self.printerSelector.change(self.printerSelectorChanged);
networkSelector.change(self.networkSelectorChanged);
// update panel
var $updatePanelElement = self.form.find("#updatePanel");
self.updatePanel.init(wifiboxURL,$updatePanelElement);
@ -220,6 +223,7 @@ function SettingsWindow() {
var value = settings[element.attr('name')];
element.val(value);
});
self.printerSelectorChanged();
}
this.saveSettings = function(newSettings,complete) {
@ -303,6 +307,22 @@ function SettingsWindow() {
//console.log(settings);
return settings;
}
this.printerSelectorChanged = function(e) {
var selectedOption = self.printerSelector.find("option:selected");
switch(selectedOption.val()) {
case "makerbot_generic":
case "makerbot_replicator2":
case "makerbot_thingomatic":
self.gcodeSettings.hide();
self.x3gSettings.show();
break;
default:
self.x3gSettings.hide();
self.gcodeSettings.show();
break;
}
}
/*
* Networks ui

View File

@ -35,6 +35,7 @@ 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;
@ -60,13 +61,28 @@ function generate_gcode() {
var gCodeOffsetX = printerBedWidth/2; //110; // mm
var gCodeOffsetY = printerBedHeight/2; //110; // mm
var startGcode = settings["printer.startgcode"];
startGcode = subsituteVariables(startGcode,temperature,bedTemperature,preheatTemperature,preheatBedTemperature);
startGcode = startGcode.split("\n");
var startCode = "";
var endCode = "";
switch(printerType) {
case "makerbot_generic":
case "makerbot_replicator2":
case "makerbot_thingomatic":
startCode = settings["printer.startcode.x3g"];
endCode = settings["printer.endcode.x3g"];
break;
default:
startCode = settings["printer.startcode.marlin"];
endCode = settings["printer.endcode.marlin"];
break;
}
startCode = subsituteVariables(startCode,temperature,bedTemperature,preheatTemperature,preheatBedTemperature);
startCode = startCode.split("\n");
var endGcode = settings["printer.endgcode"];
endGcode = subsituteVariables(endGcode,temperature,bedTemperature,preheatTemperature,preheatBedTemperature);
endGcode = endGcode.split("\n");
endCode = subsituteVariables(endCode,temperature,bedTemperature,preheatTemperature,preheatBedTemperature);
endCode = endCode.split("\n");
/*
console.log("f:generate_gcode >> EFFE CHECKEN:");
@ -114,7 +130,7 @@ function generate_gcode() {
//gcode.push("M109 S" + temperature); // set target temperature and wait for the extruder to reach it
// add gcode begin commands
gcode = gcode.concat(startGcode);
gcode = gcode.concat(startCode);
//gcode.push("M109 S" + temperature); // set target temperature and wait for the extruder to reach it
@ -258,7 +274,7 @@ function generate_gcode() {
}
}
// add gcode end commands
gcode = gcode.concat(endGcode);
gcode = gcode.concat(endCode);
return gcode;
}

View File

@ -102,6 +102,12 @@ form .errorMsg {
color: #f00;
margin: 0 0 0 1em;
}
form .intro {
margin: 0 0 0.5em 0;
}
form dl {
margin: 0.5em 0 0 0;
}
form dl dt {
float: left;
font-style: italic;

View File

@ -48,6 +48,7 @@
<option value="tantillus">Tantillus</option>
<option value="vision_3d_printer">Vision 3D Printer</option>
<option value="marlin_generic">Generic Marlin Printer</option>
<option value="makerbot_generic">Generic Makerbot Printer</option>
</select><br/>
<label for="printerBedWidth">Bed width:</label><input id="printerBedWidth" type="number" class="small" name="printer.bed.width">mm<br>
<label for="printerBedHeight">Bed height:</label><input id="printerBedHeight" type="number" class="small" name="printer.bed.height">mm<br>
@ -132,15 +133,16 @@
<small id="updateInfo"></small>
</fieldset>
<fieldset>
<fieldset id="gcodeSettings">
<legend>GCODE settings</legend>
<div class="startgcode_left">
<label for="startgcode">Start:</label><br/>
<textarea id="startgcode" class="gcode" name="printer.startgcode"></textarea>
<small class="intro">GCode settings for all printers that use Marlin firmware</small>
<div class="startgcode_left">
<label for="startgcodeMarlin">Start:</label><br/>
<textarea id="startgcodeMarlin" class="gcode" name="printer.startcode.marlin"></textarea>
</div>
<div>
<label for="endgcode">End:</label><br/>
<textarea id="endgcode" class="gcode" name="printer.endgcode"></textarea>
<label for="endgcodeMarlin">End:</label><br/>
<textarea id="endcodeMarlin" class="gcode" name="printer.endcode.marlin"></textarea>
</div>
<small>
The following texts are replaced:
@ -152,6 +154,28 @@
</dl>
</small>
</fieldset>
<fieldset id="x3gSettings">
<legend>X3G settings</legend>
<small class="intro">X3G settings for all printers that use Sailfish firmware, like Makerbots.</small>
<div class="startgcode_left">
<label for="startgcodeX3G">Start:</label><br/>
<textarea id="startcodeX3G" class="gcode" name="printer.startcode.x3g"></textarea>
</div>
<div>
<label for="endgcodeX3G">End:</label><br/>
<textarea id="endcodeX3G" class="gcode" name="printer.endcode.x3g"></textarea>
</div>
<small>
The following texts are replaced:
<dl>
<dt>{printingTemp}</dt><dd>Printing temperature</dd>
<dt>{printingBedTemp}</dt><dd>Printing bed temperature</dd>
<dt>{preheatTemp}</dt><dd>Preheat temperature</dd>
<dt>{preheatBedTemp}</dt><dd>Preheat bed temperature</dd>
</dl>
</small>
</fieldset>
</form><br/>
</div>
</body>