Merge branch 'master' into more-axis
This commit is contained in:
@ -214,7 +214,10 @@ void report_grbl_settings() {
|
||||
#else
|
||||
report_util_uint8_setting(32,0);
|
||||
#endif
|
||||
report_util_uint32_setting(33,settings.spindle_pwm_freq);
|
||||
report_util_float_setting(33,settings.spindle_pwm_freq,N_DECIMAL_SETTINGVALUE);
|
||||
report_util_float_setting(34,settings.spindle_pwm_off_value,N_DECIMAL_SETTINGVALUE);
|
||||
report_util_float_setting(35,settings.spindle_pwm_min_value,N_DECIMAL_SETTINGVALUE);
|
||||
report_util_float_setting(36,settings.spindle_pwm_max_value,N_DECIMAL_SETTINGVALUE);
|
||||
// Print axis settings
|
||||
uint8_t idx, set_idx;
|
||||
uint8_t val = AXIS_SETTINGS_START_VAL;
|
||||
|
@ -337,6 +337,9 @@ uint8_t settings_store_global_setting(uint8_t parameter, float value) {
|
||||
#endif
|
||||
break;
|
||||
case 33: settings.spindle_pwm_freq = value; spindle_init(); break; // Re-initialize spindle pwm calibration
|
||||
case 34: settings.spindle_pwm_off_value = value; spindle_init(); break; // Re-initialize spindle pwm calibration
|
||||
case 35: settings.spindle_pwm_min_value = value; spindle_init(); break; // Re-initialize spindle pwm calibration
|
||||
case 36: settings.spindle_pwm_max_value = value; spindle_init(); break; // Re-initialize spindle pwm calibration
|
||||
default:
|
||||
return(STATUS_INVALID_STATEMENT);
|
||||
}
|
||||
|
@ -92,10 +92,10 @@ typedef struct {
|
||||
float junction_deviation;
|
||||
float arc_tolerance;
|
||||
|
||||
float spindle_pwm_freq;
|
||||
float spindle_pwm_freq; // Hz
|
||||
float spindle_pwm_off_value; // Percent
|
||||
float spindle_pwm_min_value; // Percent
|
||||
float spindle_pwm_max_value; // Percent
|
||||
float spindle_pwm_max_value; // Percent
|
||||
float rpm_max;
|
||||
float rpm_min;
|
||||
|
||||
|
@ -142,21 +142,21 @@ void spindle_stop()
|
||||
rpm *= (0.010*sys.spindle_speed_ovr); // Scale by spindle speed override value.
|
||||
if (rpm <= 0) {
|
||||
sys.spindle_speed = 0;
|
||||
pwm_value = spindle_pwm_off_value; //SPINDLE_PWM_OFF_VALUE
|
||||
pwm_value = spindle_pwm_off_value;
|
||||
}
|
||||
else if (rpm <= settings.rpm_min) {
|
||||
sys.spindle_speed = settings.rpm_min;
|
||||
pwm_value = spindle_pwm_min_value; //SPINDLE_PWM_MIN_VALUE
|
||||
pwm_value = spindle_pwm_min_value;
|
||||
}
|
||||
else if (rpm >= settings.rpm_max) {
|
||||
sys.spindle_speed = settings.rpm_max;
|
||||
pwm_value = spindle_pwm_max_value - 1; //SPINDLE_PWM_MAX_VALUE
|
||||
pwm_value = spindle_pwm_max_value - 1;
|
||||
}
|
||||
else {
|
||||
sys.spindle_speed = rpm;
|
||||
pwm_value = floor((rpm - settings.rpm_min) * pwm_gradient) + spindle_pwm_min_value; //SPINDLE_PWM_MIN_VALUE
|
||||
if(pwm_value >= spindle_pwm_max_value) //SPINDLE_PWM_MAX_VALUE
|
||||
pwm_value = spindle_pwm_max_value - 1; //SPINDLE_PWM_MAX_VALUE
|
||||
pwm_value = floor((rpm - settings.rpm_min) * pwm_gradient) + spindle_pwm_min_value;
|
||||
if(pwm_value >= spindle_pwm_max_value)
|
||||
pwm_value = spindle_pwm_max_value - 1;
|
||||
}
|
||||
return(pwm_value);
|
||||
}
|
||||
|
@ -40,6 +40,10 @@ uint8_t spindle_get_state();
|
||||
// Immediately sets spindle running state with direction and spindle rpm via PWM, if enabled.
|
||||
// Called by spindle_sync() after sync and parking motion/spindle stop override during restore.
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
extern float spindle_pwm_period;
|
||||
extern float spindle_pwm_off_value;
|
||||
extern float spindle_pwm_min_value;
|
||||
extern float spindle_pwm_max_value;
|
||||
|
||||
// Called by g-code parser when setting spindle state and requires a buffer sync.
|
||||
void spindle_sync(uint8_t state, float rpm);
|
||||
|
Reference in New Issue
Block a user