May 24, 2019 at 7:12 am #101517
Hello and an urgent question for me…
Is it possible to do some calculations within the marlin gcode? Means I have a variable parameter value near at the start of the gcodes and in dependence of this parameter some gcode commands change.
If no … o.k.
If yes ….do you have an/some example(s) for me how to modify the gcode please?
Greetings Ernst-DieterMay 24, 2019 at 7:26 am #101524
I don’t believe so. I think the “big boy” gcode interpreters like LinuxCNC can run gcode with variables and even procedures.
An alternative for you might be to implement a templating system using something like ruby and erb.
(I’m sure there are other templating systems, thats just one that came to mind that I’ve used in the past)May 24, 2019 at 8:10 am #101528
no, it can’t calculate
it only supports 5 slots for gcode macros
/** * G-code Macros * * Add G-codes M810-M819 to define and run G-code macros. * Macros are not saved to EEPROM. */ //#define GCODE_MACROS #if ENABLED(GCODE_MACROS) #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro #endif
1 user thanked author for this post.May 25, 2019 at 4:30 am #101581
Thanks for the macro hint!
Can you give me an example how to do something useful with these macros … sorry I am a newbie with gcode programming…May 25, 2019 at 8:32 am #101589
Honestly i haven’t obvious use case for those macros. May be it’s some case when you need a sequence of commands that you can change without regenerate main gcode file used in this fileMay 25, 2019 at 8:58 am #101590
You must be logged in to reply to this topic.