Spindle inactive on resume
-
My spindle does not turn on when a job is resumed from powerloss. Pausing and resuming a job without turning off power works fine. But if the controller is reset (from an emergency stop) or turned off (to continue the job at a later time), the spindle does not turn on. Is there a workaround for this?
config-spindle.g
M950 R0 C"!exp.heater6+!exp.heater7" Q100 L1000:20000 ; Spindle settings ; Tools M563 P1 R0 S"DeWalt" T1
Resume.g
M98 P"homez.g" M3 ; Turn on Spindle Relay G4 S2; Dwell for 2 seconds G1 R1 X0 Y0 ; go to directly above position of the last print move G1 R1 X0 Y0 Z0 ; go back to the last print move
Resurrect-prologue.g
; resurrect-prologue.g ; called to resume job after power out. M98 P"homeall.g" G1 R1 X0 Y0 ; go directly above the saved position M3 G4 S2; Dwell for 2 seconds
Resurrect.g
; File "0:/gcodes/Ibra/Alucoboard.gcode" resume print after print paused at 2022-11-19 18:24 G21 G92 X267.659 Y353.891 Z30.800 G60 S1 T1 P0 M98 P"resurrect-prologue.g" M116 M290 X0.000 Y0.000 Z0.000 R0 T-1 P0 T1 P6 ; Workplace coordinates G10 L2 P1 X181.00 Y82.00 Z34.00 G10 L2 P2 X258.00 Y313.00 Z29.28 G10 L2 P3 X540.00 Y32.00 Z35.00 G10 L2 P4 X268.00 Y723.00 Z59.00 G10 L2 P5 X710.00 Y1170.00 Z94.00 G10 L2 P6 X0.00 Y0.00 Z64.00 G10 L2 P7 X0.00 Y0.00 Z90.00 G10 L2 P8 X190.00 Y40.00 Z40.51 G10 L2 P9 X0.00 Y0.00 Z94.00 G54 M106 S0.00 M116 G92 E0.00000 M82 M486 S-1 G17 M23 "0:/gcodes/Ibra/Alucoboard.gcode" M26 S32601 P0.143 X281.212 Y353.418 G0 F6000 Z32.800 G0 F6000 X267.659 Y353.891 G0 F6000 Z30.800 G1 F800.0 P0 G21 M24
-
I think there is an issue with the way in which the power-loss function works (or doesn't) with a CNC machine.
I asked a similar question is this thread, but never really got a definitive response. My understanding is the power drain from a CNC is much quicker than that from a 3D printer, thereby preventing the information required to resume the CNC from being saved in the appropriate file (can't think, it's been a long day). What I was specifically trying to achieve was for the spindle speed to be 'remembered', which clearly isn't necessary for a 3D printer.
I tried (with a lot of help) to get around this, but I couldn't get all the necessary information written into the resume file for it to be effective, as there wasn't enough time for the lines of code to be written into the file.
I'll show you where I got to, just in case you might be able to expand further on my efforts...
In the config.g file, I specified a variable:
; Variables definition global savedSpindleSpeed = 0
...and defined the M911 line like this:
M911 S23 R23.5 P"M98 P""SaveSpindleSpeed.g""M913 X0 Y0" ; set voltage thresholds and actions to run on power loss
This is the code in the SaveSpindleSpeed.g file, which should write the RestoreSpindleSpeed.g file:
var fName = "RestoreSpindleSpeed.g" echo >{var.fName} "if {!exists(global.abort_process)}" echo >>{var.fName} " global abort_process = true" echo >>{var.fName} "else" echo >>{var.fName} " set global.abort_process = true" echo >>{var.fName} "M291 S3 R""Resurrect:"" P""Continue with <"^{job.file.fileName}^">?""" echo >>{var.fName} "set global.abort_process = false" echo >>{var.fName} "M3 S"^{spindles[0].active}
...but that's it. I don't think we even got as far as the M291 command line before the power had gone.
Having said that, @dc42 did mention they would work to fix this in RRF3.5, so let's hope so!
Sorry I can't help more, but you might glean more information if you look at the thread I linked above. It was a while ago and my memory fades, somewhat!
-
@Nightowl I don't think it has to do with not having enough time to write anything to the SD card as I do a Controlled Power Off. The job is paused, resume state saved and the Duet tells you you can turn it off.
I put an M3 command into the resurrect-prologue.g file hoping this would fix the problem. The spindle turns on and dwells for 2 seconds as programmed but then turns off before it rams the endmill into the part. If I am quick enough I am able to turn it on via the dashboard but this is too risky.
Looking at the resurrect.g file, I think all tools are deselected before the job is resumed.
If I could find a way to reselect the spindle, it should work. -
Firmware version?
-
@Phaedrux 3.4.4
-
@chimaeragh said in Spindle inactive on resume:
@Nightowl I don't think it has to do with not having enough time to write anything to the SD card as I do a Controlled Power Off.
I'm not sure, but wouldn't pausing the process and powering down provide enough time for the resurrect file to be written, rather than an instant(ish) power failure?
Having said that, I think I misread your original post. You appear to want to do this as a matter of routine, for a particularly long job, for example?
-
As a casual CNC user, I wouldn't want my spindle to turn on after power failure. I hope that feature is optional in RRF3.5?
I also have a separate PSU for the spindle and was wondering, if there is a way to have two different power loss command lines? One for Duets power, the other for spindle power.Sorry if that was slightly offtopic, but it got me concerned what I read here.
-
Hopefully it won't, @o_lampe
The CNC should stay off without user intervention, as the machine would need to be re-homed on all axes before returning to the last known co-ordinates and restarting the cut.
I don't know about 3D printer users, but I would never leave a CNC unattended when it's working.
-
@chimaeragh I confirm that spindle state and RPM are not saved in resurrect.g. Also the tool select command in resurrect.g that occurs after the command to run resurrect-prologue.g will set the spindle state to stopped, as required by the NIST specification.
I have implemented what I hope is a fix in the RRF 3.5 code. I had to include a fixed delay after the M3 or M4 command, and I chose 2 seconds for this.
Meanwhile, if you want to resurrect a job with the spindle running, you will need to edit the M3 or M4 command and the G4 delay command into resurrect.g after the T command.
-
Thank you, @dc42 (although you didn't need to say it three times )
Thank you too for implementing the changes in 3.5
-
@Nightowl sorry, there was an error message from the forum software that made me think that my first two attempts to post were unsuccessful.
-
@dc42 said in Spindle inactive on resume:
@Nightowl sorry, there was an error message from the forum software that made me think that my first two attempts to post were unsuccessful.
-
@dc42 Thank you