Moved homing origin to bottom/left instead of top/right

This commit is contained in:
cprezzi 2017-05-18 23:10:44 +02:00
parent d85bfa8c83
commit 50c13a1868
6 changed files with 47 additions and 84 deletions

View File

@ -1,7 +1,8 @@
![GitHub Logo](https://github.com/gnea/gnea-Media/blob/master/Grbl%20Logo/Grbl%20Logo%20250px.png?raw=true)
***
_Click the `Release` tab to download pre-compiled `.bin` files or just [click here](https://github.com/cprezzi/grbl-LPC/releases)_
Old releases are in the `Release` tab. See [cprezzi's branch](https://github.com/cprezzi/grbl-LPC) for more recent releases.
Note: cprezzi's branch disables current control and has defaults more suitable for other boards.
***
This is GRBL 1.1 ported to the LPC1769. It can run on Smoothieboard.
@ -12,23 +13,20 @@ Usage notes:
* Only tested with lasers with PWM. Non-PWM spindle control not ported.
* These are defaults for easy-to-change config values.
* WPos enabled for LaserWeb compatability ($10=0)
* Maximum S value: 1000.0 ($30)
* Laser mode: ON ($32)
* Minimum S value: 0.0 ($31)
* Laser mode: 1 ($32)
* New configuration settings
* $33 is PWM frequency in Hz
* $34 is PWM off value in %
* $35 is PWM min value in %
* $36 is PWM max value in %
* $140 is X current (amps)
* $141 is Y current (amps)
* $142 is Z current (amps)
* Currents default to 0.0 amps to avoid burning out your motors/drivers
* Your motors will likely stall if you don't set these!
* Maximum S value: 1.0 ($30)
* Hard limits not yet ported
* Control inputs not yet ported (e.g. Cycle Start and Safety Door switches)
New configuration settings
* $33 is PWM frequency in Hz
* $34 is PWM off value in %
* $35 is PWM min value in %
* $36 is PWM max value in %
* $140, $141, $142 are X, Y, Z current (amps)
* Default to 0.0 A to avoid burning out your motors
* Your motors will likely stall if you don't set these!
Build notes:
* Include ```make``` and the ```arm-none-eabi-*``` tools in your path.

View File

@ -129,6 +129,9 @@
// define to force Grbl to always set the machine origin at the homed location despite switch orientation.
// #define HOMING_FORCE_SET_ORIGIN // Uncomment to enable.
// Uncomment this define to force Grbl to always set the machine origin at bottom left.
#define HOMING_FORCE_POSITIVE_SPACE // Uncomment to enable.
// 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 2 startup blocks may
// be stored and executed in order. These startup blocks would typically be used to set the g-code
@ -661,7 +664,7 @@
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=25
#define Y_LIMIT_BIT 26 // Y-MIN=26, Y-MAX=27
#define Z_LIMIT_BIT 29 // Z-MIN=28, Z-MAX=29
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)) //|(1<<Z_LIMIT_BIT)) // All limit bits
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)) // All limit bits
// hard limits not ported #define LIMIT_INT PCIE0 // Pin change interrupt enable pin
// hard limits not ported #define LIMIT_INT_vect PCINT0_vect
// hard limits not ported #define LIMIT_PCMSK PCMSK0 // Pin change interrupt register
@ -712,10 +715,10 @@
#define CONTROL_INVERT_MASK CONTROL_MASK // May be re-defined to only invert certain control pins.
// Define probe switch input pin.
#define PROBE_DDR NotUsed
#define PROBE_PIN NotUsed
#define PROBE_PORT NotUsed
#define PROBE_BIT 5 // Uno Analog Pin 5
#define PROBE_DDR NotUsed // LPC_GPIO1->FIODIR
#define PROBE_PIN NotUsed // LPC_GPIO1->FIOPIN
#define PROBE_PORT NotUsed // LPC_GPIO1->FIOPIN
#define PROBE_BIT 5
#define PROBE_MASK (1<<PROBE_BIT)
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
@ -729,9 +732,9 @@
// Stepper current control
//#define CURRENT_I2C Driver_I2C1 // I2C driver for current control. Comment out to disable.
#define CURRENT_MCP44XX_ADDR 0b0101100 // Address of MCP44XX
#define CURRENT_WIPERS {0, 1, 6, 7}; // Wiper registers (X, Y, Z, A)
#define CURRENT_FACTOR 113.33 // Convert amps to digipot value
//#define CURRENT_MCP44XX_ADDR 0b0101100 // Address of MCP44XX
//#define CURRENT_WIPERS {0, 1, 6, 7}; // Wiper registers (X, Y, Z, A)
//#define CURRENT_FACTOR 113.33 // Convert amps to digipot value
// Paste default settings definitions here.
#define DEFAULT_X_STEPS_PER_MM 160.0
@ -739,17 +742,17 @@
#define DEFAULT_Z_STEPS_PER_MM 160.0
#define DEFAULT_X_MAX_RATE 24000 // mm/min
#define DEFAULT_Y_MAX_RATE 24000 // mm/min
#define DEFAULT_Z_MAX_RATE 24000 // mm/min
#define DEFAULT_Z_MAX_RATE 500.0 // mm/min
#define DEFAULT_X_ACCELERATION (2500.0*60*60) // 5000*60*60 mm/min^2 = 5000 mm/sec^2
#define DEFAULT_Y_ACCELERATION (2500.0*60*60) // 5000*60*60 mm/min^2 = 5000 mm/sec^2
#define DEFAULT_Z_ACCELERATION (2500.0*60*60) // 5000*60*60 mm/min^2 = 5000 mm/sec^2
#define DEFAULT_X_CURRENT 0.0 // amps
#define DEFAULT_Y_CURRENT 0.0 // amps
#define DEFAULT_X_CURRENT 0.4 // amps
#define DEFAULT_Y_CURRENT 0.6 // amps
#define DEFAULT_Z_CURRENT 0.0 // amps
#define DEFAULT_A_CURRENT 0.0 // amps
#define DEFAULT_X_MAX_TRAVEL 300.0 // mm
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm
#define DEFAULT_Z_MAX_TRAVEL 200.0 // mm
#define DEFAULT_Z_MAX_TRAVEL 50.0 // mm
#define DEFAULT_SPINDLE_PWM_FREQ 5000 // Hz
#define DEFAULT_SPINDLE_PWM_OFF_VALUE 0.0 // Percent
#define DEFAULT_SPINDLE_PWM_MIN_VALUE 0.0 // Percent
@ -758,23 +761,23 @@
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
#define DEFAULT_STEPPING_INVERT_MASK 0
#define DEFAULT_DIRECTION_INVERT_MASK 0
#define DEFAULT_DIRECTION_INVERT_MASK 3
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 255 // msec (0-254, 255 keeps steppers enabled)
#define DEFAULT_STATUS_REPORT_MASK 0 // WPos enabled
#define DEFAULT_JUNCTION_DEVIATION 0.01 // mm
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
#define DEFAULT_REPORT_INCHES 0 // false
#define DEFAULT_INVERT_ST_ENABLE 0 // false
#define DEFAULT_INVERT_LIMIT_PINS 3 // false
#define DEFAULT_INVERT_LIMIT_PINS 1 // false
#define DEFAULT_SOFT_LIMIT_ENABLE 1 // false
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
#define DEFAULT_INVERT_PROBE_PIN 0 // false
#define DEFAULT_LASER_MODE 1 // true
#define DEFAULT_HOMING_ENABLE 0 // false
#define DEFAULT_HOMING_DIR_MASK 0 // move positive dir
#define DEFAULT_HOMING_ENABLE 1 // false
#define DEFAULT_HOMING_DIR_MASK 1 // move positive dir
#define DEFAULT_HOMING_FEED_RATE 50.0 // mm/min
#define DEFAULT_HOMING_SEEK_RATE 6000.0 // mm/min
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
#define DEFAULT_HOMING_PULLOFF 2.0 // mm
#endif

