Mode (CNC, Laser, FFF) state in Object Model
-
Hiya - I wanted to ask if the object model includes modes such as CNC, Laser, FFF and if it is possible to add variable ones (such as drawings mode and tangential knife mode). I'd like to add something to the demon.g or start.g files which changes how the machine behaves when in different modes.
Thanks, Savvas
-
@educatingsavvas Those values are predefined by the firmware. Certain codes do behave differently per selected mode so it wouldn't be very trivial to add new ones. However, with 3.3(-RC3) you could probably introduce a global variable and make your own DWC fork that displays it instead of the selected mode.
-
Thanks @chrishamm - do you know if there are any guides about using global variable? I guess for now I could write something like:
while state.machinemode.cnc
to define behaviour. Of I could base this on the tool number which would make it a lot simpler. For example I have relays which power a dust extractor that only need to run when tool 1 (spindle) is used for a job and should stop when using tool 2 (drawings tool) is selected.
while state.currentTool.0
-
@educatingsavvas
Couldn't you just put the code to turn them on and off in the tool change macros?
Tpre.g and Tfree.g
https://duet3d.dozuki.com/Wiki/ConfiguringRepRapFirmwareCartesianPrinter#Section_Tool_change_files -
@owend
I want to try avoid duplicated code so I've created a series of conditions and this is the one to control the relays - at the moment I call the file into start.g with M98. M10.g and M9.g have the relevant M42 command.if state.status == "processing" | state.status == "starting" | state.status == "resuming" M10 G4 P2000 M7 else state.status == "paused" | state.status == "idle" M9 M11
I think adding a while state.currentTool before this should work. I'll experiment after work...
-
@educatingsavvas See https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands#Section_Variables. Note that you need v3.3(-RC3) or newer if you are using your board in SBC mode.