Untested! Soft limits, max travel, homing changes, new settings.
- WARNING: Completely untested. Will later when there is time. Settings WILL be overwritten, as there are new settings. - Soft limits installed. Homing must be enabled for soft limits to work correctly. Errors out much like a hard limit, locking out everything and bringing up the alarm mode. Only difference is it forces a feed hold before doing so. Position is not lost. - IMPORTANT: Homing had to be updated so that soft limits work better with less CPU overhead. When homing completes, all axes are assumed to exist in negative space. If your limit switch is other side, the homing cycle with set this axis location to the max travel value, rather than zero. - Update mc_line() to accept an array, rather than individual variables. - Added an mc_auto_cycle_start() function handle this feature. Organization only. -
This commit is contained in:
49
settings.c
49
settings.c
@@ -3,7 +3,7 @@
|
||||
Part of Grbl
|
||||
|
||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||
Copyright (c) 2011-2012 Sungeun K. Jeon
|
||||
Copyright (c) 2011-2013 Sungeun K. Jeon
|
||||
|
||||
Grbl is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -88,6 +88,7 @@ void settings_reset(bool reset_all) {
|
||||
if (DEFAULT_REPORT_INCHES) { settings.flags |= BITFLAG_REPORT_INCHES; }
|
||||
if (DEFAULT_AUTO_START) { settings.flags |= BITFLAG_AUTO_START; }
|
||||
if (DEFAULT_INVERT_ST_ENABLE) { settings.flags |= BITFLAG_INVERT_ST_ENABLE; }
|
||||
if (DEFAULT_SOFT_LIMIT_ENABLE) { settings.flags |= BITFLAG_SOFT_LIMIT_ENABLE; }
|
||||
if (DEFAULT_HARD_LIMIT_ENABLE) { settings.flags |= BITFLAG_HARD_LIMIT_ENABLE; }
|
||||
if (DEFAULT_HOMING_ENABLE) { settings.flags |= BITFLAG_HOMING_ENABLE; }
|
||||
settings.homing_dir_mask = DEFAULT_HOMING_DIR_MASK;
|
||||
@@ -97,6 +98,9 @@ void settings_reset(bool reset_all) {
|
||||
settings.homing_pulloff = DEFAULT_HOMING_PULLOFF;
|
||||
settings.stepper_idle_lock_time = DEFAULT_STEPPER_IDLE_LOCK_TIME;
|
||||
settings.decimal_places = DEFAULT_DECIMAL_PLACES;
|
||||
settings.max_travel[X_AXIS] = DEFAULT_X_MAX_TRAVEL;
|
||||
settings.max_travel[Y_AXIS] = DEFAULT_Y_MAX_TRAVEL;
|
||||
settings.max_travel[Z_AXIS] = DEFAULT_Z_MAX_TRAVEL;
|
||||
write_global_settings();
|
||||
}
|
||||
|
||||
@@ -165,41 +169,50 @@ uint8_t settings_store_global_setting(int parameter, float value) {
|
||||
case 6: settings.acceleration[X_AXIS] = value*60*60; break; // Convert to mm/min^2 for grbl internal use.
|
||||
case 7: settings.acceleration[Y_AXIS] = value*60*60; break; // Convert to mm/min^2 for grbl internal use.
|
||||
case 8: settings.acceleration[Z_AXIS] = value*60*60; break; // Convert to mm/min^2 for grbl internal use.
|
||||
case 9:
|
||||
case 9: settings.max_travel[X_AXIS] = value; break;
|
||||
case 10: settings.max_travel[Y_AXIS] = value; break;
|
||||
case 11: settings.max_travel[Z_AXIS] = value; break;
|
||||
case 12:
|
||||
if (value < 3) { return(STATUS_SETTING_STEP_PULSE_MIN); }
|
||||
settings.pulse_microseconds = round(value); break;
|
||||
case 10: settings.default_feed_rate = value; break;
|
||||
case 11: settings.invert_mask = trunc(value); break;
|
||||
case 12: settings.stepper_idle_lock_time = round(value); break;
|
||||
case 13: settings.junction_deviation = fabs(value); break;
|
||||
case 14: settings.arc_tolerance = value; break;
|
||||
case 15: settings.decimal_places = round(value); break;
|
||||
case 16:
|
||||
case 13: settings.default_feed_rate = value; break;
|
||||
case 14: settings.invert_mask = trunc(value); break;
|
||||
case 15: settings.stepper_idle_lock_time = round(value); break;
|
||||
case 16: settings.junction_deviation = fabs(value); break;
|
||||
case 17: settings.arc_tolerance = value; break;
|
||||
case 18: settings.decimal_places = round(value); break;
|
||||
case 19:
|
||||
if (value) { settings.flags |= BITFLAG_REPORT_INCHES; }
|
||||
else { settings.flags &= ~BITFLAG_REPORT_INCHES; }
|
||||
break;
|
||||
case 17: // Reset to ensure change. Immediate re-init may cause problems.
|
||||
case 20: // Reset to ensure change. Immediate re-init may cause problems.
|
||||
if (value) { settings.flags |= BITFLAG_AUTO_START; }
|
||||
else { settings.flags &= ~BITFLAG_AUTO_START; }
|
||||
break;
|
||||
case 18: // Reset to ensure change. Immediate re-init may cause problems.
|
||||
case 21: // Reset to ensure change. Immediate re-init may cause problems.
|
||||
if (value) { settings.flags |= BITFLAG_INVERT_ST_ENABLE; }
|
||||
else { settings.flags &= ~BITFLAG_INVERT_ST_ENABLE; }
|
||||
break;
|
||||
case 19:
|
||||
case 22:
|
||||
if (value) {
|
||||
if (bit_isfalse(settings.flags, BITFLAG_HOMING_ENABLE)) { return(STATUS_SOFT_LIMIT_ERROR); }
|
||||
settings.flags |= BITFLAG_SOFT_LIMIT_ENABLE;
|
||||
} else { settings.flags &= ~BITFLAG_SOFT_LIMIT_ENABLE; }
|
||||
break;
|
||||
case 23:
|
||||
if (value) { settings.flags |= BITFLAG_HARD_LIMIT_ENABLE; }
|
||||
else { settings.flags &= ~BITFLAG_HARD_LIMIT_ENABLE; }
|
||||
limits_init(); // Re-init to immediately change. NOTE: Nice to have but could be problematic later.
|
||||
break;
|
||||
case 20:
|
||||
case 24:
|
||||
if (value) { settings.flags |= BITFLAG_HOMING_ENABLE; }
|
||||
else { settings.flags &= ~BITFLAG_HOMING_ENABLE; }
|
||||
break;
|
||||
case 21: settings.homing_dir_mask = trunc(value); break;
|
||||
case 22: settings.homing_feed_rate = value; break;
|
||||
case 23: settings.homing_seek_rate = value; break;
|
||||
case 24: settings.homing_debounce_delay = round(value); break;
|
||||
case 25: settings.homing_pulloff = value; break;
|
||||
case 25: settings.homing_dir_mask = trunc(value); break;
|
||||
case 26: settings.homing_feed_rate = value; break;
|
||||
case 27: settings.homing_seek_rate = value; break;
|
||||
case 28: settings.homing_debounce_delay = round(value); break;
|
||||
case 29: settings.homing_pulloff = value; break;
|
||||
default:
|
||||
return(STATUS_INVALID_STATEMENT);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user