cc9afdc195
- Added a new source and header file called system. These files contain the system commands and variables, as well as all of the system headers and standard libraries Grbl uses. Centralizing some of the code. - Re-organized the include headers throughout the source code. - ENABLE_M7 define was missing from config.h. Now there. - SPINDLE_MAX_RPM and SPINDLE_MIN_RPM now defined in config.h. No uncommenting to prevent user issues. Minimum spindle RPM now provides the lower, near 0V, scale adjustment, i.e. some spindles can go really slow so why use up our 256 voltage bins for them? - Remove some persistent variables from coolant and spindle control. They were redundant. - Removed a VARIABLE_SPINDLE define in cpu_map.h that shouldn’t have been there. - Changed the DEFAULT_ARC_TOLERANCE to 0.002mm to improve arc tracing. Before we had issues with performance, no longer. - Fixed a bug with the hard limits and the software debounce feature enabled. The invert limit pin setting wasn’t honored. - Fixed a bug with the homing direction mask. Now is like it used to be. At least for now. - Re-organized main.c to serve as only as the reset/initialization routine. Makes things a little bit clearer in terms of execution procedures. - Re-organized protocol.c as the overall master control unit for execution procedures. Not quite there yet, but starting to make a little more sense in how things are run. - Removed updating of old settings records. So many new settings have been added that it’s not worth adding the code to migrate old user settings. - Tweaked spindle_control.c a bit and made it more clear and consistent with other parts of Grbl. - Tweaked the stepper disable bit code in stepper.c. Requires less flash memory.
108 lines
3.9 KiB
C
108 lines
3.9 KiB
C
/*
|
|
settings.h - eeprom configuration handling
|
|
Part of Grbl
|
|
|
|
Copyright (c) 2011-2014 Sungeun K. Jeon
|
|
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
|
|
|
Grbl is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
Grbl is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef settings_h
|
|
#define settings_h
|
|
|
|
#include "system.h"
|
|
|
|
|
|
#define GRBL_VERSION "0.9c"
|
|
#define GRBL_VERSION_BUILD "20140110"
|
|
|
|
// Version of the EEPROM data. Will be used to migrate existing data from older versions of Grbl
|
|
// when firmware is upgraded. Always stored in byte 0 of eeprom
|
|
#define SETTINGS_VERSION 6
|
|
|
|
// Define bit flag masks for the boolean settings in settings.flag.
|
|
#define BITFLAG_REPORT_INCHES bit(0)
|
|
#define BITFLAG_AUTO_START bit(1)
|
|
#define BITFLAG_INVERT_ST_ENABLE bit(2)
|
|
#define BITFLAG_HARD_LIMIT_ENABLE bit(3)
|
|
#define BITFLAG_HOMING_ENABLE bit(4)
|
|
#define BITFLAG_SOFT_LIMIT_ENABLE bit(5)
|
|
#define BITFLAG_INVERT_LIMIT_PINS bit(6)
|
|
|
|
// Define EEPROM memory address location values for Grbl settings and parameters
|
|
// NOTE: The Atmega328p has 1KB EEPROM. The upper half is reserved for parameters and
|
|
// the startup script. The lower half contains the global settings and space for future
|
|
// developments.
|
|
#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)
|
|
#define SETTING_INDEX_NCOORD N_COORDINATE_SYSTEM+1 // Total number of system stored (from index 0)
|
|
// NOTE: Work coordinate indices are (0=G54, 1=G55, ... , 6=G59)
|
|
#define SETTING_INDEX_G28 N_COORDINATE_SYSTEM // Home position 1
|
|
#define SETTING_INDEX_G30 N_COORDINATE_SYSTEM+1 // Home position 2
|
|
// #define SETTING_INDEX_G92 N_COORDINATE_SYSTEM+2 // Coordinate offset (G92.2,G92.3 not supported)
|
|
|
|
// Global persistent settings (Stored from byte EEPROM_ADDR_GLOBAL onwards)
|
|
typedef struct {
|
|
float steps_per_mm[N_AXIS];
|
|
float max_rate[N_AXIS];
|
|
float acceleration[N_AXIS];
|
|
float max_travel[N_AXIS];
|
|
uint8_t pulse_microseconds;
|
|
float default_feed_rate;
|
|
uint8_t step_invert_mask;
|
|
uint8_t dir_invert_mask;
|
|
uint8_t stepper_idle_lock_time; // If max value 255, steppers do not disable.
|
|
float junction_deviation;
|
|
float arc_tolerance;
|
|
uint8_t decimal_places;
|
|
uint8_t flags; // Contains default boolean settings
|
|
uint8_t homing_dir_mask;
|
|
float homing_feed_rate;
|
|
float homing_seek_rate;
|
|
uint16_t homing_debounce_delay;
|
|
float homing_pulloff;
|
|
// uint8_t status_report_mask; // Mask to indicate desired report data.
|
|
} settings_t;
|
|
extern settings_t settings;
|
|
|
|
// Initialize the configuration subsystem (load settings from EEPROM)
|
|
void settings_init();
|
|
|
|
// A helper method to set new settings from command line
|
|
uint8_t settings_store_global_setting(int parameter, float value);
|
|
|
|
// Stores the protocol line variable as a startup line in EEPROM
|
|
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);
|
|
|
|
// Reads selected coordinate data from EEPROM
|
|
uint8_t settings_read_coord_data(uint8_t coord_select, float *coord_data);
|
|
|
|
#endif
|