mirror of
https://github.com/Doodle3D/doodle3d-connect.git
synced 2024-12-26 02:23:48 +01:00
substitute variables in custom gcode
This commit is contained in:
parent
856a32486e
commit
13c7b8392b
@ -44,18 +44,42 @@
|
|||||||
$("#grpStatusAndControl").hide();
|
$("#grpStatusAndControl").hide();
|
||||||
|
|
||||||
$("#btnSend").on("click", function(data) {
|
$("#btnSend").on("click", function(data) {
|
||||||
console.log("test",$("#gcode").val());
|
// console.log("test",$("#gcode").val());
|
||||||
$(this).hide();
|
|
||||||
_printerAPI.print({
|
_configAPI.loadAll(function(successData) {
|
||||||
gcode: $("#gcode").val(),
|
_settings = successData;
|
||||||
start: true,
|
|
||||||
first: true
|
var gcode = _configAPI.subsituteVariables($("#gcode").val(),_settings);
|
||||||
},function(successData) {
|
|
||||||
console.log("success");
|
console.log("btnPrint subsituteVariables: ",gcode);
|
||||||
},function(failData) {
|
|
||||||
console.log("fail");
|
$(this).hide();
|
||||||
|
_printerAPI.print({
|
||||||
|
gcode: gcode,
|
||||||
|
start: true,
|
||||||
|
first: true
|
||||||
|
},function(successData) {
|
||||||
|
console.log("btnSend success");
|
||||||
|
},function(failData) {
|
||||||
|
console.log("btnSend fail");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_pageData = d3d.util.getPageParams(PAGE_ID);
|
||||||
|
|
||||||
|
// console.log(_pageData);
|
||||||
|
|
||||||
|
if(_pageData === undefined) {
|
||||||
|
console.log("ERROR",PAGE_ID,"_pageData undefined");
|
||||||
|
$.mobile.changePage("#boxes");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var backUrl = d3d.util.replaceURLParameters("#box",_pageData);
|
||||||
|
$("#btnControlBack").attr("href",backUrl);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$("#btnCooldown").button().on("click", function(data) {
|
$("#btnCooldown").button().on("click", function(data) {
|
||||||
_printerAPI.print({
|
_printerAPI.print({
|
||||||
@ -82,6 +106,10 @@
|
|||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
$("#btnStop").on("click", function(data) {
|
$("#btnStop").on("click", function(data) {
|
||||||
|
if (!window.confirm("Are you sure you want to stop the current print?")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
|
|
||||||
_configAPI.loadAll(function(successData) {
|
_configAPI.loadAll(function(successData) {
|
||||||
@ -94,6 +122,7 @@
|
|||||||
refreshStatus();
|
refreshStatus();
|
||||||
},function(failData) {
|
},function(failData) {
|
||||||
console.log("btnStop fail",failData);
|
console.log("btnStop fail",failData);
|
||||||
|
window.alert("Problem: " + failData.msg);
|
||||||
});
|
});
|
||||||
}, function(failData) {
|
}, function(failData) {
|
||||||
console.log('btnStop failed to load settings',failData);
|
console.log('btnStop failed to load settings',failData);
|
||||||
@ -145,7 +174,7 @@
|
|||||||
d3d.util.hideLoader();
|
d3d.util.hideLoader();
|
||||||
|
|
||||||
},function(failData) {
|
},function(failData) {
|
||||||
console.log("getStatus fail");
|
console.log("getStatus fail",failData);
|
||||||
$("#grpStatusAndControl").hide();
|
$("#grpStatusAndControl").hide();
|
||||||
d3d.util.hideLoader();
|
d3d.util.hideLoader();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user