Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update text header in grblUpload.ino #1474

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b3a53a4
v1.0 Beta Release.
chamnit Aug 28, 2015
9152d14
Update README
chamnit Aug 28, 2015
9575199
Optional line number reporting bug fix.
chamnit Aug 29, 2015
965e337
Parking motion bug fix.
chamnit Sep 5, 2015
dade712
Updated G28/G30 intermediate motion behavior.
chamnit Sep 24, 2015
b9c3461
Bug fixes.
chamnit Oct 1, 2015
5eee108
Pin state reporting of all pins. Flash optimization.
chamnit Nov 10, 2015
111d28d
Applied master branch bug fixes.
chamnit Mar 4, 2016
81adc20
Soft limit error bug fix.
chamnit Mar 11, 2016
5bfc3a1
No variable spindle and spindle speed fix.
Mar 19, 2016
ff5f8da
Update README
Mar 19, 2016
061e609
Removed 328p-related code. Enabled options by default.
chamnit Mar 20, 2016
b29b960
EEPROM string checks and re-added some compile options.
Mar 20, 2016
8693534
Sleep feature. General re-org and bug fixes.
Apr 4, 2016
e87f4ea
Update readme and sleep documentation.
chamnit Apr 4, 2016
d5decf8
Alarm and safety door bug fix.
Apr 10, 2016
2b82c42
Planner and printFloat update.
May 11, 2016
be5faf6
Minor bug fix to certain safety conditions.
Sep 1, 2016
5e3048f
Grbl v1.1e port to Mega2560 branch
chamnit Dec 19, 2016
e4dd12f
Spindle PWM update for Mega2560
chamnit Dec 20, 2016
c912b82
Alarm handling bug fix.
chamnit Dec 20, 2016
795d2f6
Pulled in Grbl-328p changes.
chamnit Jan 14, 2017
dd2f156
Update README.md
chamnit Mar 19, 2017
9e96e45
Update README.md
chamnit Mar 19, 2017
e0efa4b
Moved Grbl logo files to separate repo.
chamnit Mar 19, 2017
759ff61
Add Ramps 1.4 Board Support
docwelch Jun 27, 2017
4b8e411
Syncing mainstream v1.1f
chamnit Jul 18, 2017
e16b5fb
Merge branch 'edge' into Ramps-1.4
chamnit Jul 18, 2017
576a72c
Merge pull request #28 from docwelch/Ramps-1.4
chamnit Jul 18, 2017
e321c82
Fixed RAMPS control pin conflict
chamnit Aug 1, 2017
40fd602
Fixed a very rare but critical bug when reducing override rates.
chamnit Aug 2, 2017
68d9152
fixes gremlin where changing stepper direction mask didn't work corre…
bgort Aug 10, 2018
a311e2d
Merge pull request #68 from bgort/gremlinfix
chamnit Aug 10, 2018
0f15e66
Upstream updates. Spindle/coolant rare bug fixes.
chamnit Aug 13, 2018
bc05282
Merge branch 'edge' of https://github.com/gnea/grbl-Mega into edge
chamnit Aug 13, 2018
df87b36
Updated version.
chamnit Aug 13, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Upstream updates. Spindle/coolant rare bug fixes.
[new] Altered the way default settings are stored and restored. Saved about 300 bytes(!) of flashed size. Should free up enough for certain configurations of CoreXY machines.

[fix] When the optional M7 mist coolant IO was enabled, coolant overrides was not disabling correctly.

[fix] Coolant override states was not restored correctly after a parking motion in certain situations. It would restore programmed state, rather than current overridden state.

[fix] Now allow coolant overrides to operate during jogging motion.

[fix] Invert control pin mask typo.

[new] Added a new build info feedback mechanism for enabling the safety door input pin.
  • Loading branch information
chamnit committed Aug 13, 2018
commit 0f15e66cf2949852bba3f5d82bb7a677e1bec78c
1 change: 1 addition & 0 deletions doc/csv/build_option_codes_en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"0","Spindle enable off when speed is zero","Enabled"
"S","Software limit pin debouncing","Enabled"
"R","Parking override control","Enabled"
"+","Safety door input pin","Enabled"
"*","Restore all EEPROM command","Disabled"
"$","Restore EEPROM `$` settings command","Disabled"
"#","Restore EEPROM parameter data command","Disabled"
Expand Down
1 change: 1 addition & 0 deletions doc/markdown/interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ Feedback messages provide non-critical information on what Grbl is doing, what i
| **`S`** | Software limit pin debouncing enabled |
| **`R`** | Parking override control enabled |
| **`A`** | Allow feed rate overrides in probe cycles |
| **`+`** | Safety door input pin enabled |
| **`*`** | Restore all EEPROM disabled |
| **`$`** | Restore EEPROM `$` settings disabled |
| **`#`** | Restore EEPROM parameter data disabled |
Expand Down
6 changes: 3 additions & 3 deletions grbl/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
#define CPU_MAP_2560_INITIAL

