-
Notifications
You must be signed in to change notification settings - Fork 103
Feature Request - custom command buttons #25
Comments
Thank you for the suggestions: |
Hi Gerrit, Scott, I implemented something similar during the last days because I also was typing G38.2... a few times too often. I came up with probing support for grbl-panel. Right now I'm extending it for the X and Y axis, the Z axis is already working. Placing an additional button for probing was easy: I moved the "0" button of the Z axis a bit up und added a "P" button below. Clicking it starts a probe cycle using probe distance, feed rate, plate thickness and back off distance from a few new text boxes on the settings page. @gerritv: I'm still testing it - would you be interested in the code once its stable? If you do, how would you like to integrate my changes? Best regards |
I would love to get the code and merge it in. I am not a fan of Git nor GitHub so I prefer to merge the file myself. You can send the changed files to my (masked) email address listed under my member name. |
Okay, I'll send you the code as soon as I'm done with testing. Until then, the (not fully tested) code is available in my fork of your project. I plan to finish it at the weekend. |
Gerrit, while testing my additions, I'm observing some strange behaviour. Whenever grblreplies with a Did something equal ever occur during your development, are there timing constraints I need to observe? Is there some waiting for ACKs going on? How would I need to adapt to your protocol handling best? At the moment I'm clueless why grblignores the second call to |
sendGCodeLine doesn't wait for an Ack/OK but for such short commands I would think it doesn't matter because the buffer doesn't fill up. Do you run the Probe sequence with a Gcode program already loaded or is this manual stage work? |
There's only one OK in the list, in front of the second command Another one: When I start the probe cycle, I first reset the corresponding axis to zero using |
I forgot to answer your second question: No, I didn't load a program, this is all manual work. |
I think it is then because 2 MDI commands were sent in a row, specifically the second command was sent before the first Ok was received. I never considered that would happen :-( aka I never tested that situation. Unfortunately I am in the midst of renovations and even if I could find my Arduino, there is no realistic way for me to code up a proper queue. I had started that but when we sold our condo last year and went homeless for 8 months (travelling etc) the code was parked. |
Some of the symptoms/sequence might be a bit clearer if you can turn off polling? Or turn it off soon after the second command goes out? |
Just a quick update: I've had an interesting discussion over here: This explains most of the issues I was experiencing the last days. I've implemented a GrblQueue class which handles all the byte counting and contains its own queue list which can be filled using simple calls. It is working, well, almost. I'm able to fill it with gcode commands and it stuffs everything into grbl's receive buffer until it is full, always trying to keep buffer utilization high. The only thing I did not expect was that some commands write to the internal EEPROM and this stalls grbl's RX handling for several milliseconds which leads to lost characters. I will implement some detection to find gcode commands which write to EEPROM. If they occur, I need to wait until grbl's buffer has drained and the EEPROM write is complete, then the next commands can be written. I will report back as soon as progress is made. |
mn, read the thread, difficult troubleshooting. Excellent work! |
@thoralt @gerritv : I've thought about this overnight. The character-counting protocol has issues such as this EEPROM one inherently. There isn't a robust way to change this protocol to keep from sending data when it is in the middle of an EEPROM write, other than tracking what commands you've sent, waiting until the buffer clears, sending it, and waiting for an 'ok' for that particular command. While the character counting does provide improved performance by eliminating some latency between messages, its implementation is more difficult and has a few catches. The simple send and wait for response is robust and will eliminate all such issues. I'll think about it some more on how to improve the streaming interface to Grbl for the next version. If you all have any suggestions, I'd love to hear them. |
Hi Sonny, The real solution IMHO is a protocol along the lines of SDLC where you send one or more packets and look for matching Acks.(Acks included the frame number being acknowledged) If you get a Nak, then resend that packet. If you get a RNR (receiver not ready e.g. if about to do an EEPROM command) then the sender tries again after some delay. If you timeout waiting for an Ack, then resend. I have never understood the penchant for using only gnd, Rx and Tx without Rts/Cts flow control or even checking for parity errors in most of the FOSS sw being used. It is not a reliable medium when used this way. |
Do we know which commands write to EEPROM? I forget what is says on the wiki, is it documented there? |
I had a look at grbl's code and as far as I can tell, there's only G10, G38.1 and G38.2. Additionally, all $ commands should be taken into account. Although some of them ($X, $H, ...) do not cause EEPROM writes, it should be safe to drain the queue after each of these. |
@gerritv : Agreed, waiting for a response will fix the issue, but only if the GUI ceases streaming after it detects and sends one of the EEPROM commands in a line. Grbl can't control the data coming in and there may be a case where the EEPROM write still gets executed, while the GUI is still streaming or a USB packet gets delivered late. As for a new streaming interface, I've been thinking about something similar to what you suggested. Given that both a Mega and ARM chip will have much more memory, the streaming interface can have larger buffers that can do more complicated things like packet-type data transfers, error-checking via checksums, among a lot of other things. A major goal for the next version of Grbl is to fix a lot of these outstanding issues with the streaming protocol and do it once and right. I've updated the Interface wiki on Grbl's website and it has a list of the EEPROM command (here). |
@thoralt Are you still pursuing this probing code? I am finally back working on GrblPanel and my related hobbies. I checked your fork and nothing has changed for a while, much like my code :-) |
@gerritv Sorry for the delay, I've been busy with many other things :) Last few month there was little progress due to business trips and things like that, but your message triggered my milling projects and I started looking into grbl-panel again. I will continue testing and report back during the next days. |
@gerritv I submitted some major updates to https://github.com/thoralt/Grbl-Panel to fully integrate the new command queue into the GUI. Most of the code in Since grbl-panel now handles the command transmission completely different, we need some serious testing. The basic workflow like reset/unlock, load, send, pause, resume and stop already works as intended, but I also added a first issue to the list. The screenshot shows the slightly altered UI: Could you please try to compile my fork and give it a test drive? |
Hi Thoralt I don't have a probe set up yet, will have to hack something together for that... |
I don't know if you guys are still working on this or not but I've written something you might find interesting. Basically I've added user-defined macro buttons to the MDI group. I don't know how to share the code in Github but if you'd like to take a look you can get it from here, Here's the long and short of it. I added three new routines to the bottom of GrblGui, MacroButtonEditorToolStripMenuItem_Click I also added a call to EnableMacroButtons near the bottom of grblgui_Load and a new Menu Item under Tools. There's a new form to allow the user to edit their macros, GrblMacroButtons. This form allows the user to add, edit, and delete macro buttons. The data is stored in the system registry under HKCU\Software\GrblPanel\Macros. Only five buttons can fit in the groupbox comfortably but there's no limit to the number of macros that can be added. The buttons are dynamically added and removed to gbMDI based on the values found in the registry. When the user clicks one of the buttons the gcode associated with that button is sent using the same mechanism as the MDI Manual Command Send. When the user enters the Macro Button Editor the first time or if there are no buttons defined at all the editor will load itself with a sample Probe macro. This sample is not saved in the system until the user commits the sample to the registry. Please let me know your thoughts on this. |
@joebananas10 I will review your code additions on the weekend. Sounds like an excellent solution although I might prefer to use an xml file for the configuration. Otherwise the registry entries remain even if you no longer want to use GrblPanel. |
V1.0.7.0 implements the macro button code from @joebananas10 I am pondering a solution to Thoralts observations wrt probe etc. |
I am changing the Macro send code to use a Q for V1.1.0.0 (at last!) See Issue #61 |
I'd like to see a couple buttons that are linked to custom gcode. They would work just like Go To Spcl Posn1 and Posn2 buttons. For example, I have a command that I use all the time for my touch plate: G20 G38.2 Z-2 F0.118
It would be nice if in addition to storing the command, the user could also name the button, so you'd have two text fields, one for the button name, one for the Gcode
The text was updated successfully, but these errors were encountered: