renamed public methods of settings module to include module name
This commit is contained in:
parent
6d3ff506e8
commit
7092b0e1fe
4
gcode.c
4
gcode.c
@ -150,12 +150,12 @@ uint8_t gc_execute_line(char *line) {
|
|||||||
if (line[0] == '$') {
|
if (line[0] == '$') {
|
||||||
// Parameter lines are on the form '$4=374.3' or '$' to dump current settings
|
// Parameter lines are on the form '$4=374.3' or '$' to dump current settings
|
||||||
char_counter = 1;
|
char_counter = 1;
|
||||||
if(line[char_counter] == 0) { dump_settings(); return(GCSTATUS_OK); }
|
if(line[char_counter] == 0) { settings_dump(); return(GCSTATUS_OK); }
|
||||||
read_double(line, &char_counter, &p);
|
read_double(line, &char_counter, &p);
|
||||||
if(line[char_counter++] != '=') { return(GCSTATUS_UNSUPPORTED_STATEMENT); }
|
if(line[char_counter++] != '=') { return(GCSTATUS_UNSUPPORTED_STATEMENT); }
|
||||||
read_double(line, &char_counter, &value);
|
read_double(line, &char_counter, &value);
|
||||||
if(line[char_counter] != 0) { return(GCSTATUS_UNSUPPORTED_STATEMENT); }
|
if(line[char_counter] != 0) { return(GCSTATUS_UNSUPPORTED_STATEMENT); }
|
||||||
store_setting(p, value);
|
settings_store_setting(p, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We'll handle this as g-code. First: parse all statements */
|
/* We'll handle this as g-code. First: parse all statements */
|
||||||
|
10
settings.c
10
settings.c
@ -39,7 +39,7 @@ typedef struct {
|
|||||||
double mm_per_arc_segment;
|
double mm_per_arc_segment;
|
||||||
} settings_v1_t;
|
} settings_v1_t;
|
||||||
|
|
||||||
void reset_settings() {
|
void settings_reset() {
|
||||||
settings.steps_per_mm[0] = DEFAULT_X_STEPS_PER_MM;
|
settings.steps_per_mm[0] = DEFAULT_X_STEPS_PER_MM;
|
||||||
settings.steps_per_mm[1] = DEFAULT_Y_STEPS_PER_MM;
|
settings.steps_per_mm[1] = DEFAULT_Y_STEPS_PER_MM;
|
||||||
settings.steps_per_mm[2] = DEFAULT_Z_STEPS_PER_MM;
|
settings.steps_per_mm[2] = DEFAULT_Z_STEPS_PER_MM;
|
||||||
@ -52,7 +52,7 @@ void reset_settings() {
|
|||||||
settings.max_jerk = DEFAULT_MAX_JERK;
|
settings.max_jerk = DEFAULT_MAX_JERK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_settings() {
|
void settings_dump() {
|
||||||
printPgmString(PSTR("$0 = ")); printFloat(settings.steps_per_mm[0]);
|
printPgmString(PSTR("$0 = ")); printFloat(settings.steps_per_mm[0]);
|
||||||
printPgmString(PSTR(" (steps/mm x)\r\n$1 = ")); printFloat(settings.steps_per_mm[1]);
|
printPgmString(PSTR(" (steps/mm x)\r\n$1 = ")); printFloat(settings.steps_per_mm[1]);
|
||||||
printPgmString(PSTR(" (steps/mm y)\r\n$2 = ")); printFloat(settings.steps_per_mm[2]);
|
printPgmString(PSTR(" (steps/mm y)\r\n$2 = ")); printFloat(settings.steps_per_mm[2]);
|
||||||
@ -96,7 +96,7 @@ int read_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A helper method to set settings from command line
|
// A helper method to set settings from command line
|
||||||
void store_setting(int parameter, double value) {
|
void settings_store_setting(int parameter, double value) {
|
||||||
switch(parameter) {
|
switch(parameter) {
|
||||||
case 0: case 1: case 2:
|
case 0: case 1: case 2:
|
||||||
settings.steps_per_mm[parameter] = value; break;
|
settings.steps_per_mm[parameter] = value; break;
|
||||||
@ -121,8 +121,8 @@ void settings_init() {
|
|||||||
printPgmString(PSTR("'$' to dump current settings\r\n"));
|
printPgmString(PSTR("'$' to dump current settings\r\n"));
|
||||||
} else {
|
} else {
|
||||||
printPgmString(PSTR("Warning: Failed to read EEPROM settings. Using defaults.\r\n"));
|
printPgmString(PSTR("Warning: Failed to read EEPROM settings. Using defaults.\r\n"));
|
||||||
reset_settings();
|
settings_reset();
|
||||||
write_settings();
|
write_settings();
|
||||||
dump_settings();
|
settings_dump();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,10 +49,10 @@ extern settings_t settings;
|
|||||||
void settings_init();
|
void settings_init();
|
||||||
|
|
||||||
// Print current settings
|
// Print current settings
|
||||||
void dump_settings();
|
void settings_dump();
|
||||||
|
|
||||||
// A helper method to set new settings from command line
|
// A helper method to set new settings from command line
|
||||||
void store_setting(int parameter, double value);
|
void settings_store_setting(int parameter, double value);
|
||||||
|
|
||||||
// Default settings (used when resetting eeprom-settings)
|
// Default settings (used when resetting eeprom-settings)
|
||||||
#define MICROSTEPS 8
|
#define MICROSTEPS 8
|
||||||
|
Loading…
Reference in New Issue
Block a user