The post process, I see “M84 S12000”. But my spindle is controlled with PWM, 0-255, where 255 is around 12000 RPM. I could put the spindle speed in Fusion to 255, but that would mess up the feed calculations.
Is this something tackled in the Marlin firmware perhaps where I say 12,000 RPM translates to a value of 255 PWM? I have not seen anything in guffy’s post processor.
I don’t personally have a spindle, but I have a guess on how this works based on the comments in the configuration_Adv.h file. First there is this section:
/**
* Speed / Power can be set ('M3 S') and displayed in terms of:
* - PWM255 (S0 - S255)
* - PERCENT (S0 - S100)
* - RPM (S0 - S50000) Best for use with a spindle
*/
#define CUTTER_POWER_UNIT PWM255
This implies to me that you select one of three ways that the S parameter can be interpreted at the time you compile Marlin. The above code is pulled from the V1 maintained Rambo firmware, so in that particular version, the S parameter is expected in the range of 0 to 255. If all you have is a spindle, my guess is that you would want to change the line to:
#define CUTTER_POWER_UNIT RPM
A bit below this define, there are two other defines that may play a role in how the RPM parameter is intrepreted:
My guess is that Marlin uses these to map the spindle speed into the PWM value output on the pin. Any ‘S’ value below 5000 in the g-code gets mapped to 0, and any ‘S’ value a above 30000 gets mapped to 255.
There have been recent posts in the forums that @tjones99 found a bug in the RPM method. Check the Control Spindle RPM through RAMPS topic for the gory details. I don’t know whether the fix he describes has been incorporated into the Marlin codebase yet.
Thanks for the plug, but can’t take credit for that, @tjones99 found and fixed it. My thread is more about the hardware of connecting the RAMPS to the spindle’s PSU.