How can i store last tool , to be used after turn off the Duet?
-
@cvetantokov There was a thread about storing counters.
It can help you to find a way to store your global on sd...
https://forum.duet3d.com/topic/24880/does-rrf-have-maintenance-counters-timers/5?_=1633414661879 -
@cosmowave it gives me that the page does not exist
-
@cvetantokov You can also use the workplace coordinate arrays G54-G59.3 as a workaround.
You choose one of the variables, overwrite it with the tool number with G10. Then send M500 to store the value in config-override.g
At next startup you load config-override.g with M501 and the last-tool value is available. -
@cvetantokov said in How can i store last tool , to be used after turn off the Duet?:
@cosmowave it gives me that the page does not exist
Here's the right link:
-
@cvetantokov the other option (if you have enough IO ports) is to have a switch on each tool dock to check which is missing/loaded. You could then use conditional gcode to run Tx P0 at the end of config.
Tbh, you could do T0 P0 as an intermediate workaround so you dont drop you tool too
-
@cvetantokov in 3.4beta firmware you can use a form of the echo command to write a command to file that restores the value of a global variable. So this (untested!) scheme or something like it should work:
Near the start of each tpost#.g file (or whenever it is that you want to save the current tool number):
echo >"restoreToolNumber.g" "set global.currentToolNumber="^state.currentTool
Near the end of each tfree#.g file:
echo >"restoreToolNumber.g" "set global.currentToolNumber=-1"
In config.g:
if not exists(global.currentToolNumber) global currentToolNumber=-1 M98 P"restoreToolNumber.g" if global.currentToolNumber != -1 T{global.currentToolNumber} P0
Note, this will write to the SD card every time a tool is loaded or freed. If you do a lot of tool changes, then this will increase wear on the SD card, bringing forward the time when it needs to be replaced.
On my tool changer I have docking switches so that the firmware can tell whether a tool is already loaded at power up.
-
Well it is cnc dental milling machine so it will change up to 5 tools at milling. I hope that will last long with tool storing .The product is for industrial use and it will be in serial production with Duet controller.At this case the tools for each milling are different , and the problem it is when the tool is left in spindle.
Yo can see in the right part of image is where the tools are stored , and the ATC Spindle pick's them from the slots.
I will try this code and see how it is working.
Thank you all for response. -
@dc42 i tryed the code, but it gives me erorr that it says : unknown value "not", then i tryed it with deleting "not" after "if"-statement , and put it in "else" statement , it says "unknown value "exists"",because i am in CNC mode i tried with different brackets "(" and "{" but no success.
-
@cvetantokov I did say it wasn't tested! Try replacing not by ! in that line. Like this:
if {!exists(global.currentToolNumber)}
-
@dc42 Thank you ,i tryed everithing arangment of brackets excep that you wrote, i manage to make it work without "exists" ,now i will change it , thank you very much.