grblHAL / core

grblHAL core code and master Wiki
Other
310 stars 76 forks source link

A strange demand from a user? He needs to save the mechanical coordinates after power off? #259

Closed hanke-cnc closed 1 year ago

hanke-cnc commented 1 year ago

This seems to be the usage habit of mach3?

terjeio commented 1 year ago

Mach3 is a windows app that is closed manually or on Windows shutdown allowing it to save the position. grblHAL is microcontroller firmware that does not have shutdown command and IMO never will get one.

However, a plugin can be written that writes the current position to EEPROM or FRAM on a transition to the Idle state and restores it on startup. Not that if settings are stored in flash I would not contemplating doing so - it would be a sure way to wear out the flash...

hanke-cnc commented 1 year ago

Oh I know!!! Although grbl doesn't need a computer to run, usually people have to connect to a computer anyway, and when the user wants to shut down, save the mechanical coordinates in the computer, but I don't know how to change the mechanical of grblhal coordinates, I don't know where its variable

terjeio commented 1 year ago

... but I don't know how to change the mechanical of grblhal coordinates, I don't know where its variable

If you want to save and restore the position from a sender you would still need a plugin as there is no command to set the position. The position is stored in the sys.postion array. If set after startup is complete other positions has to be synced with this. If position is restored from EEPROM or FRAM on startup then the plugin can "hook into" a function pointer to set it.

karoria commented 1 year ago

@hanke-cnc @terjeio if you want to restore saved work coordinates from PC and apply them to machine without moving any axis, you can do it by sending G10L20P0X to the controller. That is standard Code. E.g. G10L20P0X107.848. Replace X with Y, Z or A for other axis. I use this command in my grblTouch webui to set coordinate to a specific digit.