GCode Variable Persistence After Power Cycling
-
What is the best way to retain the value 16 arrays that will be restored after power cycling?
I have sixteen X & Y values I use for calibration for a project I'm working on. I declare the global variable in a macro and the value gets written and read from various other macros.
if !exists(global.xy_offsets)
global xy_offsets = { {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} }All is working ok, except when I power down, the values are gone. What's the best way to keep these values?
Thanks.
-
@ChunkyPanda
I would suggest that any time you change the values you write it to file.Then call that file as a macro in config.g
e.g
; some changes were made so save to file echo >"setOffsets.g" "global xy_offsets = " ^ global.xy_offsets
Config
M98 P"setOffsets.g"
-
@OwenD Exactly what I was going to suggest!
Ian
-
@OwenD Thank you so much! That's exactly what I was looking for.