// To use with RAMPS 1.4 Board, comment out the above defines and uncomment the next two defines
//#define DEFAULTS_RAMPS_BOARD
//#define CPU_MAP_2560_RAMPS_BOARD
// #define DEFAULTS_RAMPS_BOARD
// #define CPU_MAP_2560_RAMPS_BOARD

// Serial baud rate
// #define BAUD_RATE 230400
Expand Down Expand Up @@ -194,7 +194,7 @@
// NOTE: The top option will mask and invert all control pins. The bottom option is an example of
// inverting only two control pins, the safety door and reset. See cpu_map.h for other bit definitions.
// #define INVERT_CONTROL_PIN_MASK CONTROL_MASK // Default disabled. Uncomment to disable.
// #define INVERT_CONTROL_PIN_MASK ((1<<CONTROL_SAFETY_DOOR_BIT)|(CONTROL_RESET_BIT)) // Default disabled.
// #define INVERT_CONTROL_PIN_MASK ((1<<CONTROL_SAFETY_DOOR_BIT)|(1<<CONTROL_RESET_BIT)) // Default disabled.

// Inverts select limit pin states based on the following mask. This effects all limit pin functions,
// such as hard limits and homing. However, this is different from overall invert limits setting.
Expand Down
49 changes: 27 additions & 22 deletions grbl/coolant_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,29 +76,34 @@ void coolant_set_state(uint8_t mode)
{
if (sys.abort) { return; } // Block during abort.

if (mode == COOLANT_DISABLE) {
if (mode & COOLANT_FLOOD_ENABLE) {
#ifdef INVERT_COOLANT_FLOOD_PIN
COOLANT_FLOOD_PORT &= ~(1 << COOLANT_FLOOD_BIT);
#else
COOLANT_FLOOD_PORT |= (1 << COOLANT_FLOOD_BIT);
#endif
} else {
#ifdef INVERT_COOLANT_FLOOD_PIN
COOLANT_FLOOD_PORT |= (1 << COOLANT_FLOOD_BIT);
#else
COOLANT_FLOOD_PORT &= ~(1 << COOLANT_FLOOD_BIT);
#endif
}

coolant_stop();

} else {

if (mode & COOLANT_FLOOD_ENABLE) {
#ifdef INVERT_COOLANT_FLOOD_PIN
COOLANT_FLOOD_PORT &= ~(1 << COOLANT_FLOOD_BIT);
#else
COOLANT_FLOOD_PORT |= (1 << COOLANT_FLOOD_BIT);
#endif
}

if (mode & COOLANT_MIST_ENABLE) {
#ifdef INVERT_COOLANT_MIST_PIN
COOLANT_MIST_PORT &= ~(1 << COOLANT_MIST_BIT);
#else
COOLANT_MIST_PORT |= (1 << COOLANT_MIST_BIT);
#endif
}

}
if (mode & COOLANT_MIST_ENABLE) {
#ifdef INVERT_COOLANT_MIST_PIN
COOLANT_MIST_PORT &= ~(1 << COOLANT_MIST_BIT);
#else
COOLANT_MIST_PORT |= (1 << COOLANT_MIST_BIT);
#endif
} else {
#ifdef INVERT_COOLANT_MIST_PIN
COOLANT_MIST_PORT |= (1 << COOLANT_MIST_BIT);
#else
COOLANT_MIST_PORT &= ~(1 << COOLANT_MIST_BIT);
#endif
}

sys.report_ovr_counter = 0; // Set to report change immediately
}

Expand Down
4 changes: 2 additions & 2 deletions grbl/coolant_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#define COOLANT_FORCE_SYNC true

#define COOLANT_STATE_DISABLE 0 // Must be zero
#define COOLANT_STATE_FLOOD bit(0)
#define COOLANT_STATE_MIST bit(1)
#define COOLANT_STATE_FLOOD PL_COND_FLAG_COOLANT_FLOOD
#define COOLANT_STATE_MIST PL_COND_FLAG_COOLANT_MIST


