Skip to content

Commit 324543c

Browse files
RAMPS Support (#147)
* RAMPS 1.4 Support Add support for RAMPS 1.4 Arduino Mega shields. Does not support ULN2003 drivers or un-modded 28BYJ steppers. * Update Configuration_adv.hpp * Version update * Clang format Co-authored-by: Andre Stefanov <[email protected]>
1 parent 726faf5 commit 324543c

File tree

8 files changed

+212
-6
lines changed

8 files changed

+212
-6
lines changed

Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
**V1.9.38 - Updates**
2+
- Add support for RAMPS 1.4 Arduino Mega shields
3+
14
**V1.9.37 - Updates**
25
- Add HE1 to dew heater output for MKS boards
36

Configuration.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@
235235
// Append board specific pins data.
236236
#if (BOARD == BOARD_AVR_MEGA2560)
237237
#include "boards/AVR_MEGA2560/pins_MEGA2560.hpp"
238+
#elif (BOARD == BOARD_RAMPS)
239+
#include "boards/RAMPS/pins_RAMPS.hpp"
238240
#elif (BOARD == BOARD_ESP32_ESP32DEV)
239241
#include "boards/ESP32_ESP32DEV/pins_ESP32DEV.hpp"
240242
#elif (BOARD == BOARD_AVR_MKS_GEN_L_V1)

ConfigurationValidation.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@
244244
// Required pin assignments missing
245245
#error Missing pin assignments for configured DEC DRIVER_TYPE_A4988_GENERIC or DRIVER_TYPE_TMC2209_STANDALONE driver
246246
#endif
247-
#if (!defined(DEC_MS0_PIN) || !defined(DEC_MS1_PIN) || !defined(DEC_MS2_PIN)) && (BOARD != BOARD_AVR_MKS_GEN_L_V1)
247+
#if (!defined(DEC_MS0_PIN) || !defined(DEC_MS1_PIN) || !defined(DEC_MS2_PIN)) \
248+
&& (BOARD != BOARD_AVR_MKS_GEN_L_V1 && BOARD != BOARD_AVR_RAMPS)
248249
#warning Missing pin assignments for MS pins
249250
#endif
250251
#elif (DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART)
@@ -268,7 +269,8 @@
268269
// Required pin assignments missing
269270
#error Missing pin assignments for configured RA DRIVER_TYPE_A4988_GENERIC or DRIVER_TYPE_TMC2209_STANDALONE driver
270271
#endif
271-
#if (!defined(RA_MS0_PIN) || !defined(RA_MS1_PIN) || !defined(RA_MS2_PIN)) && (BOARD != BOARD_AVR_MKS_GEN_L_V1)
272+
#if (!defined(RA_MS0_PIN) || !defined(RA_MS1_PIN) || !defined(RA_MS2_PIN)) \
273+
&& (BOARD != BOARD_AVR_MKS_GEN_L_V1 && BOARD != BOARD_AVR_RAMPS)
272274
#warning Missing pin assignments for MS pins
273275
#endif
274276
#elif (RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART)

Configuration_adv.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@
105105
#define RA_UART_STEALTH_MODE 0
106106
#endif
107107
#elif (RA_DRIVER_TYPE == DRIVER_TYPE_A4988_GENERIC) || (RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_STANDALONE)
108-
#define RA_SLEW_MICROSTEPPING 8 // Microstep mode set by MS pin strapping. Use the same microstep mode for both slewing & tracking
108+
#ifndef RA_SLEW_MICROSTEPPING
109+
#define RA_SLEW_MICROSTEPPING 8 // Microstep mode set by MS pin strapping. Use the same microstep mode for both slewing & tracking
110+
#endif
109111
#define RA_TRACKING_MICROSTEPPING RA_SLEW_MICROSTEPPING
110112
#elif (RA_DRIVER_TYPE == DRIVER_TYPE_ULN2003)
111113
#define RA_SLEW_MICROSTEPPING 2 // The (default) half-step mode used for slewing RA axis
@@ -125,8 +127,10 @@
125127
#define DEC_UART_STEALTH_MODE 0
126128
#endif
127129
#elif (DEC_DRIVER_TYPE == DRIVER_TYPE_A4988_GENERIC) || (DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_STANDALONE)
128-
#define DEC_SLEW_MICROSTEPPING \
129-
16 // Only UART drivers support dynamic switching. Use the same microstep mode for both slewing & guiding
130+
#ifndef DEC_SLEW_MICROSTEPPING
131+
#define DEC_SLEW_MICROSTEPPING \
132+
16 // Only UART drivers support dynamic switching. Use the same microstep mode for both slewing & guiding
133+
#endif
130134
#define DEC_GUIDE_MICROSTEPPING DEC_SLEW_MICROSTEPPING
131135
#elif (DEC_DRIVER_TYPE == DRIVER_TYPE_ULN2003)
132136
#define DEC_SLEW_MICROSTEPPING 2 // Runs in half-step mode always

Version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
// So 1.8.99 is ok, but 1.8.234 is not. Neither is 1.123.22
33
// Also, numbers are interpreted as simple numbers. _ __ _
44
// So 1.8 is actually 1.08, meaning that 1.12 is a later version than 1.8. \_(..)_/
5-
#define VERSION "V1.9.37"
5+
#define VERSION "V1.9.38"

boards/RAMPS/pins_RAMPS.hpp

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
/**
2+
* @brief a pins configuration file for a RAMPS 1.4 + Arduino Mega OAT.
3+
*/
4+
5+
#pragma once
6+
7+
// DRIVER_TYPE_TMC2209_UART requires 4 digital pins in Arduino pin numbering
8+
#ifndef RA_STEP_PIN
9+
#define RA_STEP_PIN 54 // STEP
10+
#endif
11+
#ifndef RA_DIR_PIN
12+
#define RA_DIR_PIN 55 // DIR
13+
#endif
14+
#ifndef RA_EN_PIN
15+
#define RA_EN_PIN 38 // Enable
16+
#endif
17+
#ifndef RA_DIAG_PIN
18+
#define RA_DIAG_PIN 43 // only needed for autohome function
19+
#endif
20+
// DRIVER_TYPE_TMC2209_UART requires 2 additional digital pins for SoftwareSerial, can be shared across all drivers
21+
#ifndef RA_SERIAL_PORT_TX
22+
#define RA_SERIAL_PORT_TX 23 // SoftwareSerial TX port
23+
#endif
24+
#ifndef RA_SERIAL_PORT_RX
25+
#define RA_SERIAL_PORT_RX 25 // SoftwareSerial RX port
26+
#endif
27+
#ifndef RA_DRIVER_ADDRESS
28+
#define RA_DRIVER_ADDRESS 0b00
29+
#endif
30+
// DRIVER_TYPE_TMC2209_UART requires 4 digital pins in Arduino pin numbering
31+
#ifndef DEC_STEP_PIN
32+
#define DEC_STEP_PIN 60 // STEP
33+
#endif
34+
#ifndef DEC_DIR_PIN
35+
#define DEC_DIR_PIN 61 // DIR
36+
#endif
37+
#ifndef DEC_EN_PIN
38+
#define DEC_EN_PIN 56 // Enable
39+
#endif
40+
#ifndef DEC_DIAG_PIN
41+
#define DEC_DIAG_PIN 45 // only needed for autohome function
42+
#endif
43+
// DRIVER_TYPE_TMC2209_UART requires 2 additional digital pins for SoftwareSerial, can be shared across all drivers
44+
#ifndef DEC_SERIAL_PORT_TX
45+
#define DEC_SERIAL_PORT_TX 27 // SoftwareSerial TX port
46+
#endif
47+
#ifndef DEC_SERIAL_PORT_RX
48+
#define DEC_SERIAL_PORT_RX 29 // SoftwareSerial RX port
49+
#endif
50+
#ifndef DEC_DRIVER_ADDRESS
51+
#define DEC_DRIVER_ADDRESS 0b00
52+
#endif
53+
54+
#define SW_SERIAL_UART 1
55+
56+
// DRIVER_TYPE_TMC2209_UART requires 4 digital pins in Arduino pin numbering
57+
#ifndef AZ_STEP_PIN
58+
#define AZ_STEP_PIN 46 // STEP
59+
#endif
60+
#ifndef AZ_DIR_PIN
61+
#define AZ_DIR_PIN 48 // DIR
62+
#endif
63+
#ifndef AZ_EN_PIN
64+
#define AZ_EN_PIN 62 // Enable
65+
#endif
66+
#ifndef AZ_DIAG_PIN
67+
#define AZ_DIAG_PIN 47 // only needed for autohome function
68+
#endif
69+
// DRIVER_TYPE_TMC2209_UART requires 2 additional digital pins for SoftwareSerial, can be shared across all drivers
70+
#ifndef AZ_SERIAL_PORT_TX
71+
#define AZ_SERIAL_PORT_TX 31 // SoftwareSerial TX port
72+
#endif
73+
#ifndef AZ_SERIAL_PORT_RX
74+
#define AZ_SERIAL_PORT_RX 33 // SoftwareSerial RX port
75+
#endif
76+
#ifndef AZ_DRIVER_ADDRESS
77+
#define AZ_DRIVER_ADDRESS 0b00
78+
#endif
79+
// DRIVER_TYPE_TMC2209_UART requires 4 digital pins in Arduino pin numbering
80+
#ifndef ALT_STEP_PIN
81+
#define ALT_STEP_PIN 26 // STEP
82+
#endif
83+
#ifndef ALT_DIR_PIN
84+
#define ALT_DIR_PIN 28 // DIR
85+
#endif
86+
#ifndef ALT_EN_PIN
87+
#define ALT_EN_PIN 24 // Enable
88+
#endif
89+
#ifndef ALT_DIAG_PIN
90+
#define ALT_DIAG_PIN 32 // only needed for autohome function
91+
#endif
92+
// DRIVER_TYPE_TMC2209_UART requires 2 additional digital pins for SoftwareSerial, can be shared across all drivers
93+
#ifndef ALT_SERIAL_PORT_TX
94+
#define ALT_SERIAL_PORT_TX 35 // SoftwareSerial TX port
95+
#endif
96+
#ifndef ALT_SERIAL_PORT_RX
97+
#define ALT_SERIAL_PORT_RX 37 // SoftwareSerial RX port
98+
#endif
99+
#ifndef ALT_DRIVER_ADDRESS
100+
#define ALT_DRIVER_ADDRESS 0b00
101+
#endif
102+
103+
// DRIVER_TYPE_TMC2209_UART requires 4 digital pins in Arduino pin numbering. This is the E1 port.
104+
#ifndef FOCUS_STEP_PIN
105+
#define FOCUS_STEP_PIN 36 // STEP
106+
#endif
107+
#ifndef FOCUS_DIR_PIN
108+
#define FOCUS_DIR_PIN 34 // DIR
109+
#endif
110+
#ifndef FOCUS_EN_PIN
111+
#define FOCUS_EN_PIN 30 // Enable
112+
#endif
113+
#ifndef FOCUS_DIAG_PIN
114+
#define FOCUS_DIAG_PIN 49 // only needed for autohome function
115+
#endif
116+
// DRIVER_TYPE_TMC2209_UART requires 2 additional digital pins for SoftwareSerial, can be shared across all drivers
117+
#ifndef FOCUS_SERIAL_PORT_TX
118+
#define FOCUS_SERIAL_PORT_TX 39 // SoftwareSerial TX port
119+
#endif
120+
#ifndef FOCUS_SERIAL_PORT_RX
121+
#define FOCUS_SERIAL_PORT_RX 41 // SoftwareSerial RX port
122+
#endif
123+
#ifndef FOCUS_DRIVER_ADDRESS
124+
#define FOCUS_DRIVER_ADDRESS 0b00
125+
#endif
126+
127+
// RA Homing pin for Hall sensor
128+
#ifndef RA_HOMING_SENSOR_PIN
129+
#define RA_HOMING_SENSOR_PIN 53
130+
#endif
131+
132+
//GPS pin configuration
133+
#ifndef GPS_SERIAL_PORT
134+
#define GPS_SERIAL_PORT Serial2 // Pins 16 and 17
135+
#endif
136+
137+
// DISPLAY_TYPE_LCD_KEYPAD requires 6 digital & 1 analog output in Arduino pin numbering
138+
#ifndef LCD_PIN4
139+
#define LCD_PIN4 63
140+
#endif
141+
#ifndef LCD_PIN5
142+
#define LCD_PIN5 40
143+
#endif
144+
#ifndef LCD_PIN6
145+
#define LCD_PIN6 42
146+
#endif
147+
#ifndef LCD_PIN7
148+
#define LCD_PIN7 59
149+
#endif
150+
#ifndef LCD_PIN8
151+
#define LCD_PIN8 64
152+
#endif
153+
#ifndef LCD_PIN9
154+
#define LCD_PIN9 44
155+
#endif
156+
157+
// DISPLAY_TYPE_LCD_KEYPAD requires 1 analog input in Arduino pin numbering
158+
#ifndef LCD_KEY_SENSE_PIN
159+
#define LCD_KEY_SENSE_PIN 65
160+
#endif
161+
162+
//Pin to turn on dew heater MOSFET
163+
#ifndef DEW_HEATER_PIN
164+
#define DEW_HEATER_PIN 10
165+
#endif

matrix_build.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"mksgenlv2",
1919
"mksgenlv1",
2020
"esp32",
21+
"ramps",
2122
]
2223

