New alarm method. Re(re)organized status messages.
- Installed a new 'alarm' method to centralize motion kills across alarm or reset events. Right now, this is controlled by system abort and hard limits. But, in the future, a g-code parser error may call this too as a safety feature. - Re(re)organized status messages to just print all errors, regardless from where it was called. This centralizes them into one place. - Misc messages method installed for any user feedback that is not a confirmation or error. Mainly so that there is a place to perform warnings and such. - New stuff installed and still made the flash size smaller by saving flash space from clearing out repeated '\r\n' pgmstrings. - Fixed a bug where hard limits message would print everytime a system abort was sent.
This commit is contained in:
@ -25,6 +25,8 @@
|
||||
#include "config.h"
|
||||
#include "gcode.h"
|
||||
#include "motion_control.h"
|
||||
#include "spindle_control.h"
|
||||
#include "coolant_control.h"
|
||||
#include <util/delay.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
@ -223,3 +225,24 @@ void mc_go_home()
|
||||
PCICR |= (1 << LIMIT_INT); // Re-enable hard limits.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Method to immediately kill all motion and set system alarm. Used by system abort, hard limits,
|
||||
// and upon g-code parser error (when installed).
|
||||
void mc_alarm()
|
||||
{
|
||||
// Only this function can set the system alarm. This is done to prevent multiple kill calls
|
||||
// by different processes.
|
||||
if (bit_isfalse(sys.execute, EXEC_ALARM)) {
|
||||
sys.execute |= EXEC_ALARM; // Set alarm to allow subsystem disable for certain settings.
|
||||
sys.auto_start = false; // Disable auto cycle start.
|
||||
|
||||
// TODO: When Grbl system status is installed, set position lost state if the cycle is active.
|
||||
// if (sys.cycle_start) { POSITION LOST }
|
||||
|
||||
// Immediately force stepper, spindle, and coolant to stop.
|
||||
st_go_idle();
|
||||
spindle_stop();
|
||||
coolant_stop();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user