0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-22 01:07:56 +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

@ -45,7 +45,6 @@ function SettingsWindow() {
this.retrySaveSettingsDelay; // retry setTimout instance this.retrySaveSettingsDelay; // retry setTimout instance
this.retryRetrieveNetworkStatusDelay;// retry setTimout instance this.retryRetrieveNetworkStatusDelay;// retry setTimout instance
this.apFieldSet; this.apFieldSet;
this.clientFieldSet; this.clientFieldSet;
this.networks; this.networks;
@ -109,6 +108,7 @@ function SettingsWindow() {
self.loadSettings(); self.loadSettings();
self.printerSelector = self.form.find("#printerType");
var btnAP = self.form.find("label[for='ap']"); var btnAP = self.form.find("label[for='ap']");
var btnClient = self.form.find("label[for='client']"); var btnClient = self.form.find("label[for='client']");
var btnRefresh = self.form.find("#refreshNetworks"); var btnRefresh = self.form.find("#refreshNetworks");
@ -117,12 +117,15 @@ function SettingsWindow() {
var networkSelector = self.form.find("#network"); var networkSelector = self.form.find("#network");
self.apFieldSet = self.form.find("#apSettings"); self.apFieldSet = self.form.find("#apSettings");
self.clientFieldSet = self.form.find("#clientSettings"); self.clientFieldSet = self.form.find("#clientSettings");
self.gcodeSettings = self.form.find("#gcodeSettings");
self.x3gSettings = self.form.find("#x3gSettings");
btnAP.on('touchstart mousedown',self.showAPSettings); btnAP.on('touchstart mousedown',self.showAPSettings);
btnClient.on('touchstart mousedown',self.showClientSettings); btnClient.on('touchstart mousedown',self.showClientSettings);
btnRefresh.on('touchstart mousedown',self.refreshNetworks); btnRefresh.on('touchstart mousedown',self.refreshNetworks);
btnConnect.on('touchstart mousedown',self.connectToNetwork); btnConnect.on('touchstart mousedown',self.connectToNetwork);
btnCreate.on('touchstart mousedown',self.createAP); btnCreate.on('touchstart mousedown',self.createAP);
self.printerSelector.change(self.printerSelectorChanged);
networkSelector.change(self.networkSelectorChanged); networkSelector.change(self.networkSelectorChanged);
// update panel // update panel
@ -220,6 +223,7 @@ function SettingsWindow() {
var value = settings[element.attr('name')]; var value = settings[element.attr('name')];
element.val(value); element.val(value);
}); });
self.printerSelectorChanged();
} }
this.saveSettings = function(newSettings,complete) { this.saveSettings = function(newSettings,complete) {
@ -304,6 +308,22 @@ function SettingsWindow() {
return 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 * Networks ui
*/ */

View File

@ -35,6 +35,7 @@ function generate_gcode() {
gcode = []; gcode = [];
console.log("settings: ",settings); console.log("settings: ",settings);
var printerType = settings["printer.type"];
var speed = settings["printer.speed"] var speed = settings["printer.speed"]
var normalSpeed = speed; var normalSpeed = speed;
var bottomSpeed = speed*0.5; var bottomSpeed = speed*0.5;
@ -60,13 +61,28 @@ function generate_gcode() {
var gCodeOffsetX = printerBedWidth/2; //110; // mm var gCodeOffsetX = printerBedWidth/2; //110; // mm
var gCodeOffsetY = printerBedHeight/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 endGcode = settings["printer.endgcode"]; var startCode = "";
endGcode = subsituteVariables(endGcode,temperature,bedTemperature,preheatTemperature,preheatBedTemperature); var endCode = "";
endGcode = endGcode.split("\n");
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");
endCode = subsituteVariables(endCode,temperature,bedTemperature,preheatTemperature,preheatBedTemperature);
endCode = endCode.split("\n");
/* /*
console.log("f:generate_gcode >> EFFE CHECKEN:"); 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 //gcode.push("M109 S" + temperature); // set target temperature and wait for the extruder to reach it
// add gcode begin commands // 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 //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 // add gcode end commands
gcode = gcode.concat(endGcode); gcode = gcode.concat(endCode);
return gcode; return gcode;
} }

View File

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

View File

@ -48,6 +48,7 @@
<option value="tantillus">Tantillus</option> <option value="tantillus">Tantillus</option>
<option value="vision_3d_printer">Vision 3D Printer</option> <option value="vision_3d_printer">Vision 3D Printer</option>
<option value="marlin_generic">Generic Marlin Printer</option> <option value="marlin_generic">Generic Marlin Printer</option>
<option value="makerbot_generic">Generic Makerbot Printer</option>
</select><br/> </select><br/>
<label for="printerBedWidth">Bed width:</label><input id="printerBedWidth" type="number" class="small" name="printer.bed.width">mm<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> <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> <small id="updateInfo"></small>
</fieldset> </fieldset>
<fieldset> <fieldset id="gcodeSettings">
<legend>GCODE settings</legend> <legend>GCODE settings</legend>
<small class="intro">GCode settings for all printers that use Marlin firmware</small>
<div class="startgcode_left"> <div class="startgcode_left">
<label for="startgcode">Start:</label><br/> <label for="startgcodeMarlin">Start:</label><br/>
<textarea id="startgcode" class="gcode" name="printer.startgcode"></textarea> <textarea id="startgcodeMarlin" class="gcode" name="printer.startcode.marlin"></textarea>
</div> </div>
<div> <div>
<label for="endgcode">End:</label><br/> <label for="endgcodeMarlin">End:</label><br/>
<textarea id="endgcode" class="gcode" name="printer.endgcode"></textarea> <textarea id="endcodeMarlin" class="gcode" name="printer.endcode.marlin"></textarea>
</div> </div>
<small> <small>
The following texts are replaced: The following texts are replaced:
@ -152,6 +154,28 @@
</dl> </dl>
</small> </small>
</fieldset> </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/> </form><br/>
</div> </div>
</body> </body>