mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 09:17:56 +01:00
added if-statements for the new variables which are grabbed from the query string (these allow us to enable/disable certain behaviors such as communicating with the wifibox, or being allowed to print)
This commit is contained in:
parent
70b59c923a
commit
d420bde380
@ -154,6 +154,7 @@ function Printer() {
|
|||||||
//console.log("Printer:checkTemperature");
|
//console.log("Printer:checkTemperature");
|
||||||
var getData = { id: 0 };
|
var getData = { id: 0 };
|
||||||
var self = this;
|
var self = this;
|
||||||
|
if (communicateWithWifibox) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: this.wifiboxURL + "/printer/temperature",
|
url: this.wifiboxURL + "/printer/temperature",
|
||||||
data: getData,
|
data: getData,
|
||||||
@ -174,18 +175,22 @@ function Printer() {
|
|||||||
//console.log(" this.alive: ",self.alive);
|
//console.log(" this.alive: ",self.alive);
|
||||||
$(document).trigger(Printer.UPDATE);
|
$(document).trigger(Printer.UPDATE);
|
||||||
|
|
||||||
self.checkTemperatureDelay = setTimeout(function() { self.checkTemperature() },self.checkTemperatureInterval);
|
self.checkTemperatureDelay = setTimeout(function() { self.checkTemperature() }, self.checkTemperatureInterval);
|
||||||
}
|
}
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
console.log("Printer:checkTemperature: failed");
|
console.log("Printer:checkTemperature: failed");
|
||||||
clearTimeout(self.retryCheckTemperatureDelay);
|
clearTimeout(self.retryCheckTemperatureDelay);
|
||||||
self.retryCheckTemperatureDelay = setTimeout(function() { self.checkTemperature() },self.retryDelay); // retry after delay
|
self.retryCheckTemperatureDelay = setTimeout(function() { self.checkTemperature() },self.retryDelay); // retry after delay
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
console.log ("Printer >> f:checkTemperature() >> communicateWithWifibox is false, so not executing this function");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.checkProgress = function() {
|
this.checkProgress = function() {
|
||||||
//console.log("Printer:checkProgress");
|
//console.log("Printer:checkProgress");
|
||||||
var getData = { id: 0 };
|
var getData = { id: 0 };
|
||||||
var self = this;
|
var self = this;
|
||||||
|
if (communicateWithWifibox) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: this.wifiboxURL + "/printer/progress",
|
url: this.wifiboxURL + "/printer/progress",
|
||||||
data: getData,
|
data: getData,
|
||||||
@ -212,6 +217,8 @@ function Printer() {
|
|||||||
clearTimeout(self.retryCheckProgressDelay);
|
clearTimeout(self.retryCheckProgressDelay);
|
||||||
self.retryCheckProgressDelay = setTimeout(function() { self.checkProgress() },self.retryDelay); // retry after delay
|
self.retryCheckProgressDelay = setTimeout(function() { self.checkProgress() },self.retryDelay); // retry after delay
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
console.log ("Printer >> f:checkProgress() >> communicateWithWifibox is false, so not executing this function");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -36,15 +36,17 @@ function initSettingsPopup(apiURL) {
|
|||||||
console.log("f:initSettingsPopup()");
|
console.log("f:initSettingsPopup()");
|
||||||
wifiboxURL = apiURL;
|
wifiboxURL = apiURL;
|
||||||
|
|
||||||
loadSettings();
|
if (communicateWithWifibox) loadSettings();
|
||||||
|
|
||||||
$("#contentOverlay").hide();
|
$("#contentOverlay").hide();
|
||||||
|
|
||||||
$("div.content .btnOK").click(function(e) {
|
$("div.content .btnOK").click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
// TODO something like a callback or feedback that saving went well / or failed
|
// TODO something like a callback or feedback that saving went well / or failed
|
||||||
saveSettings();
|
|
||||||
|
if (communicateWithWifibox) saveSettings();
|
||||||
|
|
||||||
$("#contentOverlay").fadeOut(375, function() {
|
$("#contentOverlay").fadeOut(375, function() {
|
||||||
document.body.addEventListener('touchmove',prevent,false);
|
document.body.addEventListener('touchmove',prevent,false);
|
||||||
@ -56,9 +58,10 @@ function initSettingsPopup(apiURL) {
|
|||||||
|
|
||||||
function showSettings() {
|
function showSettings() {
|
||||||
console.log("f:showSettings()");
|
console.log("f:showSettings()");
|
||||||
|
if (!communicateWithWifibox) console.log(" communicateWithWifibox is false: settings aren't being loaded from wifibox...")
|
||||||
$("#contentOverlay").fadeIn(375, function() {
|
$("#contentOverlay").fadeIn(375, function() {
|
||||||
console.log("#contentOverlay faded in...");
|
console.log("#contentOverlay faded in...");
|
||||||
loadSettings();
|
if (communicateWithWifibox) loadSettings();
|
||||||
document.body.removeEventListener('touchmove',prevent,false);
|
document.body.removeEventListener('touchmove',prevent,false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -99,7 +102,7 @@ function loadSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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'));
|
||||||
@ -154,7 +157,7 @@ var maxScale = 1;
|
|||||||
var shape = "%";
|
var shape = "%";
|
||||||
var twists = 0;
|
var twists = 0;
|
||||||
var useSubLayers = true;
|
var useSubLayers = true;
|
||||||
var debug = false;
|
//var debug = false; // debug moved to main.js
|
||||||
var loglevel = 2;
|
var loglevel = 2;
|
||||||
var zOffset = 0;
|
var zOffset = 0;
|
||||||
var serverport = 8888;
|
var serverport = 8888;
|
||||||
|
Loading…
Reference in New Issue
Block a user