Closed JimF42 closed 8 years ago
Yes, just send the ! feed hold command.
I would NOT reset the TinyG if you are worried about losing lines of Gcode. You will absolutely lose lines. However, if you are ok retransmitting gcode then chilipeppr could be your savior. The only problem is, if you’ve reset your controller you have to make sure when you restart your gcode that everything is correctly setup again like inches vs mm or relative vs absolute coordinates, work planes, work coordinate systems, etc.
From: Jim Foster [mailto:notifications@github.com] Sent: Monday, January 11, 2016 12:21 PM To: johnlauer/serial-port-json-server serial-port-json-server@noreply.github.com Subject: [serial-port-json-server] Pause/flush on device reset (#33)
OK, I don't even know if this is possible, either directly or indirectly. I have created an e-stop system that does two things. Kills the line power to my router, and resets my TinyG via the extra reset pins on the board. That works great. The issue is that SPJS doesn't "get the message" and still is sending g-code to the TinyG, which can be bad after the TinyG finishes it's reset cycle.
Is there anyway of SPJS to either:
— Reply to this email directly or view it on GitHubhttps://github.com/johnlauer/serial-port-json-server/issues/33.
@johnlauer Thanks for the info. That is what I figured it would be. Now I have to see if I can add networking to my Ardunio to get it to send the feed hold--or convert to a RPi. Speaking of RPi, can you speak to performance of SPJS on a RPi 2 board? Is it enough to handle the traffic to and from a CNC?
Also, I am not worried about losing my Gcode as this is an e-stop system (as in Emergency Stop). But, if I can figure out to do a feed hold, I may reconsider using it more liberally or at least add a dedicated Feed Hold button that would not power down the spindle.
I highly recommend the Rpi2. It runs SPJS great. I use it as my main goto device. It only uses about 35% of the processor at peak movement. I am also using Rpi for webcam because there's a lot of headroom left.
BTW, you can also trigger a GPIO on Rpi2 to then send in a ! feed hold symbol to your SPJS.
@johnlauer Thanks for the GPIO suggestion. I can try that. One problem though is I have to make sure my relay for handling the line voltage is compatible with the RPi's 3.3v IO (the Ardunio is 5v).
Do you run ChiliPepr on the RPi also? If not what do you do for a display for your RPi? I was thinking some sort of X Windows viewer for my Windows box so I can see the RPi and see it's status.
No display on Rpi. You use your powerful laptop as the main workstation with browser there and all gcode files and cam apps etc right on your main work machine. Then run job and let Rpi handle it as your laptop sends it down to SPJS on the Rpi.
@johnlauer, OK, I understand that the Rpi is headless, but how do you know when it is fully booted, SPJS is up and running, etc. are you just saying "I can see it in ChiliPepr, so it must be running", using VNC, or something else?
Just when I connect from Chilipeppr.
Thanks.
@johnlauer I would like to dialog with you about having my own "go" program talk to SPJS. I am not sure where the best place to do that would be? This thread, a new one, someplace else?
I am very green to using Go, but not to programming. I think I have some idea of how to do what I want, but I am not sure if I am doing it correctly. One thing in particular, I was assuming that if I sent a feedhold (!) to SPJS that I would see the result reflected in ChiliPepr, but that does not seem to be the case--am I doing something wrong?
I think this is a fine place to do have the dialog. You should see ChiliPeppr reflect the % feed hold. When you say you don't, can you describe that more? SPJS was setup in such a way to re-broadcast everything so you could have multiple GUIS or apps connected to SPJS and they all see the results at the same time. When it comes to Go, what app are you trying to write? Is it perhaps another command line app that does something on it's own and then connects to localhost?
OK, I took my program out of the mix for now. I have SPJS running on my RPi (1.86), and it seems to work just fine. I can use ChiliPeppr and communicate to my TinyG just fine.
_But_, what I tried after my previous posting is to open two copies of ChiliPeppr on my Windows Chrome browser. I pressed Feedhold
on one, and the other did not reflect the new status. Same for Energize
and Unenergize
.
As far as the Go app that I am writing, it is still in its infancy, but what it will become is a hard-button controller to perform the following. Feedhold
, Resume
, Energize
, and Unenergize
. Plus a sort of "E-Stop" function that will not only do a Feedhold
, but also power off my tool head (DeWalt DWP 611 router) via a Pi controlled relay. I already have the relay working fine on my Arduino, but since there is not built-in network, I can't do a Feedhold
, thus why I started this thread in the beginning...
Well, I'm thinking you're meaning the push buttons reacting the way they do when you directly click them in the workspace. In that case, no, that wouldn't work. However, lets say you're running live gcode and CP is updating the axes and showing movement in the 3d viewer. If you send % from your other app, you would see everything stop correctly in CP. So that achieves your goal. Now, if you wanted that Resume button to kick in, you wouldn't see that but you could still hit the ~ resume and it would work. Same thing with energize/deenergize. You wouldn't see the highlighting but it would still work if you clicked the buttons. So, not ideal, but could be fine.
It would seem to me if you hit ~ resume in CP after a feed hold and you wanted to trigger your relay back on, you'd have to watch the spjs stream as well on your own to see when the ~ comes in.
Have you ever considered using the direct GPIO's on the Rpi instead of Arduino?
@johnlauer Yes, sorry I wasn't clearer--I was assuming that the CP GUI would react to all of the commands since it shows the live gcode Would that be difficult to do? It would be contained to the TinyG widget since the other widgets (the main workspace, Axis, GCode, and Serial Port Console) all "see" what is happening already.
I probably will not get back to the code until the weekend, but yes, I do plan on connecting the hard buttons to the RPi's GPIO and not use the Arduino. I started with the Arduino because it is a simpler model to program (the whole machine is dedicated to your program) and I have read that the GPIO on the Arduino is buffered better and less likely to fry a board (I'm new to the hardware side of things--but been a professional coder for decades). But, at this point, since it doesn't do what I need it to do, I will move it all to my RPi.
@johnlauer I got a chance to run some quick tests last night, and yes, my code, for what I have so far, works just fine. My TinyG and the RPi were in a different room and I was expecting to see feedback from the CP screen--my mistake.
Now, back to my other question--do you think it would be possible to keep the Feedhold/Resume buttons in sync in CP? I realized after my last post, that the other elements are kept in sync via status reports (presumably). I just opened a ticket on the TinyG site to ask if there is a definitive way of determining a Feedhold (!) state via a status report over here https://github.com/synthetos/TinyG/issues/152. I will let you know what they say.
Yes, I think you could keep the GUI in sync fairly easily. You would simply need to watch all the inbound data and look for commands you want to pivot off of like % and ! and ~. Probably best to simply fork the TinyG widget (I'd be happy to add your changes to the core widget when you're ready) because it already watches everything. Just add to it's if/then/else switch and when you see the commands you want to trigger stuff then call the methods today that I call to hilite buttons.
Or, you could write a macro or widget that does all of this outside the scope of the TinyG widget. Just watch all the data and then inject classes to the DOM on those buttons to mimic the effects. I believe all I did is add and remove classes for CSS and tweak text values of the DOM elements for those buttons.
In terms of determining if TinyG is stopped, that status report is easy to see, however you don't know if it was stopped due to a feed hold or due to the program end.
Well, according to Alden Hart over at TinyG, a status report of "stat=6" indicates a Feedhold has been initiated. As far as me being able to update CP, well then I guess it will be a long wait :-). I have delved into CP once or twice, but I am not that familiar with SPAs at this point to try my hand at that change of that scale.
Thanks anyway...
You might be surprised how quickly you pick it up. If you just look at the jsfiddle and hit run you may find it's a dream how easy it is. On Jan 21, 2016 11:40 AM, "Jim Foster" notifications@github.com wrote:
Well, according to Alden Hart over at TinyG, a status report of "stat=6" indicates a Feedhold has been initiated. As far as me being able to update CP, well then I guess it will be a long wait :-). I have delved into CP once or twice, but I am not that familiar with SPAs at this point to try my hand at that change of that scale.
Thanks anyway...
— Reply to this email directly or view it on GitHub https://github.com/johnlauer/serial-port-json-server/issues/33#issuecomment-173685807 .
OK, I don't even know if this is possible, either directly or indirectly. I have created an e-stop system that does two things. Kills the line power to my router, and resets my TinyG via the extra reset pins on the board. That works great. The issue is that SPJS doesn't "get the message" and still is sending g-code to the TinyG, which can be bad after the TinyG finishes it's reset cycle.
Is there anyway of SPJS to either: