diff --git a/index.html b/index.html
old mode 100644
new mode 100755
index 0edffa1..1cd3b0a
--- a/index.html
+++ b/index.html
@@ -56,7 +56,14 @@
diff --git a/js/main.js b/js/main.js
old mode 100644
new mode 100755
index 0fedc1c..42ca5b8
--- a/js/main.js
+++ b/js/main.js
@@ -3,6 +3,16 @@ var yMax = 8.0;
var xCenter = xMax / 2;
var yCenter = yMax / 2;
+var machineX = 0.0;
+var machineY = 0.0;
+var machineX = 0.0;
+
+fabmo.on('status', function(status) {
+ machineX = status.posx;
+ machineY = status.posy;
+ machineZ = status.posz;
+});
+
function getConfig(callback) {
if(fabmo.isPresent()) {
return fabmo.getConfig(callback);
@@ -29,6 +39,7 @@ $(document).ready(function() {
$('#diameter').attr('data-parsley-max', xMax);
}
});
+ fabmo.requestStatus();
});
var $selector = $('#signupForm'),
@@ -115,10 +126,17 @@ function makeCircle(config) {
var depth = Math.abs(parseFloat($('#depth').val()));
var bitDiameter = parseFloat($('#bit-diameter').val());
var actualDiameter = (diameter - bitDiameter);
+ if (actualDiameter==0) actualDiameter = 0.001;
var depthTotal = depth + cutThrough;
var maxPlunge = bitDiameter * .75;
var passes = Math.ceil(depthTotal / maxPlunge);
var plunge = (0 - (depthTotal / passes)).toFixed(5);
+ var useCurrentXY = $('#use-current-XY').is(":checked");
+ if (useCurrentXY){
+ xCenter = machineX;
+ yCenter = machineY;
+ }
+
var shopbotCode = ["'Simple Circle'",
"'Center: " + xCenter + "," + yCenter + " Diameter: " + diameter + "'",
"'Bit Diameter: " + bitDiameter + "'",
@@ -133,10 +151,15 @@ function makeCircle(config) {
"JZ, 1",
"'Spindle Off'",
"SO, 1,0",
- "'Jog Home'",
- "J2, 0,0"
+ useCurrentXY?"":"'Jog Home'",
+ useCurrentXY?"":"J2, 0,0"
];
var code = shopbotCode.join('\n');
+ if (actualDiameter<=0){
+ $("#err-msg").text("Can not cut a "+diameter+" inch hole with a "+bitDiameter+" inch bit.");
+ return;
+ }
+ $("#err-msg").text("");
fabmo.submitJob({
file: code,
filename: 'example-circle.sbp',
diff --git a/package.json b/package.json
old mode 100644
new mode 100755
index 6bb1ea5..fba1bf7
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"main": "./index.html",
"icon": "hole-icon.png",
"icon_color": "white",
- "version": "1.0.2",
+ "version": "1.0.2.1",
"author": "Brendan Collins",
"website": "http://www.shopbottools.com",
"description": "Cut holes of specified dimensions",