Well I thought I'd have a go at a G96 Constant Surface Speed Macro to control the spindle speed relative to the Z axis DRO position.
First Disclaimer: I've not tried this on a machine hooked up to UCCNC as I've not got a spindle I can test it on at present. It would be nice for someone to give it a go and test it for me (some brave sole. Note all it will do is change the spindle speed relative to the X axis position. if the x axis is at zero or less than zero DRO work co-ordinate position the spindle will either run at the highest calculated spindle speed rpm at the smallest possible X axis DRO position or at the maximum spindle speed you set via M751 OR the maximum spindle speed of the machine set within the UCCNC configuration settings (whichever is the lower number).
Firstly you will need to load the M750 macro as a macroloop
This macroloop basically checks to see if you have set the relevant parameters via the M751 macro, and if so, it calculates & sets the corrected spindle speed within the parameters you've set via M751 and also checks your current spindle speed min and max RPM settings (so that these are not exceeded either).
M751 {Dxxxx, Exxxx} sets your maximum spindle rpm (Dvar) and sets your Spindle Surface Speed in UNITS per min (note this is not feet or meters per min!!!, so if you desire 200 meters / min surface speed, set E200000, sorry I could not come up with a way to know if the machine was in metric or imperial, hence followed the standard that the machine is just set in "units"
M752 clears M751 settings and resets the spindle speed either back to the original setting before M751 was set OR if a spindle speed g-code command was received whilst the M751 macro was active it will correct to this spindle speed setting.
NOTE: if you send a Gcode command with a Spindle speed it will be written to the spindle speed setting DRO and corrected after 50mSec with the M751 setting, hence if you did issue a spindle speed setting correction incorretly from within a gcode command the spindle would try to speed up or slow down before being corrected by the still active M751 macro.
The correct way to correct for a change in max RPM or Surface speed during an active M751 macro will be to issue a revised M751 macro.
If you issue an M751 macro without EITHER the D or E vars then the macro will be ignored.
I am going to create a screenset button macro which will ask for E + D and toggle the Constant Surface Speed Macroloop on and off, but not started that yet really.
Its not listed as a working macro yet within the toolbox thread because I need a brave sole to test it please.
idea came from here as far as M751 {Dxxx,Exxx} format (S is not available as a macro var in uccnc)
http://linuxcnc.org/docs/html/gcode/g-c ... de:g96-g97