New build info feature. (per @Analogreality request)
- New build info feature. Hidden command ‘$I’ will print the build info for your Grbl firmware. Users may also write an identifying message within it via ‘$I=‘ with up to 32 characters. (no more, or else it will break). - Adjusted the max number of startup lines to 3. Majority of people will only need one. - Fixed a compile error with spindle_control.c. A rogue #endif was causing problems.
This commit is contained in:
parent
1baff785f5
commit
3c3382ff75
4
config.h
4
config.h
@ -74,10 +74,10 @@
|
||||
#define N_HOMING_LOCATE_CYCLE 2 // Integer (1-128)
|
||||
|
||||
// Number of blocks Grbl executes upon startup. These blocks are stored in EEPROM, where the size
|
||||
// and addresses are defined in settings.h. With the current settings, up to 5 startup blocks may
|
||||
// and addresses are defined in settings.h. With the current settings, up to 3 startup blocks may
|
||||
// be stored and executed in order. These startup blocks would typically be used to set the g-code
|
||||
// parser state depending on user preferences.
|
||||
#define N_STARTUP_LINE 2 // Integer (1-5)
|
||||
#define N_STARTUP_LINE 2 // Integer (1-3)
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// ADVANCED CONFIGURATION OPTIONS:
|
||||
|
16
protocol.c
16
protocol.c
@ -254,6 +254,22 @@ uint8_t protocol_execute_line(char *line)
|
||||
if (!sys.abort) { protocol_execute_startup(); } // Execute startup scripts after successful homing.
|
||||
} else { return(STATUS_SETTING_DISABLED); }
|
||||
break;
|
||||
case 'I' : // Print or store build info.
|
||||
if ( line[++char_counter] == 0 ) {
|
||||
if (!(settings_read_build_info(line))) {
|
||||
report_status_message(STATUS_SETTING_READ_FAIL);
|
||||
} else {
|
||||
report_build_info(line);
|
||||
}
|
||||
} else { // Store startup line
|
||||
if(line[char_counter++] != '=') { return(STATUS_UNSUPPORTED_STATEMENT); }
|
||||
helper_var = char_counter; // Set helper variable as counter to start of user info line.
|
||||
do {
|
||||
line[char_counter-helper_var] = line[char_counter];
|
||||
} while (line[char_counter++] != 0);
|
||||
settings_store_build_info(line);
|
||||
}
|
||||
break;
|
||||
case 'N' : // Startup lines.
|
||||
if ( line[++char_counter] == 0 ) { // Print startup lines
|
||||
for (helper_var=0; helper_var < N_STARTUP_LINE; helper_var++) {
|
||||
|
12
report.c
12
report.c
@ -125,7 +125,7 @@ void report_feedback_message(uint8_t message_code)
|
||||
// Welcome message
|
||||
void report_init_message()
|
||||
{
|
||||
printPgmString(PSTR("\r\nGrbl " GRBL_VERSION " ("GRBL_VERSION_BUILD ") ['$' for help]\r\n"));
|
||||
printPgmString(PSTR("\r\nGrbl " GRBL_VERSION " ['$' for help]\r\n"));
|
||||
}
|
||||
|
||||
// Grbl help message
|
||||
@ -292,6 +292,16 @@ void report_startup_line(uint8_t n, char *line)
|
||||
printPgmString(PSTR("\r\n"));
|
||||
}
|
||||
|
||||
|
||||
// Prints build info line
|
||||
void report_build_info(char *line)
|
||||
{
|
||||
printPgmString(PSTR("[" GRBL_VERSION "." GRBL_VERSION_BUILD ":"));
|
||||
printString(line);
|
||||
printPgmString(PSTR("]\r\n"));
|
||||
}
|
||||
|
||||
|
||||
// Prints real-time data. This function grabs a real-time snapshot of the stepper subprogram
|
||||
// and the actual location of the CNC machine. Users may change the following function to their
|
||||
// specific needs, but the desired real-time data report must be as short as possible. This is
|
||||
|
3
report.h
3
report.h
@ -78,4 +78,7 @@ void report_gcode_modes();
|
||||
// Prints startup line
|
||||
void report_startup_line(uint8_t n, char *line);
|
||||
|
||||
// Prints build info and user info
|
||||
void report_build_info(char *line);
|
||||
|
||||
#endif
|
||||
|
19
settings.c
19
settings.c
@ -50,6 +50,12 @@ void settings_store_startup_line(uint8_t n, char *line)
|
||||
memcpy_to_eeprom_with_checksum(addr,(char*)line, LINE_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
// Method to store build info into EEPROM
|
||||
void settings_store_build_info(char *line)
|
||||
{
|
||||
memcpy_to_eeprom_with_checksum(EEPROM_ADDR_BUILD_INFO,(char*)line, LINE_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
// Method to store coord data parameters into EEPROM
|
||||
void settings_write_coord_data(uint8_t coord_select, float *coord_data)
|
||||
{
|
||||
@ -120,6 +126,19 @@ uint8_t settings_read_startup_line(uint8_t n, char *line)
|
||||
}
|
||||
}
|
||||
|
||||
// Reads startup line from EEPROM. Updated pointed line string data.
|
||||
uint8_t settings_read_build_info(char *line)
|
||||
{
|
||||
if (!(memcpy_from_eeprom_with_checksum((char*)line, EEPROM_ADDR_BUILD_INFO, LINE_BUFFER_SIZE))) {
|
||||
// Reset line with default value
|
||||
line[0] = 0;
|
||||
settings_store_build_info(line);
|
||||
return(false);
|
||||
} else {
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Read selected coordinate data from EEPROM. Updates pointed coord_data value.
|
||||
uint8_t settings_read_coord_data(uint8_t coord_select, float *coord_data)
|
||||
{
|
||||
|
@ -48,6 +48,7 @@
|
||||
#define EEPROM_ADDR_GLOBAL 1
|
||||
#define EEPROM_ADDR_PARAMETERS 512
|
||||
#define EEPROM_ADDR_STARTUP_BLOCK 768
|
||||
#define EEPROM_ADDR_BUILD_INFO 992
|
||||
|
||||
// Define EEPROM address indexing for coordinate parameters
|
||||
#define N_COORDINATE_SYSTEM 6 // Number of supported work coordinate systems (from index 1)
|
||||
@ -93,6 +94,10 @@ void settings_store_startup_line(uint8_t n, char *line);
|
||||
// Reads an EEPROM startup line to the protocol line variable
|
||||
uint8_t settings_read_startup_line(uint8_t n, char *line);
|
||||
|
||||
void settings_store_build_info(char *line);
|
||||
|
||||
uint8_t settings_read_build_info(char *line);
|
||||
|
||||
// Writes selected coordinate data to EEPROM
|
||||
void settings_write_coord_data(uint8_t coord_select, float *coord_data);
|
||||
|
||||
|
@ -92,5 +92,3 @@ void spindle_run(int8_t direction, uint16_t rpm)
|
||||
current_rpm = rpm;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user