diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index c582740..a94eb0c 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,4 @@
+v1.0.235: Improved Serial Buffer check
v1.0.234: Added check for USB Selective Suspend to Troubleshooting tab, improved simulation of arcs, Fixed right-click menu in Gcode Editor
v1.0.233: Cleanup code
v1.0.232: Fix bug in Keyboard Jog
diff --git a/app/index.html b/app/index.html
index ece9df2..3ccdc0c 100644
--- a/app/index.html
+++ b/app/index.html
@@ -1611,10 +1611,14 @@
-
+
+
+
+
+
diff --git a/app/js/gamepad.js b/app/js/gamepad.js
new file mode 100644
index 0000000..30caae6
--- /dev/null
+++ b/app/js/gamepad.js
@@ -0,0 +1,107 @@
+var haveEvents = 'ongamepadconnected' in window;
+var controllers = {};
+
+var gamepadButtons = [];
+var oldGamepadButtons = [];
+var gamepadAxes = [];
+var oldGamepadAxes = [];
+
+
+function connecthandler(e) {
+ addgamepad(e.gamepad);
+}
+
+function addgamepad(gamepad) {
+ controllers[gamepad.index] = gamepad;
+ requestAnimationFrame(updateStatus);
+}
+
+function disconnecthandler(e) {
+ removegamepad(e.gamepad);
+}
+
+function removegamepad(gamepad) {
+ delete controllers[gamepad.index];
+}
+
+function updateStatus() {
+ if (!haveEvents) {
+ scangamepads();
+ }
+
+ var i = 0;
+ var j;
+
+ for (j in controllers) {
+ var controller = controllers[j];
+
+ // Buttons
+ for (i = 0; i < gamepadButtons.length; i++) {
+ oldGamepadButtons[i] = gamepadButtons[i];
+ }
+ gamepadButtons.length = 0;
+ for (i = 0; i < controller.buttons.length; i++) {
+ var val = controller.buttons[i];
+ var pressed = val == 1.0;
+ if (typeof(val) == "object") {
+ pressed = val.pressed;
+ val = val.value;
+ }
+ gamepadButtons.push({
+ id: i,
+ pressed: pressed,
+ val: val
+ })
+ if (oldGamepadButtons.length && oldGamepadButtons[i].pressed != gamepadButtons[i].pressed) {
+ console.log("event on ", i, pressed, val)
+ }
+ }
+ // Axes
+ for (i = 0; i < gamepadAxes.length; i++) {
+ oldGamepadAxes[i] = gamepadAxes[i];
+ }
+ gamepadAxes.length = 0;
+ for (i = 0; i < controller.axes.length; i++) {
+
+
+ var val = parseFloat(controller.axes[i]).toFixed(2)
+ if (val > 0.25) {
+ val = 1
+ } else if (val < -0.25) {
+ val = -1
+ } else {
+ val = 0
+ }
+
+ gamepadAxes.push({
+ id: i,
+ val: val
+ })
+ if (oldGamepadAxes.length && oldGamepadAxes[i].val != gamepadAxes[i].val) {
+ console.log("event on ", i, val)
+ }
+ }
+ }
+
+ requestAnimationFrame(updateStatus);
+}
+
+function scangamepads() {
+ var gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);
+ for (var i = 0; i < gamepads.length; i++) {
+ if (gamepads[i]) {
+ if (gamepads[i].index in controllers) {
+ controllers[gamepads[i].index] = gamepads[i];
+ } else {
+ addgamepad(gamepads[i]);
+ }
+ }
+ }
+}
+
+window.addEventListener("gamepadconnected", connecthandler);
+window.addEventListener("gamepaddisconnected", disconnecthandler);
+
+if (!haveEvents) {
+ setInterval(scangamepads, 500);
+}
\ No newline at end of file
diff --git a/index.js b/index.js
index 5ad426d..e975585 100644
--- a/index.js
+++ b/index.js
@@ -1718,7 +1718,7 @@ function parseFeedback(data) {
// debug_log(data)
var state = data.substring(1, data.search(/(,|\|)/));
status.comms.runStatus = state
- if (state == "Alarm") {
+ if (state == "Alarm" || state == "Hold:0") {
// debug_log("ALARM: " + data)
status.comms.connectionStatus = 5;
switch (status.machine.firmware.type) {
@@ -1975,15 +1975,17 @@ function send1Q() {
case 'grbl':
if ((gcodeQueue.length - queuePointer) > 0 && !status.comms.blocked && !status.comms.paused) {
spaceLeft = BufferSpace('grbl');
- if (gcodeQueue[queuePointer].length < spaceLeft) {
- gcode = gcodeQueue[queuePointer];
- queuePointer++;
- sentBuffer.push(gcode);
- machineSend(gcode + '\n');
- // debug_log('Sent: ' + gcode + ' Q: ' + (gcodeQueue.length - queuePointer) + ' Bspace: ' + (spaceLeft - gcode.length - 1));
- } else {
- status.comms.blocked = true;
- }
+ // v1.0.235 removed this
+ // if (gcodeQueue[queuePointer].length < spaceLeft) {
+ gcode = gcodeQueue[queuePointer];
+ queuePointer++;
+ sentBuffer.push(gcode);
+ machineSend(gcode + '\n');
+ // v1.0.235 removed this
+ // debug_log('Sent: ' + gcode + ' Q: ' + (gcodeQueue.length - queuePointer) + ' Bspace: ' + (spaceLeft - gcode.length - 1));
+ // } else {
+ // status.comms.blocked = true;
+ // }
}
break;
}
diff --git a/package.json b/package.json
index e34249f..2e0e339 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "OpenBuildsCONTROL",
- "version": "1.0.234",
+ "version": "1.0.235",
"license": "AGPL-3.0",
"description": "OpenBuildsCONTROL CNC Machine Interface Software",
"author": "github.com/openbuilds ",