// Initializes coolant control pins.
Expand Down
30 changes: 18 additions & 12 deletions grbl/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,15 +453,21 @@
#endif

#ifdef DEFAULTS_RAMPS_BOARD
#define DEFAULT_X_STEPS_PER_MM 80
#define DEFAULT_Y_STEPS_PER_MM 80
#define DEFAULT_Z_STEPS_PER_MM 4000
#define DEFAULT_X_MAX_RATE 18000.0 // mm/min
#define DEFAULT_Y_MAX_RATE 18000.0 // mm/min
#define DEFAULT_Z_MAX_RATE 300.0 // mm/min
#define DEFAULT_X_ACCELERATION 3000
#define DEFAULT_Y_ACCELERATION 3000
#define DEFAULT_Z_ACCELERATION 100
// Generic conservative settings for a RAMP CNC machine. You must update these yourself.
// Keep in mind that Grbl is highly efficient and settings can be significantly different.
// Especially when optimizing for a different CNC task like going from 3d printing to
// CNC milling or laser cutting. Unlike Marlin, these defaults are only applied when the
// EEPROM is explicitly wiped, either by a `$RST=*` command or Grbl detecting a settings
// version type change (not frequent).
#define DEFAULT_X_STEPS_PER_MM 80.0
#define DEFAULT_Y_STEPS_PER_MM 80.0
#define DEFAULT_Z_STEPS_PER_MM 80.0
#define DEFAULT_X_MAX_RATE 2500.0 // mm/min
#define DEFAULT_Y_MAX_RATE 2500.0 // mm/min
#define DEFAULT_Z_MAX_RATE 500.0 // mm/min
#define DEFAULT_X_ACCELERATION (100.0*60.0*60.0) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Y_ACCELERATION (100.0*60.0*60.0) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Z_ACCELERATION (100.0*60.0*60.0) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_X_MAX_TRAVEL 200.0 // mm
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm
#define DEFAULT_Z_MAX_TRAVEL 200.0 // mm
Expand All @@ -477,16 +483,16 @@
#define DEFAULT_REPORT_INCHES 0 // false
#define DEFAULT_INVERT_ST_ENABLE 0 // false
#define DEFAULT_INVERT_LIMIT_PINS 0 // false
#define DEFAULT_SOFT_LIMIT_ENABLE 1 // true
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // true
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
#define DEFAULT_INVERT_PROBE_PIN 0 // false
#define DEFAULT_LASER_MODE 0 // false
#define DEFAULT_HOMING_ENABLE 1 // true
#define DEFAULT_HOMING_ENABLE 0 // true
#define DEFAULT_HOMING_DIR_MASK 0 // move positive dir
#define DEFAULT_HOMING_FEED_RATE 500.0 // mm/min
#define DEFAULT_HOMING_SEEK_RATE 2000.0 // mm/min
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
#define DEFAULT_HOMING_PULLOFF 5.0 // mm
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
#endif

#endif
9 changes: 4 additions & 5 deletions grbl/gcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ uint8_t gc_execute_line(char *line)
case 7: case 8: case 9:
word_bit = MODAL_GROUP_M8;
switch(int_value) {
case 7: gc_block.modal.coolant = COOLANT_MIST_ENABLE; break;
case 8: gc_block.modal.coolant = COOLANT_FLOOD_ENABLE; break;
case 9: gc_block.modal.coolant = COOLANT_DISABLE; break;
case 7: gc_block.modal.coolant |= COOLANT_MIST_ENABLE; break;
case 8: gc_block.modal.coolant |= COOLANT_FLOOD_ENABLE; break;
case 9: gc_block.modal.coolant = COOLANT_DISABLE; break; // M9 disables both M7 and M8.
}
break;
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
Expand Down Expand Up @@ -939,8 +939,7 @@ uint8_t gc_execute_line(char *line)
// NOTE: Coolant M-codes are modal. Only one command per line is allowed. But, multiple states
// can exist at the same time, while coolant disable clears all states.
coolant_sync(gc_block.modal.coolant);
if (gc_block.modal.coolant == COOLANT_DISABLE) { gc_state.modal.coolant = COOLANT_DISABLE; }
else { gc_state.modal.coolant |= gc_block.modal.coolant; }
gc_state.modal.coolant = gc_block.modal.coolant;
}
pl_data->condition |= gc_state.modal.coolant; // Set condition flag for planner use.

Expand Down
2 changes: 1 addition & 1 deletion grbl/grbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

// Grbl versioning system
#define GRBL_VERSION "1.1f"
#define GRBL_VERSION_BUILD "20170802"
#define GRBL_VERSION_BUILD "20180813.Mega"

