v1.1c: New sleep mode. Laser mode and other bug fixes.

- New $SLP sleep mode that will disable spindle, coolant, and stepper
enable pins. Allows users to disable their steppers without having to
alter their settings. A reset is required to exit and re-initializes in
alarm state.

- Laser mode wasn’t updating the spindle PWM correctly (effected
spindle speed overrides) and not checking for modal states either.
Fixed both issues.

- While in laser mode, parking motions are ignored, since the power off
delay with the retract motion would burn the material. It will just
turn off and not move. A restore immediately powers up and resumes. No
delays.

- Changing rpm max and min settings did not update the spindle PWM
calculations. Now fixed.

- Increased default planner buffer from 16 to 17 block. It seems to be
stable, but need to monitor this carefully.

- Removed software debounce routine for limit pins. Obsolete.

- Fixed a couple parking motion bugs. One related to restoring
incorrectly and the other the parking rate wasn’t compatible with the
planner structs.

- Fixed a bug caused by refactoring the critical alarms in a recent
push. Soft limits weren’t invoking a critical alarm.

- Updated the documentation with the new sleep feature and added some
more details to the change summary.
This commit is contained in:
Sonny Jeon
2016-10-11 17:07:44 -06:00
parent e2e2bb5242
commit d1037268c8
20 changed files with 176 additions and 202 deletions

View File

@ -25,7 +25,7 @@
#ifdef SPINDLE_MINIMUM_PWM
#define SPINDLE_PWM_MIN_VALUE SPINDLE_MINIMUM_PWM
#else
#define SPINDLE_PWM_MIN_VALUE 0
#define SPINDLE_PWM_MIN_VALUE 0.0
#endif
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
@ -63,7 +63,8 @@ void spindle_init()
}
// Stop and start spindle routines. Called by all spindle routines and stepper ISR.
// Stop and start spindle routines. Called by all spindle routines and various interrupts.
// Keep routine small, fast, and efficient.
void spindle_stop()
{
// On the Uno, spindle enable and PWM are shared. Other CPUs have seperate enable pin.
@ -87,6 +88,7 @@ void spindle_stop()
#ifdef VARIABLE_SPINDLE
// Called by spindle state functions and stepper ISR. Keep routine small, fast, and efficient.
void spindle_set_speed(uint8_t pwm_value)
{
if (pwm_value == SPINDLE_PWM_OFF_VALUE) {
@ -102,15 +104,15 @@ void spindle_stop()
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT);
#endif
#endif
}
}
// Called by spindle state functions and step segment generator.
uint8_t spindle_compute_pwm_value(float rpm) // 328p PWM register is 8-bit.
{
// Calculate PWM register value based on rpm max/min settings and programmed rpm.
if ((settings.rpm_min >= settings.rpm_max) || (rpm > settings.rpm_max)) {
if ((settings.rpm_min >= settings.rpm_max) || (rpm >= settings.rpm_max)) {
// No PWM range possible. Set simple on/off spindle control pin state.
return(SPINDLE_PWM_MAX_VALUE);
} else if (rpm < settings.rpm_min) {