Skip to content

Commit 4252f75

Browse files
committed
Merge branch 'more-axis'
2 parents f904fff + dc92bf5 commit 4252f75

19 files changed

+803
-226
lines changed

doc/markdown/settings.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ $27=1.000
5151
$30=1000.
5252
$31=0.
5353
$32=0
54+
$33=5000
5455
$100=250.000
5556
$101=250.000
5657
$102=250.000
@@ -63,6 +64,9 @@ $122=10.000
6364
$130=200.000
6465
$131=200.000
6566
$132=200.000
67+
$140=0.000
68+
$141=0.000
69+
$142=0.000
6670
```
6771

6872
#### $x=val - Save Grbl setting
@@ -227,6 +231,10 @@ When enabled, Grbl will move continuously through consecutive `G1`, `G2`, or `G3
227231

228232
When disabled, Grbl will operate as it always has, stopping motion with every `S` spindle speed command. This is the default operation of a milling machine to allow a pause to let the spindle change speeds.
229233

234+
#### $33 - Spindle/Laser PWM frequency
235+
236+
This sets the PWM frequency.
237+
230238
#### $100, $101 and $102 – [X,Y,Z] steps/mm
231239

232240
Grbl needs to know how far each step will take the tool in reality. To calculate steps/mm for an axis of your machine you need to know:

doc/media/Thumbs.db

29 KB
Binary file not shown.

grbl-lpc/current_control.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void current_init()
5555
set_current(0, settings.current[0]);
5656
set_current(1, settings.current[1]);
5757
set_current(2, settings.current[2]);
58-
set_current(3, DEFAULT_A_CURRENT);
58+
set_current(3, settings.current[3]);
5959
#endif
6060
}
6161

grbl/config.h

Lines changed: 18 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,17 @@
3131
#include "LPC17xx.h"
3232

3333

34-
// Define CPU pin map and default settings.
35-
// NOTE: OEMs can avoid the need to maintain/update the defaults.h and cpu_map.h files and use only
36-
// one configuration file by placing their specific defaults and pin map at the bottom of this file.
37-
// If doing so, simply comment out these two defines and see instructions below.
38-
// #define DEFAULTS_GENERIC
39-
// #define CPU_MAP_ATMEGA328P // Arduino Uno CPU
34+
// Define board type for pin map and default settings.
35+
//#define CPU_MAP_SMOOTHIEBOARD // Smoothieboard (NXP LPC1769 MCU)
36+
#define CPU_MAP_C3D_REMIX // Cohesion3D Remix (NXP LPC1769 MCU)
37+
//#define CPU_MAP_C3D_MINI // Cohesion3D Mini (NXP LPC1769 MCU)
38+
//#define CPU_MAP_MKS_SBASE // MKS SBASE Board (NXP LPC1768 MCU)
39+
//#define CPU_MAP_AZTEEG_X5 // Azteeg X5 Board (NXP LPC1769 MCU)
40+
41+
// Define machine type for machine specific defaults
42+
//#define DEFAULTS_GENERIC
43+
#define DEFAULTS_K40
44+
//#define DEFAULTS_FABKIT
4045

4146
// Serial baud rate
4247
// #define BAUD_RATE 230400
@@ -108,10 +113,11 @@
108113
// #define HOMING_CYCLE_2 // OPTIONAL: Uncomment and add axes mask to enable
109114

110115
// NOTE: The following are two examples to setup homing for 2-axis machines.
111-
// #define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS)) // NOT COMPATIBLE WITH COREXY: Homes both X-Y in one cycle.
116+
//#define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS)) // NOT COMPATIBLE WITH COREXY: Homes both X-Y in one cycle.
112117

113-
#define HOMING_CYCLE_0 (1<<X_AXIS) // COREXY COMPATIBLE: First home X
114-
#define HOMING_CYCLE_1 (1<<Y_AXIS) // COREXY COMPATIBLE: Then home Y
118+
// #define HOMING_CYCLE_0 (1<<X_AXIS) // COREXY COMPATIBLE: First home X
119+
// #define HOMING_CYCLE_1 (1<<Y_AXIS) // COREXY COMPATIBLE: Then home Y
120+
// Homing cycle pattern is defined in Machine defaults!!!
115121

