0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-25 18:47:57 +01:00

Settings improvements

This commit is contained in:
peteruithoven 2013-08-28 18:33:25 +02:00
parent c15c023829
commit 2deec18072
5 changed files with 140 additions and 134 deletions

View File

@ -16,8 +16,10 @@ body,th,td {
} }
fieldset { fieldset {
width: 600px; width: 600px;
border: 1px solid black; border: 1px solid rgb(187, 187, 187);
border-radius: 10px; -webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
margin-bottom: 20px; margin-bottom: 20px;
/*padding-left: 20px;*/ /*padding-left: 20px;*/
} }
@ -29,16 +31,22 @@ label {
display: inline-block; display: inline-block;
} }
textarea { textarea {
border-radius: 10px; border: 1px solid rgb(144, 192, 255);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
} }
input[type="text"] { input[type="text"], input[type="number"] {
border: 1px solid black; border: 1px solid rgb(144, 192, 255);
margin-right: 5px; margin-right: 5px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
} }
input[type="text"].small { input[type="text"].small, input[type="number"].small {
width: 50px; width: 50px;
} }
input[type="text"].large { input[type="text"].large,input[type="number"].large {
width: 250px; width: 250px;
} }
legend { legend {
@ -58,3 +66,7 @@ textarea.gcode {
display: none; display: none;
margin-top: 5px; margin-top: 5px;
} }
form small {
margin: 3px 0 0 0;
display: block;
}

View File

@ -47,7 +47,11 @@ div.content > div {
} }
div.content > div.settings { div.content > div.settings {
border: 1px solid #333; border: 1px solid rgb(187, 187, 187);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
width: 660px; width: 660px;
overflow: scroll; overflow: scroll;
max-height: 368px; max-height: 368px;

View File

@ -57,6 +57,7 @@ function SettingsWindow() {
self.saveSettings(); self.saveSettings();
self.hideSettings(); self.hideSettings();
} }
this.showSettings = function() { this.showSettings = function() {
console.log("f:showSettings()"); console.log("f:showSettings()");
@ -71,6 +72,7 @@ function SettingsWindow() {
document.body.addEventListener('touchmove',prevent,false); document.body.addEventListener('touchmove',prevent,false);
}); });
} }
this.loadSettings = function() { this.loadSettings = function() {
if (!communicateWithWifibox) { if (!communicateWithWifibox) {
console.log(" communicateWithWifibox is false: settings aren't being loaded from wifibox...") console.log(" communicateWithWifibox is false: settings aren't being loaded from wifibox...")
@ -96,6 +98,7 @@ function SettingsWindow() {
self.retryLoadSettingsDelay = setTimeout(function() { self.loadSettings() },self.retryDelay); // retry after delay self.retryLoadSettingsDelay = setTimeout(function() { self.loadSettings() },self.retryDelay); // retry after delay
}); });
} }
this.saveSettings = function(callback) { this.saveSettings = function(callback) {
console.log("Settings:saveSettings"); console.log("Settings:saveSettings");
@ -103,12 +106,13 @@ function SettingsWindow() {
$("#printersettings input").each( function(index,element) { $("#printersettings input").each( function(index,element) {
var element = $(element); var element = $(element);
//populate settings are with values from html //populate settings are with values from html
if(element.attr("type") == "text") { if(element.attr("type") == "text" || element.attr("type") == "number") {
settings[element.attr('name')] = element.val(); settings[element.attr('name')] = element.val();
} else if(element.attr("type") == "checkbox") { } else if(element.attr("type") == "checkbox") {
settings[element.attr('name')] = element.prop('checked') settings[element.attr('name')] = element.prop('checked')
} }
}); });
this.readForm();
if (communicateWithWifibox) { if (communicateWithWifibox) {
$.ajax({ $.ajax({
@ -142,22 +146,58 @@ function SettingsWindow() {
}); });
} }
} }
this.fillForm = function() {
//update html with loaded wifi settings
$("#ipaddress").attr('value', settings["network.ap.address"]);
$("#netmask").attr('value', settings["network.ap.netmask"]);
$("#ssid").attr('value', settings["network.ap.ssid"]);
//update html with loaded printer settings this.fillForm = function() {
$("#printersettings input").each( function(index,element) { console.log("SettingsWindow:fillForm");
//fill form with loaded settings
var selects = this.form.find("select");
selects.each( function(index,element) {
var element = $(element);
element.val(settings[element.attr('name')]);
});
var inputs = this.form.find("input");
inputs.each( function(index,element) {
var element = $(element); var element = $(element);
//console.log("printer setting input: ",index,element.attr("type"),element.attr('name')); //,element); //console.log("printer setting input: ",index,element.attr("type"),element.attr('name')); //,element);
if(element.attr("type") == "text") { switch(element.attr("type")) {
case "text":
case "number":
element.val(settings[element.attr('name')]); element.val(settings[element.attr('name')]);
} else if(element.attr("type") == "checkbox") { break;
case "checkbox":
element.prop('checked', settings[element.attr('name')]); element.prop('checked', settings[element.attr('name')]);
break;
} }
}); });
// TODO: textarea's
var textareas = this.form.find("textarea");
console.log(textareas);
textareas.each( function(index,element) {
var element = $(element);
console.log("printer setting textarea: ",index,element.attr('name')); //,element);
var value = settings[element.attr('name')];
element.val(value);
console.log(" value: ",value);
});
}
this.readForm = function() {
console.log("SettingsWindow:readForm");
// read settings from form
// TODO: textarea's
var textareas = this.form.find("textarea");
console.log(textareas);
textareas.each( function(index,element) {
var element = $(element);
console.log("printer textarea: ",index,element.attr('name')); //,element);
console.log(" val: ",element.val());
settings[element.attr('name')] = element.val();
});
console.log(settings);
} }
} }

View File

@ -301,7 +301,7 @@ function onCanvasMouseMove(e) {
if (prevPoint.x != -1 || prevPoint.y != -1) { if (prevPoint.x != -1 || prevPoint.y != -1) {
var dist = Math.sqrt(Math.pow((prevPoint.x - x), 2) + Math.pow((prevPoint.y - y), 2)); var dist = Math.sqrt(Math.pow((prevPoint.x - x), 2) + Math.pow((prevPoint.y - y), 2));
if (dist > 5) { if (dist > 5) { // replace by setting: doodle3d.simplify.minDistance
_points.push([x, y, false]); _points.push([x, y, false]);
adjustBounds(x, y) adjustBounds(x, y)
adjustPreviewTransformation(); adjustPreviewTransformation();

View File

@ -10,156 +10,106 @@
</head> </head>
<body> <body>
<div> <div>
<h3 style="font-weight:bold">
Not all fields are saveable at the moment
</h3>
<form id="settingsForm"> <form id="settingsForm">
<fieldset> <fieldset>
<legend>3D printer</legend> <legend>3D printer</legend>
<label for="deviceType">Type:</label> <label for="printerType">Type:</label>
<select id="deviceType"> <select id="printerType" name="printer.type">
<option value="rigidbot">Rigidbot</option>
<option value="ultimaker">Ultimaker</option> <option value="ultimaker">Ultimaker</option>
<option value="ultimaker">Makerbot CupCake</option> <option value="makerbot_replicator2">MakerBot Replicator2</option>
<option value="reprap">Prusa Mendel</option> <option value="makerbot_thingomatic">MakerBot Thing-o-matic</option>
<option value="printrbot">Printrbot</option>
<option value="bukobot">Bukobot</option>
<option value="cartesio">Cartesio</option>
<option value="cyrus">Cyrus</option>
<option value="delta_rostockmax">Delta RostockMax</option>
<option value="deltamaker">Deltamaker</option>
<option value="eventorbot">EventorBot</option>
<option value="felix">Felix</option>
<option value="gigabot">Gigabot</option>
<option value="kossel">Kossel</option>
<option value="leapfrog_creatr">LeapFrog Creatr</option>
<option value="lulzbot_aO_101">LulzBot AO-101</option>
<option value="makergear_m2">MakerGear M2</option>
<option value="makergear_prusa">MakerGear Prusa</option>
<option value="makibox">Makibox</option>
<option value="orca_0_3">Orca 0.3</option>
<option value="ord_bot_hadron">ORD Bot Hadron</option>
<option value="printxel_3d">Printxel 3D</option>
<option value="prusa_i3">Prusa I3</option>
<option value="prusa_iteration_2">Prusa Iteration 2</option>
<option value="rapman">RapMan</option>
<option value="reprappro_huxley">RepRapPro Huxley</option>
<option value="reprappro_mendel">RepRapPro Mendel</option>
<option value="robo_3d_printer">RoBo 3D Printer</option>
<option value="shapercube">ShaperCube</option>
<option value="tantillus">Tantillus</option>
<option value="vision_3d_printer">Vision 3D Printer</option>
</select> </select>
<br> <br>
<label for="deviceSpeed">Speed:</label> <label for="printerBaudrate">Baud rate:</label>
<select id="deviceSpeed"> <select id="printerBaudrate" name="printer.baudrate">
<option value="115200">115200 bps</option> <option value="115200">115200 bps</option>
<option value="2500000">2500000 bps</option> <option value="2500000">2500000 bps</option>
</select> </select>
<br>
<label for="devicePort">Port:</label>
<select id="devicePort">
<option value="/dev/tty.usbmodem411">/dev/tty.usbmodem411</option>
<option value="/dev/tty.usbmodem602">/dev/tty.usbmodem621</option>
</select>
<button>Check connection...</button>
</fieldset> </fieldset>
<fieldset id="printersettings"> <fieldset id="printersettings">
<legend>Print settings</legend> <legend>Print settings</legend>
<label for="layerHeight">Layer height:</label><input id="layerHeight" type="text" class="small" name="printer.layerHeight">mm<br> <label for="layerHeight">Layer height:</label><input id="layerHeight" type="number" step="0.01" class="small" name="printer.layerHeight">mm<br>
<label for="wallThickness">Wall thickness:</label><input id="wallThickness" type="text" class="small" name="printer.wallThickness">mm<br> <label for="wallThickness">Wall thickness:</label><input id="wallThickness" type="number" step="0.1" class="small" name="printer.wallThickness">mm<br>
<label for="filamentThickness">Filament thickness:</label><input id="filamentThickness" type="text" class="small" name="printer.filamentThickness">mm<br> <label for="filamentThickness">Filament thickness:</label><input id="filamentThickness" step="0.01" type="number" class="small" name="printer.filamentThickness">mm<br>
<label for="temperature">Temperature:</label><input id="temperature" type="text" class="small" name="printer.temperature">degrees C<br> <label for="temperature">Temperature:</label><input id="temperature" type="number" class="small" name="printer.temperature">degrees C<br>
<br> <br>
<label for="speed">Speed:</label><input id="speed" type="text" name="printer.speed" class="small">mm/s<br> <label for="speed">Speed:</label><input id="speed" type="number" name="printer.speed" class="small">mm/s<br>
<label for="travelSpeed">Travel speed:</label><input id="travelSpeed" type="text" name="printer.travelSpeed" class="small">mm/s<br> <label for="travelSpeed">Travel speed:</label><input id="travelSpeed" type="number" name="printer.travelSpeed" class="small">mm/s<br>
<br>
<label for="firstLayerSlow">First layer slow:</label><input id="firstLayerSlow" type="checkbox" name="printer.firstLayerSlow" value="firstLayerSlow"><br>
<label for="useSubLayers">Use sub-layers*:</label><input id="useSubLayers" type="checkbox" name="printer.useSubLayers" value="firstLayerSlow"><br>
<small>* Continuously move platform while printing instead of once per layer</small>
<br>
<label for="useRetraction">Use retraction:</label><input id="useRetraction" type="checkbox" name="printer.retraction.enabled" value="useRetraction"><br>
<label for="retractionAmount">Retraction amount:</label><input id="retractionAmount" type="number" class="small" name="printer.retraction.amount">mm<br>
<label for="retractionMinDistance">Retraction min distance:</label><input id="retractionMinDistance" type="number" class="small" name="printer.retraction.minDistance">mm<br>
<label for="retractionSpeed">Retraction speed:</label><input id="retractionSpeed" type="number" class="small" name="printer.retraction.speed">mm/s<br>
<br> <br>
<label for="autoWarmUp">Auto warm-up:</label><input id="autoWarmUp" type="checkbox" name="printer.autoWarmUp" value="autoWarmUp"><br> <label for="autoWarmUp">Auto warm-up:</label><input id="autoWarmUp" type="checkbox" name="printer.autoWarmUp" value="autoWarmUp"><br>
<label for="firstLayerSlow">First layer slow:</label><input id="firstLayerSlow" type="checkbox" name="printer.firstLayerSlow" value="firstLayerSlow"><br>
<label for="useSubLayers">Use sub-layers:</label><input id="useSubLayers" type="checkbox" name="printer.useSubLayers" value="firstLayerSlow"><br>
<label for="useRetraction">Use retraction:</label><input id="useRetraction" type="checkbox" name="printer.retraction.enabled" value="useRetraction"><br>
<br>
<label for="retractionAmount">Retraction amount:</label><input id="retractionAmount" type="text" class="small" name="printer.retraction.amount">mm<br>
<label for="retractionMinDistance">Retraction min distance:</label><input id="retractionMinDistance" type="text" class="small" name="printer.retraction.minDistance">mm<br>
<label for="retractionSpeed">Retraction speed:</label><input id="retractionSpeed" type="text" class="small" name="printer.retraction.speed">mm/s<br>
<br>
<label for="autoWarmUpCommand">Auto Warm up command:</label><input id="autoWarmUpCommand" type="text" name="printer.autoWarmUpCommand"><br> <label for="autoWarmUpCommand">Auto Warm up command:</label><input id="autoWarmUpCommand" type="text" name="printer.autoWarmUpCommand"><br>
</fieldset> </fieldset>
<fieldset id="doodlesettings">
<legend>Doodle3D settings</legend>
<label for="objectHeight">Max object height:</label><input id="objectHeight" type="number" class="small" name="doodle3d.objectHeight">mm<br>
<label for="simplifyMinDistance">Minimal line distance:</label><input id="simplifyMinDistance" type="number" class="small" name="doodle3d.simplify.minDistance">px<br>
</fieldset>
<fieldset> <fieldset>
<legend>Access point settings</legend> <legend>Access point settings</legend>
<label for="ipaddress">Wi-Fi box IP address:</label><input type="text" name="ipaddress" id="ipaddress" value="0.3"><br> <label for="ipaddress">Wi-Fi box IP address:</label><input type="text" name="network.ap.address" id="ipaddress"><br>
<label for="netmask">Wi-Fi box netmask:</label><input type="text" name="netmask" id="netmask" value="0.8"><br> <label for="netmask">Wi-Fi box netmask:</label><input type="text" name="network.ap.netmask" id="netmask"><br>
<label for="ssid">Wi-Fi box ssid*:</label><input type="text" class="large" name="ssid" id="ssid" value="d3d-ap-%%MAC_ADDR_TAIL%%"> <br> <label for="ssid">Wi-Fi box ssid*:</label><input type="text" class="large" name="network.ap.ssid" id="ssid"> <br>
<br> <small>* The text <em>%%MAC_ADDR_TAIL%%</em> will be replaced by the last 6 digits of your Doodle3D Wi-Fi box's MAC address.</small>
* The macro <em>%%MAC_ADDR_TAIL%%</em> will be replaced by the last 6 digits of your Doodle3D Wi-Fi box's MAC address.<br>
</fieldset> </fieldset>
<!--<fieldset>-->
<!--<legend>Doodle3D shape settings</legend>-->
<!--<label for="minScale">Minimum scale:</label><input type="text" class="small" name="minScale" id="minScale" value="0.3"><br>-->
<!--<label for="maxScale">Maximum scale:</label><input type="text" class="small" name="maxScale" id="maxScale" value="0.8"><br>-->
<!--<label for="twists">Twists:</label><input type="text" class="small" name="twists" id="twists" value="1.5"><br>-->
<!--<label for="shape">Vertical shape:</label>-->
<!--<select id="shape">-->
<!--<option value="/">/</option>-->
<!--<option value="|">|</option>-->
<!--<option value="/">\</option>-->
<!--<option value="#">#</option>-->
<!--<option value="$">$</option>-->
<!--<option value="%">%</option>-->
<!--<option value="^">^</option>-->
<!--<option value="*">*</option>-->
<!--</select>-->
<!--<br>-->
<!--<label for="simplifyShape">Simplify shape:</label>-->
<!--<select id="simplifyShape">-->
<!--<option value="strong">strong</option>-->
<!--<option value="normal" selected>normal</option>-->
<!--<option value="less">less</option>-->
<!--<option value="none">no</option>-->
<!--</fieldset>-->
<!--<fieldset>-->
<!--<legend>Webserver</legend>-->
<!--<label for="serverPort">Port:</label><input type="text" class="small" name="serverPort" id="serverPort" value="8888"><br>-->
<!--<label for="serverIP">IP-address:</label><input readonly type="text" name="serverPort" id="serverIP" value="192.168.2.1"><br>-->
<!--</fieldset>-->
<!--<fieldset>-->
<!--<legend>Application settings</legend>-->
<!--<label for="fullscreen">Start fullscreen:</label><input type="checkbox" name="fullscreen" id="fullscreen" value="fullscreen" checked><br>-->
<!--<label for="centerWindow">Center window:</label><input type="checkbox" name="centerWindow" id="centerWindow" value="centerWindow" checked><br>-->
<!--<label for="windowWidth">Window width:</label><input type="text" class="small" name="layerHeight" id="windowWidth" value="1120">px<br>-->
<!--<label for="windowHeight">Window height:</label><input type="text" class="small" name="layerHeight" id="windowHeight" value="700">px<br>-->
<!--</fieldset>-->
<fieldset> <fieldset>
<legend>GCODE settings</legend><br> <legend>GCODE settings</legend>
<table> <table>
<tr> <tr>
<td> <td>
<label for="startgcode">Start:</label><br> <label for="startgcode">Start:</label><br>
<textarea id="startgcode" class="gcode"> <textarea id="startgcode" class="gcode" name="printer.startgcode">
G21 (mm)
G91 (relative)
G28 X0 Y0 Z0 (physical home)
M104 S230 (temperature)
G1 E10 F250 (flow)
G92 X-100 Y-100 Z0 E10
G1 Z3 F5000 (prevent diagonal line)
G90 (absolute)
M106 (fan on)
</textarea> </textarea>
</td> </td>
<td> <td>
<label for="endgcode">End:</label><br> <label for="endgcode">End:</label><br>
<textarea id="endgcode" class="gcode"> <textarea id="endgcode" class="gcode" name="printer.endgcode">
G1 X-100 Y-100 F15000 (fast homing)
M107
M84 (disable axes)
</textarea> </textarea>
</td> </td>
</tr> </tr>
</table> </table>
<br>
</fieldset> </fieldset>
<fieldset>
<legend>Advanced settings</legend>
<textarea id="advancedSettings">
zOffset=0
loadOffset=0,0
showWarmUp=true
loopAlways=false
maxObjectHeight=200
maxScaleDifference=.1
quitOnEscape=true
screenToMillimeterScale=.3
targetTemperature=230
</textarea>
</fieldset>
<!--<br>-->
<!--<input type="submit" value="Save settings">-->
</form> </form>
</div> </div>
</body> </body>