1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-03 03:13:25 +02:00

Moved a few more defines to the machine config.

This commit is contained in:
Stefan de Bruijn
2021-06-19 22:18:05 +02:00
parent 2a98fc0655
commit 9e44b3e895
7 changed files with 38 additions and 34 deletions

View File

@@ -130,14 +130,6 @@ static const uint8_t NHomingLocateCycle = 1; // Integer (1-128)
// NOTE: Must be an integer value from 0 to ~4. More than 4 may exhibit round-off errors.
// ESP32 Note: These are mostly hard coded, so these values will not change anything
// If your machine has two limits switches wired in parallel to one axis, you will need to enable
// this feature. Since the two switches are sharing a single pin, there is no way for Grbl to tell
// which one is enabled. This option only effects homing, where if a limit is engaged, Grbl will
// alarm out and force the user to manually disengage the limit switch. Otherwise, if you have one
// limit switch for each axis, don't enable this option. By keeping it disabled, you can perform a
// homing cycle while on the limit switch and not have to move the machine off of it.
// #define LIMITS_TWO_SWITCHES_ON_AXES
// Allows GRBL to track and report gcode line numbers. Enabling this means that the planning buffer
// goes from 16 to 15 to make room for the additional line number data in the plan_block_t struct
// #define USE_LINE_NUMBERS // Disabled by default. Uncomment to enable.
@@ -162,12 +154,6 @@ static const uint8_t NHomingLocateCycle = 1; // Integer (1-128)
// OEMs and LinuxCNC users that would like this power-cycle behavior.
// #define FORCE_INITIALIZATION_ALARM // Default disabled. Uncomment to enable.
// At power-up or a reset, Grbl will check the limit switch states to ensure they are not active
// before initialization. If it detects a problem and the hard limits setting is enabled, Grbl will
// simply message the user to check the limits and enter an alarm state, rather than idle. Grbl will
// not throw an alarm message.
#define CHECK_LIMITS_AT_INIT
// ---------------------------------------------------------------------------------------
// ADVANCED CONFIGURATION OPTIONS:

View File

@@ -419,6 +419,9 @@ void MachineConfig::group(Configuration::HandlerBase& handler) {
handler.item("homing_init_lock", _homingInitLock);
handler.item("enable_parking_override_control", _enableParkingOverrideControl);
handler.item("deactivate_parking_upon_init", _deactivateParkingUponInit);
handler.item("check_limits_at_init", _checkLimitsAtInit);
handler.item("homing_single_axis_commands", _homingSingleAxisCommands);
handler.item("limits_two_switches_on_axis", _limitsTwoSwitchesOnAxis);
Spindles::SpindleFactory::factory(handler, _spindle);
}

View File

@@ -364,6 +364,21 @@ public:
bool _enableParkingOverrideControl = false;
bool _deactivateParkingUponInit = false;
bool _homingSingleAxisCommands = false;
// At power-up or a reset, Grbl will check the limit switch states to ensure they are not active
// before initialization. If it detects a problem and the hard limits setting is enabled, Grbl will
// simply message the user to check the limits and enter an alarm state, rather than idle. Grbl will
// not throw an alarm message.
bool _checkLimitsAtInit = true;
// If your machine has two limits switches wired in parallel to one axis, you will need to enable
// this feature. Since the two switches are sharing a single pin, there is no way for Grbl to tell
// which one is enabled. This option only effects homing, where if a limit is engaged, Grbl will
// alarm out and force the user to manually disengage the limit switch. Otherwise, if you have one
// limit switch for each axis, don't enable this option. By keeping it disabled, you can perform a
// homing cycle while on the limit switch and not have to move the machine off of it.
bool _limitsTwoSwitchesOnAxis = false;
String _board = "None";
String _name = "None";

View File

