diff --git a/js_src/SettingsWindow.js b/js_src/SettingsWindow.js
index c96eaa3..3542ab1 100644
--- a/js_src/SettingsWindow.js
+++ b/js_src/SettingsWindow.js
@@ -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
diff --git a/js_src/gcodeGenerating.js b/js_src/gcodeGenerating.js
index 201cad0..d2da941 100644
--- a/js_src/gcodeGenerating.js
+++ b/js_src/gcodeGenerating.js
@@ -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;
}
diff --git a/www/css/settings.css b/www/css/settings.css
index 8a41cc4..cf5d48a 100644
--- a/www/css/settings.css
+++ b/www/css/settings.css
@@ -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;
diff --git a/www/settings.html b/www/settings.html
index 8af657e..525dcad 100644
--- a/www/settings.html
+++ b/www/settings.html
@@ -48,6 +48,7 @@
+
mm
mm
@@ -132,15 +133,16 @@
-