// Define standard libraries used by Grbl.
#include <avr/io.h>
Expand Down
1 change: 1 addition & 0 deletions grbl/planner.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#define PL_COND_FLAG_COOLANT_FLOOD bit(6)
#define PL_COND_FLAG_COOLANT_MIST bit(7)
#define PL_COND_MOTION_MASK (PL_COND_FLAG_RAPID_MOTION|PL_COND_FLAG_SYSTEM_MOTION|PL_COND_FLAG_NO_FEED_OVERRIDE)
#define PL_COND_SPINDLE_MASK (PL_COND_FLAG_SPINDLE_CW|PL_COND_FLAG_SPINDLE_CCW)
#define PL_COND_ACCESSORY_MASK (PL_COND_FLAG_SPINDLE_CW|PL_COND_FLAG_SPINDLE_CCW|PL_COND_FLAG_COOLANT_FLOOD|PL_COND_FLAG_COOLANT_MIST)


Expand Down
11 changes: 7 additions & 4 deletions grbl/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,10 @@ void protocol_exec_rt_system()
last_s_override = max(last_s_override,MIN_SPINDLE_SPEED_OVERRIDE);

if (last_s_override != sys.spindle_speed_ovr) {
bit_true(sys.step_control, STEP_CONTROL_UPDATE_SPINDLE_PWM);
sys.spindle_speed_ovr = last_s_override;
// NOTE: Spindle speed overrides during HOLD state are taken care of by suspend function.
if (sys.state == STATE_IDLE) { spindle_set_state(gc_state.modal.spindle, gc_state.spindle_speed); }
else { bit_true(sys.step_control, STEP_CONTROL_UPDATE_SPINDLE_PWM); }
sys.report_ovr_counter = 0; // Set to report change immediately
}

Expand All @@ -466,8 +468,9 @@ void protocol_exec_rt_system()

