mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 09:17:56 +01:00
Add temperature setting to config interface; move temperature setting from start code and use configuration.
This commit is contained in:
parent
d78317ecd6
commit
d13051e40f
@ -7,6 +7,10 @@ function startPrint(gcode) {
|
|||||||
console.log("total # of lines: " + gcode.length);
|
console.log("total # of lines: " + gcode.length);
|
||||||
data = gcode;
|
data = gcode;
|
||||||
|
|
||||||
|
for (i = 0; i < data.length; i++) {
|
||||||
|
data[i] += " (" + i + ")";
|
||||||
|
}
|
||||||
|
|
||||||
sendIndex = 0;
|
sendIndex = 0;
|
||||||
sendLength = 2000; // 2000 regels
|
sendLength = 2000; // 2000 regels
|
||||||
sendGCodeSlice(sendIndex, sendLength);
|
sendGCodeSlice(sendIndex, sendLength);
|
||||||
|
@ -2,7 +2,6 @@ var gcodeStart = [];
|
|||||||
gcodeStart.push("G21 (mm)");
|
gcodeStart.push("G21 (mm)");
|
||||||
gcodeStart.push("G91 (relative)");
|
gcodeStart.push("G91 (relative)");
|
||||||
gcodeStart.push("G28 X0 Y0 Z0 (physical home)");
|
gcodeStart.push("G28 X0 Y0 Z0 (physical home)");
|
||||||
gcodeStart.push("M104 S230 (temperature)");
|
|
||||||
gcodeStart.push("G1 E10 F250 (flow)");
|
gcodeStart.push("G1 E10 F250 (flow)");
|
||||||
gcodeStart.push("G92 X-100 Y-100 Z0 E10");
|
gcodeStart.push("G92 X-100 Y-100 Z0 E10");
|
||||||
gcodeStart.push("G1 Z3 F5000 (prevent diagonal line)");
|
gcodeStart.push("G1 Z3 F5000 (prevent diagonal line)");
|
||||||
@ -37,7 +36,12 @@ function generate_gcode(callback) {
|
|||||||
// add gcode begin commands
|
// add gcode begin commands
|
||||||
gcode = gcode.concat(gcodeStart);
|
gcode = gcode.concat(gcodeStart);
|
||||||
|
|
||||||
var layers = maxObjectHeight / layerHeight; //maxObjectHeight instead of objectHeight
|
console.log("printer temperature: ",settings["printer.temperature"]);
|
||||||
|
|
||||||
|
gcode.push("M104 S" + settings["printer.temperature"] + " (temperature)");
|
||||||
|
gcode.push("M109 S" + settings["printer.temperature"] + " (wait for heating)");
|
||||||
|
|
||||||
|
var layers = maxObjectHeight / settings["printer.layerHeight"]; //maxObjectHeight instead of objectHeight
|
||||||
var extruder = 0.0;
|
var extruder = 0.0;
|
||||||
var prev = new Point(); prev.set(0, 0);
|
var prev = new Point(); prev.set(0, 0);
|
||||||
|
|
||||||
@ -114,7 +118,7 @@ function generate_gcode(callback) {
|
|||||||
// ofPoint to = commands[(even || isLoop || loopAlways) ? i : last-i].to;
|
// ofPoint to = commands[(even || isLoop || loopAlways) ? i : last-i].to;
|
||||||
var to = new Point(); to.set(commands[i][0], commands[i][1]);
|
var to = new Point(); to.set(commands[i][0], commands[i][1]);
|
||||||
var sublayer = (layer == 0) ? 0.0 : layer + (useSubLayers ? (curLayerCommand/totalLayerCommands) : 0);
|
var sublayer = (layer == 0) ? 0.0 : layer + (useSubLayers ? (curLayerCommand/totalLayerCommands) : 0);
|
||||||
var z = (sublayer + 1) * layerHeight + zOffset;
|
var z = (sublayer + 1) * settings["printer.layerHeight"] + zOffset;
|
||||||
|
|
||||||
var isTraveling = !isLoop && i==0;
|
var isTraveling = !isLoop && i==0;
|
||||||
var doRetract = prev.distance(to) > retractionminDistance;
|
var doRetract = prev.distance(to) > retractionminDistance;
|
||||||
@ -126,7 +130,7 @@ function generate_gcode(callback) {
|
|||||||
if (doRetract) gcode.push("G1 E" + extruder.toFixed(3) + " F" + (retractionspeed * 60).toFixed(3));
|
if (doRetract) gcode.push("G1 E" + extruder.toFixed(3) + " F" + (retractionspeed * 60).toFixed(3));
|
||||||
} else {
|
} else {
|
||||||
// console.log(" else");
|
// console.log(" else");
|
||||||
extruder += prev.distance(to) * wallThickness * layerHeight / filamentThickness;
|
extruder += prev.distance(to) * settings["printer.wallThickness"] * settings["printer.layerHeight"] / filamentThickness;
|
||||||
gcode.push("G1 X" + to.x.toFixed(3) + " Y" + to.y.toFixed(3) + " Z" + z.toFixed(3) + " F" + (speed * 60).toFixed(3) + " E" + extruder.toFixed(3));
|
gcode.push("G1 X" + to.x.toFixed(3) + " Y" + to.y.toFixed(3) + " Z" + z.toFixed(3) + " F" + (speed * 60).toFixed(3) + " E" + extruder.toFixed(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
124
js/settings.js
124
js/settings.js
@ -1,21 +1,28 @@
|
|||||||
var wifiboxURL;//"http://192.168.5.1/cgi-bin/d3dapi";
|
var wifiboxURL;//"http://192.168.5.1/cgi-bin/d3dapi";
|
||||||
|
|
||||||
|
//these settings are defined in the firmware (conf_defaults.lua) and will be initialized in loadSettings()
|
||||||
var settings = {
|
var settings = {
|
||||||
layerHeight: 0.2,
|
// "network.ap.ssid": "d3d-ap-%%MAC_ADDR_TAIL%%",
|
||||||
wallThickness: 0.6,
|
// "network.ap.address": "192.168.10.1",
|
||||||
filamentThickness: 2.89,
|
// "network.ap.netmask": "255.255.255.0",
|
||||||
speed: 50,
|
// "printer.temperature": 215,
|
||||||
travelSpeed: 200,
|
// "printer.objectHeight": '???',
|
||||||
autoWarmup: true,
|
// "printer.layerHeight": 0.2,
|
||||||
firstLayerSlow: true,
|
// "printer.wallThickness": 0.6,
|
||||||
useSubLayers: true,
|
// "printer.speed": 50,
|
||||||
useRetraction: true,
|
// "printer.travelSpeed": 200,
|
||||||
retractionAmount: 2,
|
// "printer.filamentThickness": 2.89,
|
||||||
retractionMinDistance: 1,
|
// "printer.useSubLayers": true,
|
||||||
retractionSpeed: 250,
|
// "printer.firstLayerSlow": true,
|
||||||
networkIP: "192.168.10.1",
|
// "printer.autoWarmUp": true,
|
||||||
networkNetmask: "255.255.255.0",
|
// "printer.simplify.iterations": 10,
|
||||||
networkSsid: "d3d-ap-%%MAC_ADDR_TAIL%%"
|
// "printer.simplify.minNumPoints": 15,
|
||||||
|
// "printer.simplify.minDistance": 3,
|
||||||
|
// "printer.retraction.enabled": true,
|
||||||
|
// "printer.retraction.speed": 250,
|
||||||
|
// "printer.retraction.minDistance": 1,
|
||||||
|
// "printer.retraction.amount": 2,
|
||||||
|
// "printer.autoWarmUpCommand": "M104 S230 (hardcoded temperature)"
|
||||||
}
|
}
|
||||||
|
|
||||||
var settingsForm = $("#settingsForm");
|
var settingsForm = $("#settingsForm");
|
||||||
@ -29,6 +36,8 @@ function initSettingsPopup(apiURL) {
|
|||||||
console.log("f:initSettingsPopup()");
|
console.log("f:initSettingsPopup()");
|
||||||
wifiboxURL = apiURL;
|
wifiboxURL = apiURL;
|
||||||
|
|
||||||
|
loadSettings();
|
||||||
|
|
||||||
$("#contentOverlay").hide();
|
$("#contentOverlay").hide();
|
||||||
|
|
||||||
$("div.content .btnOK").click(function(e) {
|
$("div.content .btnOK").click(function(e) {
|
||||||
@ -57,60 +66,58 @@ function showSettings() {
|
|||||||
function loadSettings() {
|
function loadSettings() {
|
||||||
console.log("f:loadSettings() >> getting new data...");
|
console.log("f:loadSettings() >> getting new data...");
|
||||||
$.get(wifiboxURL + "/config/all", {}, function(data) {
|
$.get(wifiboxURL + "/config/all", {}, function(data) {
|
||||||
// console.log("f:loadSettings()");
|
settings = JSON.parse(data).data;
|
||||||
var settings = JSON.parse(data).data;
|
|
||||||
// var printer_layerHeight = settings["printer.layerHeight"];
|
|
||||||
// var printer_autoWarmup = settings["printer.autoWarmUp"];
|
|
||||||
console.log("print_layerHeight = " + settings["printer.layerHeight"]);
|
|
||||||
console.log("printer_autoWarmup = " + settings["printer.autoWarmUp"] + ", type: " + (typeof settings["printer.autoWarmUp"]));
|
|
||||||
console.log("printer_useSubLayers = " + settings["printer.useSubLayers"] + " type: " + (typeof settings["printer.useSubLayers"]));
|
|
||||||
$("#formpje input[name='printer.layerHeight']").attr('value', settings["printer.layerHeight"]);
|
|
||||||
|
|
||||||
// printer settings
|
// // var printer_layerHeight = settings["printer.layerHeight"];
|
||||||
$('#autoWarmUp').prop('checked', settings["printer.autoWarmUp"]);
|
// // var printer_autoWarmup = settings["printer.autoWarmUp"];
|
||||||
$('#firstLayerSlow').prop('checked', settings["printer.firstLayerSlow"]);
|
// console.log("print_layerHeight = " + settings["printer.layerHeight"]);
|
||||||
$('#useSubLayers').prop('checked', settings["printer.useSubLayers"]);
|
// console.log("printer_autoWarmup = " + settings["printer.autoWarmUp"] + ", type: " + (typeof settings["printer.autoWarmUp"]));
|
||||||
$("#layerHeight").attr('value', settings["printer.layerHeight"]);
|
// console.log("printer_useSubLayers = " + settings["printer.useSubLayers"] + " type: " + (typeof settings["printer.useSubLayers"]));
|
||||||
$("#wallThickness").attr('value', settings["printer.wallThickness"]);
|
// $("#formpje input[name='printer.layerHeight']").attr('value', settings["printer.layerHeight"]);
|
||||||
$("#filamentThickness").attr('value', settings["printer.filamentThickness"]);
|
|
||||||
$("#speed").attr('value', settings["printer.speed"]);
|
|
||||||
$("#travelSpeed").attr('value', settings["printer.travelSpeed"]);
|
|
||||||
$("#retractionAmount").attr('value', settings["printer.retraction.amount"]);
|
|
||||||
$("#retractionMinDistance").attr('value', settings["printer.retraction.minDistance"]);
|
|
||||||
$("#retractionSpeed").attr('value', settings["printer.retraction.speed"]);
|
|
||||||
|
|
||||||
// wifi settings
|
|
||||||
|
//update html with loaded wifi settings
|
||||||
$("#ipaddress").attr('value', settings["network.ap.address"]);
|
$("#ipaddress").attr('value', settings["network.ap.address"]);
|
||||||
$("#netmask").attr('value', settings["network.ap.netmask"]);
|
$("#netmask").attr('value', settings["network.ap.netmask"]);
|
||||||
$("#ssid").attr('value', settings["network.ap.ssid"]);
|
$("#ssid").attr('value', settings["network.ap.ssid"]);
|
||||||
// network.ap.address: "192.168.10.1"
|
|
||||||
// network.ap.netmask: "255.255.255.0"
|
|
||||||
// network.ap.ssid: "d3d-ap-%%MAC_ADDR_TAIL%%"
|
|
||||||
|
|
||||||
|
//update html with loaded printer settings
|
||||||
|
$("#printersettings input").each( function(index,element) {
|
||||||
|
var element = $(element);
|
||||||
|
//console.log("printer setting input",index,element,element.attr('name'));
|
||||||
|
if(element.attr("type") == "text") {
|
||||||
|
element.val(settings[element.attr('name')]);
|
||||||
|
} else if(element.attr("type") == "checkbox") {
|
||||||
|
//console.log("settings setting: ",settings[element.attr('name')],typeof settings[element.attr('name')]);
|
||||||
|
element.attr('checked', settings[element.attr('name')]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(" val: ",$(element).val(),element);
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveSettings(callback) {
|
function saveSettings(callback) {
|
||||||
console.log("settings form submitted");
|
// console.log("settings form submitted");
|
||||||
console.log(" printer.layerHeight:" + $("#formpje input[name='printer.layerHeight']").attr('value'));
|
// console.log(" printer.layerHeight:" + $("#formpje input[name='printer.layerHeight']").attr('value'));
|
||||||
console.log(" first layer slow (checkbox):" + $('#firstLayerSlow').prop('checked'));
|
// console.log(" first layer slow (checkbox):" + $('#firstLayerSlow').prop('checked'));
|
||||||
console.log(" use sublayers (checkbox):" + $('#useSubLayers').prop('checked'));
|
// console.log(" use sublayers (checkbox):" + $('#useSubLayers').prop('checked'));
|
||||||
|
|
||||||
|
//var printerSettings = {};
|
||||||
|
$("#printersettings input").each( function(index,element) {
|
||||||
|
var element = $(element);
|
||||||
|
//populate settings are with values from html
|
||||||
|
if(element.attr("type") == "text") {
|
||||||
|
settings[element.attr('name')] = element.val();
|
||||||
|
} else if(element.attr("type") == "checkbox") {
|
||||||
|
settings[element.attr('name')] = element.attr('checked')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$.post(
|
$.post(
|
||||||
wifiboxURL + "/config",
|
wifiboxURL + "/config",
|
||||||
{
|
settings,
|
||||||
"printer.autoWarmUp" : ($('#autoWarmUp').prop('checked') == true) ? 1 : 0,
|
|
||||||
"printer.firstLayerSlow": ($('#firstLayerSlow').prop('checked') == true) ? 1 : 0,
|
|
||||||
"printer.useSubLayers": ($('#useSubLayers').prop('checked') == true) ? true : false,
|
|
||||||
// "printer.useSubLayers": $('#useSubLayers').prop('checked'),
|
|
||||||
"printer.layerHeight": $("#layerHeight").attr('value'),
|
|
||||||
"printer.wallThickness": $("#wallThickness").attr('value'),
|
|
||||||
"printer.filamentThickness": $("#filamentThickness").attr('value'),
|
|
||||||
"printer.speed": $("#speed").attr('value'),
|
|
||||||
"printer.travelSpeed": $("#travelSpeed").attr('value'),
|
|
||||||
"printer.retraction.amount": $("#retractionAmount").attr('value'),
|
|
||||||
"printer.retraction.minDistance": $("#retractionMinDistance").attr('value'),
|
|
||||||
"printer.retraction.speed": $("#retractionSpeed").attr('value')
|
|
||||||
},
|
|
||||||
function(data) {
|
function(data) {
|
||||||
var res = JSON.parse(data).data;
|
var res = JSON.parse(data).data;
|
||||||
$.each(res, function(index, val) {
|
$.each(res, function(index, val) {
|
||||||
@ -121,8 +128,6 @@ function saveSettings(callback) {
|
|||||||
if (callback != undefined) {
|
if (callback != undefined) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
// console.log(JSON.stringify(data));
|
|
||||||
// console.log(JSON.parse(data).data);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -135,6 +140,7 @@ function saveSettings(callback) {
|
|||||||
* FROM DOODLE3D.INI
|
* FROM DOODLE3D.INI
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
//TODO: find all references to these variables, replace them and finally remove these.
|
||||||
var objectHeight = 20;
|
var objectHeight = 20;
|
||||||
var layerHeight = .2;
|
var layerHeight = .2;
|
||||||
var wallThickness = .5;
|
var wallThickness = .5;
|
||||||
|
@ -47,23 +47,24 @@
|
|||||||
<button>Check connection...</button>
|
<button>Check connection...</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset id="printersettings">
|
||||||
<legend>Print settings</legend>
|
<legend>Print settings</legend>
|
||||||
<label for="layerHeight">Layer height:</label><input type="text" class="small" name="layerHeight" id="layerHeight" value="0.12">mm<br>
|
<label for="layerHeight">Layer height:</label><input type="text" class="small" name="printer.layerHeight">mm<br>
|
||||||
<label for="wallThickness">Wall thickness:</label><input type="text" class="small" name="wallThickness" id="wallThickness" value="0.6">mm<br>
|
<label for="wallThickness">Wall thickness:</label><input type="text" class="small" name="printer.wallThickness">mm<br>
|
||||||
<label for="filamentThickness">Filament thickness:</label><input type="text" class="small" name="filamentThickness" id="filamentThickness" value="2.89">mm<br>
|
<label for="filamentThickness">Filament thickness:</label><input type="text" class="small" name="printer.filamentThickness">mm<br>
|
||||||
|
<label for="temperature">Temperature:</label><input type="text" class="small" name="printer.temperature">degrees C<br>
|
||||||
<br>
|
<br>
|
||||||
<label for="speed">Speed:</label><input type="text" name="speed" id="speed" class="small" value="50">mm/s<br>
|
<label for="speed">Speed:</label><input type="text" name="printer.speed" class="small">mm/s<br>
|
||||||
<label for="travelSpeed">Travel speed:</label><input type="text" name="travelSpeed" id="travelSpeed" class="small" value="200">mm/s<br>
|
<label for="travelSpeed">Travel speed:</label><input type="text" name="printer.travelSpeed" class="small">mm/s<br>
|
||||||
<br>
|
<br>
|
||||||
<label for="autoWarmUp">Auto warm-up:</label><input type="checkbox" name="autoWarmUp" id="autoWarmUp" value="autoWarmUp" checked><br>
|
<label for="autoWarmUp">Auto warm-up:</label><input type="checkbox" name="printer.autoWarmUp" value="autoWarmUp"><br>
|
||||||
<label for="firstLayerSlow">First layer slow:</label><input type="checkbox" name="firstLayerSlow" id="firstLayerSlow" value="firstLayerSlow" checked><br>
|
<label for="firstLayerSlow">First layer slow:</label><input type="checkbox" name="printer.firstLayerSlow" value="firstLayerSlow"><br>
|
||||||
<label for="useSubLayers">Use sub-layers:</label><input type="checkbox" name="useSubLayers" id="useSubLayers" value="firstLayerSlow" checked><br>
|
<label for="useSubLayers">Use sub-layers:</label><input type="checkbox" name="printer.useSubLayers" value="firstLayerSlow"><br>
|
||||||
<label for="useRetraction">Use retraction:</label><input type="checkbox" name="useRetraction" id="useRetraction" value="useRetraction" checked><br>
|
<label for="useRetraction">Use retraction:</label><input type="checkbox" name="printer.retraction.enabled" value="useRetraction"><br>
|
||||||
<br>
|
<br>
|
||||||
<label for="retractionAmount">Retraction amount:</label><input type="text" class="small" name="retractionAmount" id="retractionAmount" value="2">mm<br>
|
<label for="retractionAmount">Retraction amount:</label><input type="text" class="small" name="printer.retraction.amount">mm<br>
|
||||||
<label for="retractionMinDistance">Retraction min distance:</label><input type="text" class="small" name="retractionMinDistance" id="retractionMinDistance" value="1">mm<br>
|
<label for="retractionMinDistance">Retraction min distance:</label><input type="text" class="small" name="printer.retraction.minDistance">mm<br>
|
||||||
<label for="retractionSpeed">Retraction speed:</label><input type="text" class="small" name="retractionSpeed" id="retractionSpeed" value="250">mm/s<br>
|
<label for="retractionSpeed">Retraction speed:</label><input type="text" class="small" name="printer.retraction.speed">mm/s<br>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@ -243,5 +244,6 @@ printer.temperature: 230
|
|||||||
X printer.travelSpeed: 200
|
X printer.travelSpeed: 200
|
||||||
X printer.useSubLayers: true
|
X printer.useSubLayers: true
|
||||||
X printer.wallThickness: 0.5
|
X printer.wallThickness: 0.5
|
||||||
|
X printer.temperature: 230
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
Loading…
Reference in New Issue
Block a user