@@ -343,13 +343,12 @@ void mc_homing_cycle(AxisMask axis_mask) {
// Check and abort homing cycle, if hard limits are already enabled. Helps prevent problems
// with machines with limits wired on both ends of travel to one limit pin.
// TODO: Move the pin-specific LIMIT_PIN call to Limits.cpp as a function.
#ifdef LIMITS_TWO_SWITCHES_ON_AXES
if (limits_get_state()) {
if (config->_limitsTwoSwitchesOnAxis && limits_get_state()) {
mc_reset(); // Issue system reset and ensure spindle and coolant are shutdown.
sys_rt_exec_alarm = ExecAlarm::HardLimit;
return;
}
#endif
limits_disable(); // Disable hard limits pin change register for cycle duration
// -------------------------------------------------------------------------------------
// Perform homing routine. NOTE: Special motion case. Only system reset works.

View File

@@ -490,14 +490,15 @@ void make_grbl_commands() {
new GrblCommand("H", "Home", home_all, idleOrAlarm);
new GrblCommand("MD", "Motor/Disable", motor_disable, idleOrAlarm);
#ifdef HOMING_SINGLE_AXIS_COMMANDS
new GrblCommand("HX", "Home/X", home_x, idleOrAlarm);
new GrblCommand("HY", "Home/Y", home_y, idleOrAlarm);
new GrblCommand("HZ", "Home/Z", home_z, idleOrAlarm);
new GrblCommand("HA", "Home/A", home_a, idleOrAlarm);
new GrblCommand("HB", "Home/B", home_b, idleOrAlarm);
new GrblCommand("HC", "Home/C", home_c, idleOrAlarm);
#endif
if (config->_homingSingleAxisCommands) {
new GrblCommand("HX", "Home/X", home_x, idleOrAlarm);
new GrblCommand("HY", "Home/Y", home_y, idleOrAlarm);
new GrblCommand("HZ", "Home/Z", home_z, idleOrAlarm);
new GrblCommand("HA", "Home/A", home_a, idleOrAlarm);
new GrblCommand("HB", "Home/B", home_b, idleOrAlarm);
new GrblCommand("HC", "Home/C", home_c, idleOrAlarm);
}
new GrblCommand("SLP", "System/Sleep", sleep_grbl, idleOrAlarm);
new GrblCommand("I", "Build/Info", get_report_build_info, idleOrAlarm);
new GrblCommand("N", "GCode/StartupLines", report_startup_lines, idleOrAlarm);

View File

@@ -125,15 +125,15 @@ void protocol_main_loop() {
client_reset_read_buffer(CLIENT_ALL);
empty_lines();
//uint8_t client = CLIENT_SERIAL; // default client
// Perform some machine checks to make sure everything is good to go.
#ifdef CHECK_LIMITS_AT_INIT
if (config->_axes->hasHardLimits()) {
if (config->_checkLimitsAtInit && config->_axes->hasHardLimits()) {
if (limits_get_state()) {
sys.state = State::Alarm; // Ensure alarm state is active.
report_feedback_message(Message::CheckLimits);
}
}
#endif
// Check for and report alarm state after a reset, error, or an initial power up.
// NOTE: Sleep mode disables the stepper drivers and position can't be guaranteed.
// Re-initialize the sleep state as an ALARM mode to ensure user homes or acknowledges.

View File

@@ -534,12 +534,12 @@ void report_build_info(const char* line, uint8_t client) {
grbl_send(client, "M"); // TODO Need to deal with M8...it could be disabled
}
grbl_send(client, "P");
#ifdef HOMING_SINGLE_AXIS_COMMANDS
grbl_send(client, "H");
#endif
#ifdef LIMITS_TWO_SWITCHES_ON_AXES
grbl_send(client, "L");
#endif
if (config->_homingSingleAxisCommands) {
grbl_send(client, "H");
}
if (config->_limitsTwoSwitchesOnAxis) {
grbl_send(client, "L");
}
#ifdef ALLOW_FEED_OVERRIDE_DURING_PROBE_CYCLES
grbl_send(client, "A");
#endif