116122
// Number of homing cycles performed after when the machine initially jogs to limit switches.
117123
// This help in preventing overshoot and should improve repeatability. This value should be one or
@@ -130,7 +136,7 @@
130136
// #define HOMING_FORCE_SET_ORIGIN // Uncomment to enable.
131137

132138
// Uncomment this define to force Grbl to always set the machine origin at bottom left.
133-
#define HOMING_FORCE_POSITIVE_SPACE // Uncomment to enable.
139+
//#define HOMING_FORCE_POSITIVE_SPACE // Uncomment to enable.
134140

135141
// Number of blocks Grbl executes upon startup. These blocks are stored in EEPROM, where the size
136142
// and addresses are defined in settings.h. With the current settings, up to 2 startup blocks may
@@ -170,7 +176,7 @@
170176
// Enables a second coolant control pin via the mist coolant g-code command M7 on the Arduino Uno
171177
// analog pin 4. Only use this option if you require a second coolant control pin.
172178
// NOTE: The M8 flood coolant control pin on analog pin 3 will still be functional regardless.
173-
// #define ENABLE_M7 // Disabled by default. Uncomment to enable.
179+
//#define ENABLE_M7 // Disabled by default. Uncomment to enable.
174180

175181
// This option causes the feed hold input to act as a safety door switch. A safety door, when triggered,
176182
// immediately forces a feed hold and then safely de-energizes the machine. Resuming is blocked until
@@ -563,7 +569,7 @@
563569

564570
// LPC176x flash blocks have a rating of 10,000 write cycles. To prevent excess wear, we don't
565571
// write G10, G28.1, and G30.1. Uncomment to enable these writes.
566-
// #define STORE_COORD_DATA // Default disabled. Uncomment to enable.
572+
#define STORE_COORD_DATA // Default disabled. Uncomment to enable.
567573

568574
// In Grbl v0.9 and prior, there is an old outstanding bug where the `WPos:` work position reported
569575
// may not correlate to what is executing, because `WPos:` is based on the g-code parser state, which
@@ -627,157 +633,5 @@
627633
below.
628634
*/
629635