// NOTE: Since coolant state always performs a planner sync whenever it changes, the current
// run state can be determined by checking the parser state.
// NOTE: Coolant overrides only operate during IDLE, CYCLE, HOLD, and JOG states. Ignored otherwise.
if (rt_exec & (EXEC_COOLANT_FLOOD_OVR_TOGGLE | EXEC_COOLANT_MIST_OVR_TOGGLE)) {
if ((sys.state == STATE_IDLE) || (sys.state & (STATE_CYCLE | STATE_HOLD))) {
if ((sys.state == STATE_IDLE) || (sys.state & (STATE_CYCLE | STATE_HOLD | STATE_JOG))) {
uint8_t coolant_state = gc_state.modal.coolant;
if (rt_exec & EXEC_COOLANT_MIST_OVR_TOGGLE) {
if (coolant_state & COOLANT_MIST_ENABLE) { bit_false(coolant_state,COOLANT_MIST_ENABLE); }
Expand Down Expand Up @@ -524,7 +527,7 @@ static void protocol_exec_rt_suspend()
restore_condition = (gc_state.modal.spindle | gc_state.modal.coolant);
restore_spindle_speed = gc_state.spindle_speed;
} else {
restore_condition = block->condition;
restore_condition = (block->condition & PL_COND_SPINDLE_MASK) | coolant_get_state();
restore_spindle_speed = block->spindle_speed;
}
#ifdef DISABLE_LASER_DURING_HOLD
Expand Down Expand Up @@ -673,7 +676,7 @@ static void protocol_exec_rt_suspend()
// Block if safety door re-opened during prior restore actions.
if (bit_isfalse(sys.suspend,SUSPEND_RESTART_RETRACT)) {
// NOTE: Laser mode will honor this delay. An exhaust system is often controlled by this pin.
coolant_set_state((restore_condition & (PL_COND_FLAG_COOLANT_FLOOD | PL_COND_FLAG_COOLANT_FLOOD)));
coolant_set_state((restore_condition & (PL_COND_FLAG_COOLANT_FLOOD | PL_COND_FLAG_COOLANT_MIST)));
delay_sec(SAFETY_DOOR_COOLANT_DELAY, DELAY_MODE_SYS_SUSPEND);
}
}
Expand Down
18 changes: 8 additions & 10 deletions grbl/report.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,10 @@ void report_build_info(char *line)
printString(line);
report_util_feedback_line_feed();
printPgmString(PSTR("[OPT:")); // Generate compile-time build option list
serial_write('V');
serial_write('N');
serial_write('M');
serial_write('V'); // Variable spindle standard.
serial_write('N'); // Line number reporting standard.
serial_write('M'); // M7 mist coolant standard.
serial_write('+'); // Safety door support standard.
#ifdef COREXY
serial_write('C');
#endif
Expand Down Expand Up @@ -395,6 +396,9 @@ void report_build_info(char *line)
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
serial_write('R');
#endif
#ifndef HOMING_INIT_LOCK
serial_write('L');
#endif
#ifndef ENABLE_RESTORE_EEPROM_WIPE_ALL // NOTE: Shown when disabled.
serial_write('*');
#endif
Expand All @@ -413,10 +417,6 @@ void report_build_info(char *line)
#ifndef FORCE_BUFFER_SYNC_DURING_WCO_CHANGE // NOTE: Shown when disabled.
serial_write('W');
#endif
#ifndef HOMING_INIT_LOCK
serial_write('L');
#endif

// NOTE: Compiled values, like override increments/max/min values, may be added at some point later.
serial_write(',');
print_uint8_base10(BLOCK_BUFFER_SIZE-1);
Expand Down Expand Up @@ -548,9 +548,7 @@ void report_realtime_status()
if (bit_istrue(lim_pin_state,bit(Z_AXIS))) { serial_write('Z'); }
}
if (ctrl_pin_state) {
#ifdef ENABLE_SAFETY_DOOR_INPUT_PIN
if (bit_istrue(ctrl_pin_state,CONTROL_PIN_INDEX_SAFETY_DOOR)) { serial_write('D'); }
#endif
if (bit_istrue(ctrl_pin_state,CONTROL_PIN_INDEX_SAFETY_DOOR)) { serial_write('D'); }
if (bit_istrue(ctrl_pin_state,CONTROL_PIN_INDEX_RESET)) { serial_write('R'); }
if (bit_istrue(ctrl_pin_state,CONTROL_PIN_INDEX_FEED_HOLD)) { serial_write('H'); }
if (bit_istrue(ctrl_pin_state,CONTROL_PIN_INDEX_CYCLE_START)) { serial_write('S'); }
Expand Down
79 changes: 38 additions & 41 deletions grbl/settings.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
settings.c - eeprom configuration handling
settings.c - eeprom configuration handling
Part of Grbl

Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
Expand All @@ -23,6 +23,42 @@

settings_t settings;

const __flash settings_t defaults = {\
.pulse_microseconds = DEFAULT_STEP_PULSE_MICROSECONDS,
.stepper_idle_lock_time = DEFAULT_STEPPER_IDLE_LOCK_TIME,
.step_invert_mask = DEFAULT_STEPPING_INVERT_MASK,
.dir_invert_mask = DEFAULT_DIRECTION_INVERT_MASK,
.status_report_mask = DEFAULT_STATUS_REPORT_MASK,
.junction_deviation = DEFAULT_JUNCTION_DEVIATION,
.arc_tolerance = DEFAULT_ARC_TOLERANCE,
.rpm_max = DEFAULT_SPINDLE_RPM_MAX,
.rpm_min = DEFAULT_SPINDLE_RPM_MIN,
.homing_dir_mask = DEFAULT_HOMING_DIR_MASK,
.homing_feed_rate = DEFAULT_HOMING_FEED_RATE,
.homing_seek_rate = DEFAULT_HOMING_SEEK_RATE,
.homing_debounce_delay = DEFAULT_HOMING_DEBOUNCE_DELAY,
.homing_pulloff = DEFAULT_HOMING_PULLOFF,
.flags = (DEFAULT_REPORT_INCHES << BIT_REPORT_INCHES) | \
(DEFAULT_LASER_MODE << BIT_LASER_MODE) | \
(DEFAULT_INVERT_ST_ENABLE << BIT_INVERT_ST_ENABLE) | \
(DEFAULT_HARD_LIMIT_ENABLE << BIT_HARD_LIMIT_ENABLE) | \
(DEFAULT_HOMING_ENABLE << BIT_HOMING_ENABLE) | \
(DEFAULT_SOFT_LIMIT_ENABLE << BIT_SOFT_LIMIT_ENABLE) | \
(DEFAULT_INVERT_LIMIT_PINS << BIT_INVERT_LIMIT_PINS) | \
(DEFAULT_INVERT_PROBE_PIN << BIT_INVERT_PROBE_PIN),
.steps_per_mm[X_AXIS] = DEFAULT_X_STEPS_PER_MM,
.steps_per_mm[Y_AXIS] = DEFAULT_Y_STEPS_PER_MM,
.steps_per_mm[Z_AXIS] = DEFAULT_Z_STEPS_PER_MM,
.max_rate[X_AXIS] = DEFAULT_X_MAX_RATE,
.max_rate[Y_AXIS] = DEFAULT_Y_MAX_RATE,
.max_rate[Z_AXIS] = DEFAULT_Z_MAX_RATE,
.acceleration[X_AXIS] = DEFAULT_X_ACCELERATION,
.acceleration[Y_AXIS] = DEFAULT_Y_ACCELERATION,
.acceleration[Z_AXIS] = DEFAULT_Z_ACCELERATION,
.max_travel[X_AXIS] = (-DEFAULT_X_MAX_TRAVEL),
.max_travel[Y_AXIS] = (-DEFAULT_Y_MAX_TRAVEL),
.max_travel[Z_AXIS] = (-DEFAULT_Z_MAX_TRAVEL)};


// Method to store startup lines into EEPROM
void settings_store_startup_line(uint8_t n, char *line)
Expand Down Expand Up @@ -67,46 +103,7 @@ void write_global_settings()
// Method to restore EEPROM-saved Grbl global settings back to defaults.
void settings_restore(uint8_t restore_flag) {
if (restore_flag & SETTINGS_RESTORE_DEFAULTS) {
settings.pulse_microseconds = DEFAULT_STEP_PULSE_MICROSECONDS;
settings.stepper_idle_lock_time = DEFAULT_STEPPER_IDLE_LOCK_TIME;
settings.step_invert_mask = DEFAULT_STEPPING_INVERT_MASK;
settings.dir_invert_mask = DEFAULT_DIRECTION_INVERT_MASK;
settings.status_report_mask = DEFAULT_STATUS_REPORT_MASK;
settings.junction_deviation = DEFAULT_JUNCTION_DEVIATION;
settings.arc_tolerance = DEFAULT_ARC_TOLERANCE;

settings.rpm_max = DEFAULT_SPINDLE_RPM_MAX;
settings.rpm_min = DEFAULT_SPINDLE_RPM_MIN;

settings.homing_dir_mask = DEFAULT_HOMING_DIR_MASK;
settings.homing_feed_rate = DEFAULT_HOMING_FEED_RATE;
settings.homing_seek_rate = DEFAULT_HOMING_SEEK_RATE;
settings.homing_debounce_delay = DEFAULT_HOMING_DEBOUNCE_DELAY;
settings.homing_pulloff = DEFAULT_HOMING_PULLOFF;

settings.flags = 0;
if (DEFAULT_REPORT_INCHES) { settings.flags |= BITFLAG_REPORT_INCHES; }
if (DEFAULT_LASER_MODE) { settings.flags |= BITFLAG_LASER_MODE; }
if (DEFAULT_INVERT_ST_ENABLE) { settings.flags |= BITFLAG_INVERT_ST_ENABLE; }
if (DEFAULT_HARD_LIMIT_ENABLE) { settings.flags |= BITFLAG_HARD_LIMIT_ENABLE; }
if (DEFAULT_HOMING_ENABLE) { settings.flags |= BITFLAG_HOMING_ENABLE; }
if (DEFAULT_SOFT_LIMIT_ENABLE) { settings.flags |= BITFLAG_SOFT_LIMIT_ENABLE; }
if (DEFAULT_INVERT_LIMIT_PINS) { settings.flags |= BITFLAG_INVERT_LIMIT_PINS; }
if (DEFAULT_INVERT_PROBE_PIN) { settings.flags |= BITFLAG_INVERT_PROBE_PIN; }

settings.steps_per_mm[X_AXIS] = DEFAULT_X_STEPS_PER_MM;
settings.steps_per_mm[Y_AXIS] = DEFAULT_Y_STEPS_PER_MM;
settings.steps_per_mm[Z_AXIS] = DEFAULT_Z_STEPS_PER_MM;
settings.max_rate[X_AXIS] = DEFAULT_X_MAX_RATE;
settings.max_rate[Y_AXIS] = DEFAULT_Y_MAX_RATE;
settings.max_rate[Z_AXIS] = DEFAULT_Z_MAX_RATE;
settings.acceleration[X_AXIS] = DEFAULT_X_ACCELERATION;
settings.acceleration[Y_AXIS] = DEFAULT_Y_ACCELERATION;
settings.acceleration[Z_AXIS] = DEFAULT_Z_ACCELERATION;
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);

settings = defaults;
write_global_settings();
}

Expand Down
Loading