tl;dr: help with some potentially useful coding, please!
I could really use some help coding, or better yet pointing in the direction of existing software, to implement physical buttons for CNCJS.
My MPCNC is built, dual endstop model, being driven by TMC2209s on an SKR Pro 1.2 with TFT35 screen, both with V1 firmware, and an RPi 3B+ running V1pi. I went with an SKR for the Marlin firmware as I’m coming to CNC from 3D Printing and it just felt more comfortable. Then recently I had a problem where the V1Pi OctoPrint stopped recognising the SKR, even though CNCJS still does. Weird.
Anyway, I wanted to use CNCJS for the more CNC suitable environment, but was using OctoPrint for its suite of plugins, most notably for physical input buttons. The SKR, as a printing centred board is missing things such as a feed hold button to pause a cut, and I was going to implement them through OctoPrint until it gave up.
I looked for an existing option in CNCJS, then went hunting for an existing implementation. When I could find neither, I grabbed the nearest similar code and went to town.
I came across Austin Saint Aubin’s Simple Raspberry Pi GPIO Pendant Control for CNCJS, forked it and now have the basis for a solution, giving me three buttons for start tool, stop tool and feed hold. My repo is here.. The script runs in node.js which is already installed under V1pi. Convenient!
Simply put, I’ve yet to get it to compile. Lots of errors. I spent some time this evening trying out Visual Studio Code and it pointed out some coding errors that I had created and have since fixed, but I’ve yet to get it working.
If anyone wants to help, feel free to take a look, give constructive feedback, whatever, I’m open to listen. Most of my coding background is from QDOS, BBC Basic and ZX Basic from the 1980s, so I’m a little out of my depth here…!
Thanks in advance.
Edit: So, I’ve got it to compile after I worked out some errors I’d inadvertently introduced. Then I had some problems with dependencies, and at present it refuses to run. But progress is progress! Whilst trying to update node and npm to fix the dependencies, I accidentally killed CNCjs, so it’s a V1Pi reinstall then some more testing…