mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 09:17:56 +01:00
A little less code duplication
This commit is contained in:
parent
96a48b38d9
commit
f783726c47
@ -310,16 +310,24 @@ function SettingsWindow() {
|
|||||||
|
|
||||||
this.printerSelectorChanged = function(e) {
|
this.printerSelectorChanged = function(e) {
|
||||||
var selectedOption = self.printerSelector.find("option:selected");
|
var selectedOption = self.printerSelector.find("option:selected");
|
||||||
switch(selectedOption.val()) {
|
if(self.isMarlinPrinter(selectedOption.val())) {
|
||||||
|
self.x3gSettings.hide();
|
||||||
|
self.gcodeSettings.show();
|
||||||
|
} else {
|
||||||
|
self.gcodeSettings.hide();
|
||||||
|
self.x3gSettings.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isMarlinPrinter = function(printer) {
|
||||||
|
switch(printer) {
|
||||||
case "makerbot_generic":
|
case "makerbot_generic":
|
||||||
case "makerbot_replicator2":
|
case "makerbot_replicator2":
|
||||||
case "makerbot_thingomatic":
|
case "makerbot_thingomatic":
|
||||||
self.gcodeSettings.hide();
|
return false;
|
||||||
self.x3gSettings.show();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
self.x3gSettings.hide();
|
return true;
|
||||||
self.gcodeSettings.show();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,17 +65,12 @@ function generate_gcode() {
|
|||||||
var startCode = "";
|
var startCode = "";
|
||||||
var endCode = "";
|
var endCode = "";
|
||||||
|
|
||||||
switch(printerType) {
|
if(settingsWindow.isMarlinPrinter(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"];
|
startCode = settings["printer.startcode.marlin"];
|
||||||
endCode = settings["printer.endcode.marlin"];
|
endCode = settings["printer.endcode.marlin"];
|
||||||
break;
|
} else {
|
||||||
|
startCode = settings["printer.startcode.x3g"];
|
||||||
|
endCode = settings["printer.endcode.x3g"];
|
||||||
}
|
}
|
||||||
|
|
||||||
startCode = subsituteVariables(startCode,temperature,bedTemperature,preheatTemperature,preheatBedTemperature);
|
startCode = subsituteVariables(startCode,temperature,bedTemperature,preheatTemperature,preheatBedTemperature);
|
||||||
|
Loading…
Reference in New Issue
Block a user