Go Down

Topic: grbl question (Read 495 times) previous topic - next topic

zwieblum

#15
Sep 17, 2020, 06:17 pm Last Edit: Sep 17, 2020, 06:17 pm by zwieblum
You can modify the "M2" command in grbl code to write a position to eeprom. And change the main() function to read that values.

SergeS

You can modify the "M2" command in grbl code to write a position to eeprom. And change the main() function to read that values.
I did not get your idea, can you please explain?

https://wiki.shapeoko.com/index.php/G-Code
--- 8< ---
M2   Program Pause and End   M02 was the original program-end code, now considered obsolete, but still supported for backward compatibility. See M30 below.
--- 8< ---

zwieblum

Yes, that's the idea. You cannot write to the eeprom every second, it breaks realtime operation. so write to it at the end of program.

wildbill

It's fairly common to invent your own G-codes. The piece of firmware that processes different G-code instructions is probably just a giant switch statement (mine is) and that means it's easy to add to. I had a bunch of fake codes I invented for getting debugging information. So you can just find the highest numbered M code and make sure your new one is (much) larger. Try M777 perhaps.

That code can store pos to EEPROM. M778 can read the pos from EEPROM and go there.

Or you could just leave the com port open of course  ;)

SergeS

Yes, that's the idea. You cannot write to the eeprom every second, it breaks realtime operation. so write to it at the end of program.
So, what is the idea?
Modify grbl by injecting saving position into the M2 command?

I would not modify grbl code, I would prefer rather to keep comport opened all the time.

SergeS

It's fairly common to invent your own G-codes. The piece of firmware that processes different G-code instructions is probably just a giant switch statement (mine is) and that means it's easy to add to. I had a bunch of fake codes I invented for getting debugging information. So you can just find the highest numbered M code and make sure your new one is (much) larger. Try M777 perhaps.

That code can store pos to EEPROM. M778 can read the pos from EEPROM and go there.

Or you could just leave the com port open of course  ;)
Got your point, thank you. But I would not modify grbl code...

Robin2

I would prefer rather to keep comport opened all the time.
Have you considered using a USB-TTL cable as I suggested in Reply #8? Then it would not be necessary to keep the com port open.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

SergeS

Have you considered using a USB-TTL cable as I suggested in Reply #8? Then it would not be necessary to keep the com port open.
Yes, I have considered, it seems like very good hardware solution. But I have it almost done with software solution - keep port always open. And between software and hardware solution I would prefer software :-).

Go Up