mirror of
https://github.com/Doodle3D/doodle3d-connect.git
synced 2024-12-25 18:13:48 +01:00
save settings
This commit is contained in:
parent
e9da8a91f0
commit
f486bd1777
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of the Doodle3D project (http://doodle3d.com).
|
||||
*
|
||||
* Copyright (c) 2013, Doodle3D
|
||||
* Copyright (c) 2013-2017, Doodle3D
|
||||
* This software is licensed under the terms of the GNU GPL v2 or later.
|
||||
* See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details.
|
||||
*/
|
||||
@ -25,9 +25,8 @@
|
||||
|
||||
var _self = this;
|
||||
|
||||
function updateFields() {
|
||||
var isHeatedBed = $("#chkBed").prop("checked");
|
||||
if (isHeatedBed) {
|
||||
function showOrHideFields() {
|
||||
if ($("#chkBed").prop("checked")) {
|
||||
$("#grpBedTemp").show();
|
||||
} else {
|
||||
$("#grpBedTemp").hide();
|
||||
@ -42,19 +41,62 @@
|
||||
$("#divSettings").hide();
|
||||
d3d.util.showLoader();
|
||||
|
||||
$("#chkBed").on("change", function(data) {
|
||||
updateFields();
|
||||
$("#lstPrinters").on("change", function(data) {
|
||||
var printerType = $(this).val();
|
||||
|
||||
_configAPI.savePrinterType(printerType,function(successData) {
|
||||
refreshSettings();
|
||||
},function(failData) {
|
||||
console.log("savePrinterType fail",failData);
|
||||
});
|
||||
});
|
||||
|
||||
$("#nozzleTemperature").on('slidestop', function( event ) {
|
||||
_configAPI.save({"printer.temperature":$(this).val()});
|
||||
});
|
||||
|
||||
$("#nozzleTemperature").on('focusout', function( event ) {
|
||||
_configAPI.save({"printer.temperature":$(this).val()});
|
||||
});
|
||||
|
||||
$("#bedTemperature").on('slidestop', function( event ) {
|
||||
_configAPI.save({"printer.bed.temperature":$(this).val()});
|
||||
});
|
||||
|
||||
$("#bedTemperature").on('focusout', function( event ) {
|
||||
_configAPI.save({"printer.bed.temperature":$(this).val()});
|
||||
});
|
||||
|
||||
$("#filamentThickness").on("change", function(data) {
|
||||
console.log("filamentThickness change",$(this).val());
|
||||
_configAPI.save({"printer.filamentThickness":$(this).val()});
|
||||
});
|
||||
|
||||
$("#bedTemperature").on("change", function(data) {
|
||||
console.log("bedTemperature change",$(this).val());
|
||||
$("#dimensionsX").on("change", function(data) {
|
||||
_configAPI.save({"printer.dimensions.x":$(this).val()});
|
||||
});
|
||||
|
||||
$("#dimensionsY").on("change", function(data) {
|
||||
_configAPI.save({"printer.dimensions.y":$(this).val()});
|
||||
});
|
||||
});
|
||||
|
||||
$("#dimensionsZ").on("change", function(data) {
|
||||
_configAPI.save({"printer.dimensions.z":$(this).val()});
|
||||
});
|
||||
|
||||
$('#startgcode').on("change", function(data) {
|
||||
_configAPI.save({"printer.startcode":$(this).val()});
|
||||
});
|
||||
|
||||
$('#endgcode').on("change", function(data) {
|
||||
_configAPI.save({"printer.end":$(this).val()});
|
||||
});
|
||||
|
||||
$("#chkBed").on("change", function(data) {
|
||||
showOrHideFields();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) {
|
||||
_pageData = d3d.util.getPageParams(PAGE_ID);
|
||||
|
||||
@ -68,7 +110,14 @@
|
||||
_configAPI.init(boxURL);
|
||||
_printerAPI.init(boxURL);
|
||||
|
||||
refreshSettings();
|
||||
});
|
||||
|
||||
$.mobile.document.on( "pagebeforehide", PAGE_ID, function( event, data ) {
|
||||
|
||||
});
|
||||
|
||||
function refreshSettings() {
|
||||
_configAPI.loadAll(function(successData) {
|
||||
var printerType = successData["printer.type"];
|
||||
var printerStartGCode = successData["printer.startcode"];
|
||||
@ -93,7 +142,6 @@
|
||||
$('#nozzleTemperature').val(nozzleTemperature);
|
||||
|
||||
_printerAPI.listAll(function(printers) {
|
||||
console.log(PAGE_ID,'page init',data);
|
||||
|
||||
$("#lstPrinters").empty();
|
||||
|
||||
@ -106,9 +154,13 @@
|
||||
|
||||
$("#divSettings").show();
|
||||
d3d.util.hideLoader();
|
||||
showOrHideFields();
|
||||
|
||||
},function(failData) { //_printerAPI.listAll
|
||||
console.log(PAGE_ID,'FAIL _printerAPI.listall',data);
|
||||
$("#bedTemperature").slider("refresh");
|
||||
$("#nozzleTemperature").slider("refresh");
|
||||
|
||||
},function(failData) {
|
||||
console.log(PAGE_ID,'FAIL _printerAPI.listAll');
|
||||
$.mobile.changePage("#boxes");
|
||||
return;
|
||||
});
|
||||
@ -118,12 +170,7 @@
|
||||
$.mobile.changePage("#boxes");
|
||||
return;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$.mobile.document.on( "pagebeforehide", PAGE_ID, function( event, data ) {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
})(window);
|
||||
|
||||
|
@ -83,15 +83,22 @@ function ConfigAPI() {
|
||||
success: function(response){
|
||||
//console.log("ConfigAPI:save response: ",response);
|
||||
if(response.status == "error" || response.status == "fail") {
|
||||
if(failedHandler) failedHandler(response);
|
||||
if (failedHandler) failedHandler(response);
|
||||
} else {
|
||||
completeHandler(response.data);
|
||||
console.log("ConfigAPI.save",newSettings,response.data);
|
||||
if (completeHandler) completeHandler(response.data);
|
||||
}
|
||||
}
|
||||
}).fail(function() {
|
||||
if(failedHandler) failedHandler();
|
||||
});
|
||||
};
|
||||
|
||||
this.savePrinterType = function(printerType,completeHandler,failedHandler) {
|
||||
var settings = {"printer.type": printerType};
|
||||
this.save(settings,completeHandler,failedHandler);
|
||||
};
|
||||
|
||||
this.resetAll = function(completeHandler,failedHandler) {
|
||||
//console.log("ConfigAPI:resetAll");
|
||||
$.ajax({
|
||||
|
@ -279,17 +279,7 @@
|
||||
|
||||
</div><!-- /header -->
|
||||
<div id="divSettings" role="main" class="ui-content">
|
||||
<!-- <p class="intro">test</p> -->
|
||||
|
||||
|
||||
<a href="index.html" data-icon="check" data-role="button" data-inline="true" data-theme="c">Save settings</a>
|
||||
<!-- <div align="right"> -->
|
||||
<!-- <a href="index.html" data-role="button" class="ui-btn-right ui-btn-inline">Save</a> -->
|
||||
<!-- </div> -->
|
||||
<!-- data-theme="a" data-inline="true" -->
|
||||
|
||||
<!-- <a href="#" class="ui-btn-right ui-btn-inline">Login</a> -->
|
||||
|
||||
<p class="intro">Use this page to select which 3D-printer is connected to your Doodle3D WiFi-Box. By selecting a printer the default settings for this printer will be loaded. Values are saved automatically.</p>
|
||||
|
||||
<div data-role="collapsible" data-collapsed="false">
|
||||
|
||||
@ -328,7 +318,7 @@
|
||||
|
||||
<div data-role="fieldcontain">
|
||||
<label for="name">Filament thickness (mm):</label>
|
||||
<input type="number" id="filamentThickness" name="filamentThickness" data-mini="true"/>
|
||||
<input type="number" id="filamentThickness" name="filamentThickness" data-mini="true" step=".01" min="1.75" max="3.3"/>
|
||||
</div>
|
||||
|
||||
<div data-role="fieldcontain">
|
||||
|
Loading…
Reference in New Issue
Block a user