2324
STEPPER_TYPES = [
@@ -162,6 +163,29 @@ def update_dict(orig, patch):
162163
"STEPPER_TYPE_NONE"
163164
],
164165
}),
166+
"ramps": update_dict(BUILD_FLAGS, {
167+
"USE_GPS": [0],
168+
"USE_GYRO_LEVEL": [0],
169+
"DISPLAY_TYPE": [
170+
"DISPLAY_TYPE_NONE",
171+
"DISPLAY_TYPE_LCD_KEYPAD"
172+
],
173+
"RA_STEPPER_TYPE": [
174+
"STEPPER_TYPE_NEMA17"
175+
],
176+
"DEC_STEPPER_TYPE": [
177+
"STEPPER_TYPE_NEMA17"
178+
],
179+
"AZ_STEPPER_TYPE": [
180+
"STEPPER_TYPE_NEMA17"
181+
],
182+
"ALT_STEPPER_TYPE": [
183+
"STEPPER_TYPE_NEMA17"
184+
],
185+
"FOCUS_STEPPER_TYPE": [
186+
"STEPPER_TYPE_NEMA17"
187+
],
188+
}),
165189
}
166190

167191
SHORT_STRINGS = {

platformio.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ lib_deps =
8585
${common.lib_deps}
8686
jdolinay/avr-debugger @ 1.2
8787

88+
[env:ramps]
89+
extends = env:mega2560
90+
build_flags =
91+
${env.build_flags}
92+
-D BOARD=BOARD_AVR_RAMPS
93+
8894
[env:mksgenlv21]
8995
extends = env:mega2560
9096
build_flags =

0 commit comments

Comments
 (0)