630-
// Paste CPU_MAP definitions here.
631-
// Define serial port pins and interrupt vectors.
632-
#define SERIAL_RX USART_RX_vect
633-
#define SERIAL_UDRE USART_UDRE_vect
634-
635-
// Define step pulse output pins. NOTE: All step bit pins must be on the same port.
636-
#define STEP_DDR LPC_GPIO2->FIODIR
637-
#define STEP_PORT LPC_GPIO2->FIOPIN
638-
#define X_STEP_BIT 0
639-
#define Y_STEP_BIT 1
640-
#define Z_STEP_BIT 2
641-
#define STEP_MASK ((1<<X_STEP_BIT)|(1<<Y_STEP_BIT)|(1<<Z_STEP_BIT)) // All step bits
642-
643-
// Define step direction output pins. NOTE: All direction pins must be on the same port.
644-
#define DIRECTION_DDR LPC_GPIO0->FIODIR
645-
#define DIRECTION_PORT LPC_GPIO0->FIOPIN
646-
#define X_DIRECTION_BIT 5
647-
#define Y_DIRECTION_BIT 11
648-
#define Z_DIRECTION_BIT 20
649-
#define DIRECTION_MASK ((1<<X_DIRECTION_BIT)|(1<<Y_DIRECTION_BIT)|(1<<Z_DIRECTION_BIT)) // All direction bits
650-
651-
// Define stepper driver enable/disable output pin.
652-
#define STEPPERS_DISABLE_DDR LPC_GPIO0->FIODIR
653-
#define STEPPERS_DISABLE_PORT LPC_GPIO0->FIOPIN
654-
#define X_DISABLE_BIT 4
655-
#define Y_DISABLE_BIT 10
656-
#define Z_DISABLE_BIT 19
657-
#define STEPPERS_DISABLE_MASK ((1<<X_DISABLE_BIT)|(1<<Y_DISABLE_BIT)|(1<<Z_DISABLE_BIT))
658-
659-
// Define homing/hard limit switch input pins and limit interrupt vectors.
660-
// NOTE: All limit bit pins must be on the same port, but not on a port with other input pins (CONTROL).
661-
#define LIMIT_DDR LPC_GPIO1->FIODIR
662-
#define LIMIT_PIN LPC_GPIO1->FIOPIN
663-
#define LIMIT_PORT LPC_GPIO1->FIOPIN
664-
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=25
665-
#define Y_LIMIT_BIT 26 // Y-MIN=26, Y-MAX=27
666-
#define Z_LIMIT_BIT 29 // Z-MIN=28, Z-MAX=29
667-
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)) // All limit bits
668-
// hard limits not ported #define LIMIT_INT PCIE0 // Pin change interrupt enable pin
669-
// hard limits not ported #define LIMIT_INT_vect PCINT0_vect
670-
// hard limits not ported #define LIMIT_PCMSK PCMSK0 // Pin change interrupt register
671-
672-
// Define spindle enable and spindle direction output pins.
673-
/* not ported
674-
#define SPINDLE_ENABLE_DDR DDRB
675-
#define SPINDLE_ENABLE_PORT PORTB
676-
// Z Limit pin and spindle PWM/enable pin swapped to access hardware PWM on Pin 11.
677-
#ifdef VARIABLE_SPINDLE
678-
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
679-
// If enabled, spindle direction pin now used as spindle enable, while PWM remains on D11.
680-
#define SPINDLE_ENABLE_BIT 5 // Uno Digital Pin 13 (NOTE: D13 can't be pulled-high input due to LED.)
681-
#else
682-
#define SPINDLE_ENABLE_BIT 3 // Uno Digital Pin 11
683-
#endif
684-
#else
685-
#define SPINDLE_ENABLE_BIT 4 // Uno Digital Pin 12
686-
#endif
687-
#ifndef USE_SPINDLE_DIR_AS_ENABLE_PIN
688-
#define SPINDLE_DIRECTION_DDR DDRB
689-
#define SPINDLE_DIRECTION_PORT PORTB
690-
#define SPINDLE_DIRECTION_BIT 5 // Uno Digital Pin 13 (NOTE: D13 can't be pulled-high input due to LED.)
691-
#endif
692-
*/
693-
694-
// Define flood and mist coolant enable output pins.
695-
#define COOLANT_FLOOD_DDR NotUsed
696-
#define COOLANT_FLOOD_PORT NotUsed
697-
#define COOLANT_FLOOD_BIT 3 // Uno Analog Pin 3
698-
#define COOLANT_MIST_DDR NotUsed
699-
#define COOLANT_MIST_PORT NotUsed
700-
#define COOLANT_MIST_BIT 4 // Uno Analog Pin 3
701-
702-
// Define user-control controls (cycle start, reset, feed hold) input pins.
703-
// NOTE: All CONTROLs pins must be on the same port and not on a port with other input pins (limits).
704-
#define CONTROL_DDR NotUsed
705-
#define CONTROL_PIN NotUsed
706-
#define CONTROL_PORT NotUsed
707-
#define CONTROL_RESET_BIT 0 // Uno Analog Pin 0
708-
#define CONTROL_FEED_HOLD_BIT 1 // Uno Analog Pin 1
709-
#define CONTROL_CYCLE_START_BIT 2 // Uno Analog Pin 2
710-
#define CONTROL_SAFETY_DOOR_BIT 1 // Uno Analog Pin 1 NOTE: Safety door is shared with feed hold. Enabled by config define.
711-
#define CONTROL_INT PCIE1 // Pin change interrupt enable pin
712-
#define CONTROL_INT_vect PCINT1_vect
713-
#define CONTROL_PCMSK NotUsed // Pin change interrupt register
714-
#define CONTROL_MASK ((1<<CONTROL_RESET_BIT)|(1<<CONTROL_FEED_HOLD_BIT)|(1<<CONTROL_CYCLE_START_BIT)|(1<<CONTROL_SAFETY_DOOR_BIT))
715-
#define CONTROL_INVERT_MASK CONTROL_MASK // May be re-defined to only invert certain control pins.
716-
717-
// Define probe switch input pin.
718-
#define PROBE_DDR NotUsed // LPC_GPIO1->FIODIR
719-
#define PROBE_PIN NotUsed // LPC_GPIO1->FIOPIN
720-
#define PROBE_PORT NotUsed // LPC_GPIO1->FIOPIN
721-
#define PROBE_BIT 5
722-
#define PROBE_MASK (1<<PROBE_BIT)
723-
724-
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
725-
//
726-
// PWM Channel PWM1_CH1 PWM1_CH2 PWM1_CH3 PWM1_CH4 PWM1_CH5 PWM1_CH6
727-
// Primary pin P1.18 P1.20 P1.21 P1.23 P1.24 P1.26
728-
// Secondary pin P2.0 P2.1 P2.2 P2.3 P2.4 P2.5
729-
#define SPINDLE_PWM_CHANNEL PWM1_CH6
730-
#define SPINDLE_PWM_USE_PRIMARY_PIN false
731-
#define SPINDLE_PWM_USE_SECONDARY_PIN true
732-
733-
// Stepper current control
734-
//#define CURRENT_I2C Driver_I2C1 // I2C driver for current control. Comment out to disable.
735-
//#define CURRENT_MCP44XX_ADDR 0b0101100 // Address of MCP44XX
736-
//#define CURRENT_WIPERS {0, 1, 6, 7}; // Wiper registers (X, Y, Z, A)
737-
//#define CURRENT_FACTOR 113.33 // Convert amps to digipot value
738-
739-
// Paste default settings definitions here.
740-
#define DEFAULT_X_STEPS_PER_MM 160.0
741-
#define DEFAULT_Y_STEPS_PER_MM 160.0
742-
#define DEFAULT_Z_STEPS_PER_MM 160.0
743-
#define DEFAULT_X_MAX_RATE 24000 // mm/min
744-
#define DEFAULT_Y_MAX_RATE 24000 // mm/min
745-
#define DEFAULT_Z_MAX_RATE 500.0 // mm/min
746-
#define DEFAULT_X_ACCELERATION (2500.0*60*60) // 5000*60*60 mm/min^2 = 5000 mm/sec^2
747-
#define DEFAULT_Y_ACCELERATION (2500.0*60*60) // 5000*60*60 mm/min^2 = 5000 mm/sec^2
748-
#define DEFAULT_Z_ACCELERATION (2500.0*60*60) // 5000*60*60 mm/min^2 = 5000 mm/sec^2
749-
#define DEFAULT_X_CURRENT 0.4 // amps
750-
#define DEFAULT_Y_CURRENT 0.6 // amps
751-
#define DEFAULT_Z_CURRENT 0.0 // amps
752-
#define DEFAULT_A_CURRENT 0.0 // amps
753-
#define DEFAULT_X_MAX_TRAVEL 300.0 // mm
754-
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm
755-
#define DEFAULT_Z_MAX_TRAVEL 50.0 // mm
756-
#define DEFAULT_SPINDLE_PWM_FREQ 5000 // Hz
757-
#define DEFAULT_SPINDLE_PWM_OFF_VALUE 0.0 // Percent
758-
#define DEFAULT_SPINDLE_PWM_MIN_VALUE 0.0 // Percent
759-
#define DEFAULT_SPINDLE_PWM_MAX_VALUE 100.0 // Percent
760-
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
761-
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
762-
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
763-
#define DEFAULT_STEPPING_INVERT_MASK 0
764-
#define DEFAULT_DIRECTION_INVERT_MASK 0
765-
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 255 // msec (0-254, 255 keeps steppers enabled)
766-
#define DEFAULT_STATUS_REPORT_MASK 0 // WPos enabled
767-
#define DEFAULT_JUNCTION_DEVIATION 0.01 // mm
768-
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
769-
#define DEFAULT_REPORT_INCHES 0 // false
770-
#define DEFAULT_INVERT_ST_ENABLE 0 // false
771-
#define DEFAULT_INVERT_LIMIT_PINS 1 // false
772-
#define DEFAULT_SOFT_LIMIT_ENABLE 1 // false
773-
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
774-
#define DEFAULT_INVERT_PROBE_PIN 0 // false
775-
#define DEFAULT_LASER_MODE 1 // true
776-
#define DEFAULT_HOMING_ENABLE 1 // false
777-
#define DEFAULT_HOMING_DIR_MASK 1 // move positive dir
778-
#define DEFAULT_HOMING_FEED_RATE 50.0 // mm/min
779-
#define DEFAULT_HOMING_SEEK_RATE 6000.0 // mm/min
780-
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
781-
#define DEFAULT_HOMING_PULLOFF 2.0 // mm
782636

783637
#endif

0 commit comments

Comments
 (0)