diff --git a/README.md b/README.md index 78f3a73..4dbb611 100644 --- a/README.md +++ b/README.md @@ -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. @@ -10,25 +11,22 @@ Usage notes: If it doesn't, try installing VCOM_lib/usbser.inf. * This doesn't pass the sdcard to the host. Once installed you need to use a micro sdcard adaptor to replace or change it. * Only tested with lasers with PWM. Non-PWM spindle control not ported. -* This special version supports setting PWM frequency by $33. Default is 5000 Hz. Pin can only be changes in config.h. - * Pin 2.5 - * 5 kHz - * PWM off value: 0% - * Mimimum PWM value: 0% - * Maximum PWM value: 100% * These are defaults for easy-to-change config values. - * Maximum S value: 1000.0 ($30) + * WPos enabled for LaserWeb compatability ($10=0) + * Laser mode: ON ($32) * Minimum S value: 0.0 ($31) - * Laser mode: 1 ($32) - * Laser PWM frequency: 5000 ($33) + * 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! + * Default to 0.0 A to avoid burning out your motors + * Your motors will likely stall if you don't set these! Build notes: * You should use virtual machines, if you use multiple toolchains on the same PC. diff --git a/grbl/config.h b/grbl/config.h index 05dfd49..7d9f605 100644 --- a/grbl/config.h +++ b/grbl/config.h @@ -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 @@ -359,11 +362,6 @@ // pwm = scaled value. settings.rpm_min scales to SPINDLE_PWM_MIN_VALUE. settings.rpm_max // scales to SPINDLE_PWM_MAX_VALUE. -//#define SPINDLE_PWM_PERIOD (SystemCoreClock / 40000) // SystemCoreClock / frequency -#define SPINDLE_PWM_OFF_VALUE 0.0 // SPINDLE_PWM_PERIOD * fraction -//#define SPINDLE_PWM_MIN_VALUE (SPINDLE_PWM_PERIOD * 0.0) // SPINDLE_PWM_PERIOD * fraction -//#define SPINDLE_PWM_MAX_VALUE (SPINDLE_PWM_PERIOD * 1.0) // SPINDLE_PWM_PERIOD * fraction - // Used by variable spindle output only. This forces the PWM output to a minimum duty cycle when enabled. // The PWM pin will still read 0V when the spindle is disabled. Most users will not need this option, but // it may be useful in certain scenarios. This minimum PWM settings coincides with the spindle rpm minimum @@ -717,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<= settings.rpm_max) { sys.spindle_speed = settings.rpm_max; - pwm_value = spindle_pwm_max_value - 1; //SPINDLE_PWM_MAX_VALUE + pwm_value = spindle_pwm_max_value - 1; } else { sys.spindle_speed = rpm; - pwm_value = floor((rpm - settings.rpm_min) * pwm_gradient) + spindle_pwm_min_value; //SPINDLE_PWM_MIN_VALUE - if(pwm_value >= spindle_pwm_max_value) //SPINDLE_PWM_MAX_VALUE - pwm_value = spindle_pwm_max_value - 1; //SPINDLE_PWM_MAX_VALUE + pwm_value = floor((rpm - settings.rpm_min) * pwm_gradient) + spindle_pwm_min_value; + if(pwm_value >= spindle_pwm_max_value) + pwm_value = spindle_pwm_max_value - 1; } return(pwm_value); } diff --git a/grbl/spindle_control.h b/grbl/spindle_control.h index 302e2db..06c028f 100644 --- a/grbl/spindle_control.h +++ b/grbl/spindle_control.h @@ -40,6 +40,10 @@ uint8_t spindle_get_state(); // Immediately sets spindle running state with direction and spindle rpm via PWM, if enabled. // Called by spindle_sync() after sync and parking motion/spindle stop override during restore. #ifdef VARIABLE_SPINDLE + extern float spindle_pwm_period; + extern float spindle_pwm_off_value; + extern float spindle_pwm_min_value; + extern float spindle_pwm_max_value; // Called by g-code parser when setting spindle state and requires a buffer sync. void spindle_sync(uint8_t state, float rpm); diff --git a/grbl/stepper.c b/grbl/stepper.c index ec89820..1ed8329 100644 --- a/grbl/stepper.c +++ b/grbl/stepper.c @@ -385,7 +385,7 @@ extern "C" void TIMER1_IRQHandler() st_go_idle(); #ifdef VARIABLE_SPINDLE // Ensure pwm is set properly upon completion of rate-controlled motion. - if (st.exec_block->is_pwm_rate_adjusted) { spindle_set_speed(SPINDLE_PWM_OFF_VALUE); } + if (st.exec_block->is_pwm_rate_adjusted) { spindle_set_speed(spindle_pwm_off_value); } #endif system_set_exec_state_flag(EXEC_CYCLE_STOP); // Flag main program for cycle end return; // Nothing to do but exit. @@ -907,7 +907,7 @@ void st_prep_buffer() prep.current_spindle_pwm = spindle_compute_pwm_value(rpm); } else { sys.spindle_speed = 0.0; - prep.current_spindle_pwm = SPINDLE_PWM_OFF_VALUE; + prep.current_spindle_pwm = spindle_pwm_off_value; } bit_false(sys.step_control,STEP_CONTROL_UPDATE_SPINDLE_PWM); } diff --git a/grbl/system.c b/grbl/system.c index 413aa7b..03a8aeb 100644 --- a/grbl/system.c +++ b/grbl/system.c @@ -342,7 +342,11 @@ uint8_t system_check_travel_limits(float *target) } #else // NOTE: max_travel is stored as negative - if (target[idx] > 0 || target[idx] < settings.max_travel[idx]) { return(true); } + #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);