View File

@ -41,7 +41,6 @@
#define DEFAULT_X_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
#define DEFAULT_SPINDLE_PWM_FREQ 5000 // Hz
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
@ -66,49 +65,6 @@
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
#endif
#ifdef DEFAULTS_K40
// Description: K40 Lasercutter (typical chinese 40W CO2 laser cutter/engraver)
#define DEFAULT_X_STEPS_PER_MM 160.0
#define DEFAULT_Y_STEPS_PER_MM 160.0
#define DEFAULT_Z_STEPS_PER_MM 160.0
#define DEFAULT_X_MAX_RATE 24000.0 // mm/min
#define DEFAULT_Y_MAX_RATE 24000.0 // mm/min
#define DEFAULT_Z_MAX_RATE 24000.0 // mm/min
#define DEFAULT_X_ACCELERATION (2500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Y_ACCELERATION (2500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Z_ACCELERATION (2500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_X_CURRENT 0.0 // amps
#define DEFAULT_Y_CURRENT 0.0 // amps
#define DEFAULT_Z_CURRENT 0.0 // amps
#define DEFAULT_A_CURRENT 0.0 // amps
#define DEFAULT_X_MAX_TRAVEL 300.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 50.0 // mm NOTE: Must be a positive value.
#define DEFAULT_SPINDLE_PWM_FREQ 5000 // Hz
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
#define DEFAULT_STEPPING_INVERT_MASK 0
#define DEFAULT_DIRECTION_INVERT_MASK 0
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 25 // msec (0-254, 255 keeps steppers enabled)
#define DEFAULT_STATUS_REPORT_MASK 0 // WPos enabled
#define DEFAULT_JUNCTION_DEVIATION 0.01 // mm
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
#define DEFAULT_REPORT_INCHES 0 // false
#define DEFAULT_INVERT_ST_ENABLE 0 // false
#define DEFAULT_INVERT_LIMIT_PINS 1 // false
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
#define DEFAULT_INVERT_PROBE_PIN 0 // false
#define DEFAULT_LASER_MODE 1 // false
#define DEFAULT_HOMING_ENABLE 0 // false
#define DEFAULT_HOMING_DIR_MASK 0 // move positive dir
#define DEFAULT_HOMING_FEED_RATE 50.0 // mm/min
#define DEFAULT_HOMING_SEEK_RATE 6000.0 // mm/min
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
#endif
#ifdef DEFAULTS_SHERLINE_5400
// Description: Sherline 5400 mill with three NEMA 23 Keling KL23H256-21-8B 185 oz-in stepper motors,
// driven by three Pololu A4988 stepper drivers with a 30V, 6A power supply at 1.5A per winding.

