Spindle speed overrides behavior tweak. New experimental laser dynamic power mode.

- Spindle speed overrides now update immediately if they are changed
while in a HOLD state. Previously, they would update after exiting the
HOLD, which isn’t correct.

- New experimental dynamic laser power mode that adjusts laser power
based on current machine speed. Enabled by uncommenting
LASER_CONSTANT_POWER_PER_RATE in config.h

  - It assumes the programmed rate is the intended power/rate for the
motion.
  - Feed rate overrides (FRO) do not effect the power/rate. Meaning
that spindle PWM will automatically lower with lower FRO and increase
with higher FRO to keep it the same.
  - Spindle speed overrides (SSO) will directly increase and decrease
the power/rate. So 150% SSO will increase the PWM output by 150% for
the same speed.
  - The combination of FRO and SSO behaviors should allow for subtle
and highly flexible tuning of how the laser cutter is operating in
real-time and during the job.

- Re-factored planner block rapid rate handling for the dynamic laser
power feature. Should have had no effect on how Grbl operates.
This commit is contained in:
Sonny Jeon 2016-10-27 09:11:59 -06:00
parent cb916a996a
commit e8b717604b
8 changed files with 108 additions and 50 deletions

View file

@ -154,7 +154,7 @@ void spindle_stop()
// Compute intermediate PWM value with linear spindle speed model.
// NOTE: A nonlinear model could be installed here, if required, but keep it light-weight.
sys.spindle_speed = rpm;
pwm_value = floor( (rpm-settings.rpm_min)*pwm_gradient + (SPINDLE_PWM_MIN_VALUE+0.5));
pwm_value = floor( (rpm-settings.rpm_min)*pwm_gradient + (SPINDLE_PWM_MIN_VALUE+0.5) );
}
return(pwm_value);
}
@ -189,6 +189,10 @@ void spindle_stop()
#endif
#ifdef VARIABLE_SPINDLE
#ifdef LASER_CONSTANT_POWER_PER_RATE
// NOTE: Assumes all calls to this function is when Grbl is not moving or must remain off.
if (settings.flags & BITFLAG_LASER_MODE) { rpm = 0.0; } // TODO: May need to be rpm_min*(100/MAX_SPINDLE_SPEED_OVERRIDE);
#endif
spindle_set_speed(spindle_compute_pwm_value(rpm));
#else
// NOTE: Without variable spindle, the enable bit should just turn on or off, regardless