From 185de028361969e165df82620659711186d07279 Mon Sep 17 00:00:00 2001 From: Sonny Jeon Date: Thu, 18 Jun 2015 09:23:17 -0600 Subject: [PATCH] Added restore settings defaults command. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - New restore setting defaults command. Only wipes ‘$$’ setting in EEPROM and reloads them based on the defaults used when Grbl was compiled. Used with a `$RST` command NOTE: `$RST` is intentionally not listed in the Grbl ‘$’ help message. --- Makefile | 2 +- doc/log/commit_log_v0.9i.txt | 9 +++++++++ grbl/grbl.h | 2 +- grbl/report.c | 2 ++ grbl/report.h | 1 + grbl/settings.h | 2 +- grbl/system.c | 9 ++++++++- 7 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 79fb3bf..be87bfe 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ FUSES = -U hfuse:w:0xd2:m -U lfuse:w:0xff:m # Tune the lines below only if you know what you are doing: AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE) -B 10 -F -COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -I. -ffunction-sections +COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -I. -ffunction-sections -fdata-sections OBJECTS = $(addprefix $(BUILDDIR)/,$(notdir $(SOURCE:.c=.o))) diff --git a/doc/log/commit_log_v0.9i.txt b/doc/log/commit_log_v0.9i.txt index 98655e1..f10079f 100644 --- a/doc/log/commit_log_v0.9i.txt +++ b/doc/log/commit_log_v0.9i.txt @@ -1,3 +1,12 @@ +---------------- +Date: 2015-05-29 +Author: Sonny Jeon +Subject: Added G61 exact path support. + +- G61 exact path is the Grbl default path control mode, so it’s now +added as a supported g-code. + + ---------------- Date: 2015-05-27 Author: Sonny Jeon diff --git a/grbl/grbl.h b/grbl/grbl.h index e8c2789..073a571 100644 --- a/grbl/grbl.h +++ b/grbl/grbl.h @@ -23,7 +23,7 @@ // Grbl versioning system #define GRBL_VERSION "0.9i" -#define GRBL_VERSION_BUILD "20150529" +#define GRBL_VERSION_BUILD "20150618" // Define standard libraries used by Grbl. #include diff --git a/grbl/report.c b/grbl/report.c index 09ff1b8..86782bc 100644 --- a/grbl/report.c +++ b/grbl/report.c @@ -138,6 +138,8 @@ void report_feedback_message(uint8_t message_code) printPgmString(PSTR("Check Door")); break; case MESSAGE_PROGRAM_END: printPgmString(PSTR("Pgm End")); break; + case MESSAGE_RESTORE_DEFAULTS: + printPgmString(PSTR("Restoring defaults")); break; } printPgmString(PSTR("]\r\n")); } diff --git a/grbl/report.h b/grbl/report.h index 7126085..69a1d83 100644 --- a/grbl/report.h +++ b/grbl/report.h @@ -69,6 +69,7 @@ #define MESSAGE_DISABLED 5 #define MESSAGE_SAFETY_DOOR_AJAR 6 #define MESSAGE_PROGRAM_END 7 +#define MESSAGE_RESTORE_DEFAULTS 8 // Prints system status messages. void report_status_message(uint8_t status_code); diff --git a/grbl/settings.h b/grbl/settings.h index 6f215e0..957c81f 100644 --- a/grbl/settings.h +++ b/grbl/settings.h @@ -101,7 +101,7 @@ void settings_init(); // Helper functions to clear and restore EEPROM defaults void settings_restore_global_settings(); void settings_clear_parameters(); -void settings_clear_startup_line(); +void settings_clear_startup_lines(); void settings_clear_build_info(); // A helper method to set new settings from command line diff --git a/grbl/system.c b/grbl/system.c index 11a71eb..cd62f6c 100644 --- a/grbl/system.c +++ b/grbl/system.c @@ -200,7 +200,14 @@ uint8_t system_execute_line(char *line) } while (line[char_counter++] != 0); settings_store_build_info(line); } - break; + break; + case 'R' : // Restore defaults [IDLE/ALARM] + if (line[++char_counter] != 'S') { return(STATUS_INVALID_STATEMENT); } + if (line[++char_counter] != 'T') { return(STATUS_INVALID_STATEMENT); } + if (line[++char_counter] != 0) { return(STATUS_INVALID_STATEMENT); } + report_feedback_message(MESSAGE_RESTORE_DEFAULTS); + settings_restore_global_settings(); + break; case 'N' : // Startup lines. [IDLE/ALARM] if ( line[++char_counter] == 0 ) { // Print startup lines for (helper_var=0; helper_var < N_STARTUP_LINE; helper_var++) {