View File

@ -307,9 +307,17 @@ void limits_go_home(uint8_t cycle_mask)
set_axis_position = 0;
#else
if ( bit_istrue(settings.homing_dir_mask,bit(idx)) ) {
set_axis_position = lround((settings.max_travel[idx]+settings.homing_pulloff)*settings.steps_per_mm[idx]);
#ifdef HOMING_FORCE_POSITIVE_SPACE
set_axis_position = 0; //lround(settings.homing_pulloff*settings.steps_per_mm[idx]);
#else
set_axis_position = lround((settings.max_travel[idx]-settings.homing_pulloff)*settings.steps_per_mm[idx]);
#endif
} else {
#ifdef HOMING_FORCE_POSITIVE_SPACE
set_axis_position = lround(-settings.max_travel[idx]*settings.steps_per_mm[idx]);
#else
set_axis_position = lround(-settings.homing_pulloff*settings.steps_per_mm[idx]);
#endif
}
#endif

View File

@ -71,7 +71,6 @@ static void report_util_setting_string(uint8_t n) {
case 30: printPgmString(PSTR("rpm max")); break;
case 31: printPgmString(PSTR("rpm min")); break;
case 32: printPgmString(PSTR("laser")); break;
case 33: printPgmString(PSTR("spindle_pwm_freq")); break;
default:
n -= AXIS_SETTINGS_START_VAL;
uint8_t idx = 0;
@ -97,11 +96,6 @@ static void report_util_uint8_setting(uint8_t n, int val) {
print_uint8_base10(val);
report_util_line_feed(); // report_util_setting_string(n);
}
static void report_util_uint32_setting(uint8_t n, int val) {
report_util_setting_prefix(n);
print_uint32_base10(val);
report_util_line_feed(); // report_util_setting_string(n);
}
static void report_util_float_setting(uint8_t n, float val, uint8_t n_decimal) {
report_util_setting_prefix(n);
printFloat(val,n_decimal);

View File

@ -342,8 +342,12 @@ uint8_t system_check_travel_limits(float *target)
}
#else
// NOTE: max_travel is stored as negative
#ifdef HOMING_FORCE_POSITIVE_SPACE
if (target[idx] < 0 || target[idx] > -settings.max_travel[idx]) { return(true); }
#else
if (target[idx] > 0 || target[idx] < settings.max_travel[idx]) { return(true); }
#endif
#endif
}
return(false);
}