diff --git a/Changelog.md b/Changelog.md index 2cd97660..472ce718 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,6 @@ +**V1.9.38 - Updates** +- Add support for RAMPS 1.4 Arduino Mega shields + **V1.9.37 - Updates** - Add HE1 to dew heater output for MKS boards diff --git a/Configuration.hpp b/Configuration.hpp index 27cc7a25..ebc06504 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -235,6 +235,8 @@ // Append board specific pins data. #if (BOARD == BOARD_AVR_MEGA2560) #include "boards/AVR_MEGA2560/pins_MEGA2560.hpp" +#elif (BOARD == BOARD_RAMPS) + #include "boards/RAMPS/pins_RAMPS.hpp" #elif (BOARD == BOARD_ESP32_ESP32DEV) #include "boards/ESP32_ESP32DEV/pins_ESP32DEV.hpp" #elif (BOARD == BOARD_AVR_MKS_GEN_L_V1) diff --git a/ConfigurationValidation.hpp b/ConfigurationValidation.hpp index 6dda19e4..590a96f3 100644 --- a/ConfigurationValidation.hpp +++ b/ConfigurationValidation.hpp @@ -244,7 +244,8 @@ // Required pin assignments missing #error Missing pin assignments for configured DEC DRIVER_TYPE_A4988_GENERIC or DRIVER_TYPE_TMC2209_STANDALONE driver #endif - #if (!defined(DEC_MS0_PIN) || !defined(DEC_MS1_PIN) || !defined(DEC_MS2_PIN)) && (BOARD != BOARD_AVR_MKS_GEN_L_V1) + #if (!defined(DEC_MS0_PIN) || !defined(DEC_MS1_PIN) || !defined(DEC_MS2_PIN)) \ + && (BOARD != BOARD_AVR_MKS_GEN_L_V1 && BOARD != BOARD_AVR_RAMPS) #warning Missing pin assignments for MS pins #endif #elif (DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) @@ -268,7 +269,8 @@ // Required pin assignments missing #error Missing pin assignments for configured RA DRIVER_TYPE_A4988_GENERIC or DRIVER_TYPE_TMC2209_STANDALONE driver #endif - #if (!defined(RA_MS0_PIN) || !defined(RA_MS1_PIN) || !defined(RA_MS2_PIN)) && (BOARD != BOARD_AVR_MKS_GEN_L_V1) + #if (!defined(RA_MS0_PIN) || !defined(RA_MS1_PIN) || !defined(RA_MS2_PIN)) \ + && (BOARD != BOARD_AVR_MKS_GEN_L_V1 && BOARD != BOARD_AVR_RAMPS) #warning Missing pin assignments for MS pins #endif #elif (RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) diff --git a/Configuration_adv.hpp b/Configuration_adv.hpp index c7b7af6e..fe1a3dea 100644 --- a/Configuration_adv.hpp +++ b/Configuration_adv.hpp @@ -105,7 +105,9 @@ #define RA_UART_STEALTH_MODE 0 #endif #elif (RA_DRIVER_TYPE == DRIVER_TYPE_A4988_GENERIC) || (RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_STANDALONE) - #define RA_SLEW_MICROSTEPPING 8 // Microstep mode set by MS pin strapping. Use the same microstep mode for both slewing & tracking + #ifndef RA_SLEW_MICROSTEPPING + #define RA_SLEW_MICROSTEPPING 8 // Microstep mode set by MS pin strapping. Use the same microstep mode for both slewing & tracking + #endif #define RA_TRACKING_MICROSTEPPING RA_SLEW_MICROSTEPPING #elif (RA_DRIVER_TYPE == DRIVER_TYPE_ULN2003) #define RA_SLEW_MICROSTEPPING 2 // The (default) half-step mode used for slewing RA axis @@ -125,8 +127,10 @@ #define DEC_UART_STEALTH_MODE 0 #endif #elif (DEC_DRIVER_TYPE == DRIVER_TYPE_A4988_GENERIC) || (DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_STANDALONE) - #define DEC_SLEW_MICROSTEPPING \ - 16 // Only UART drivers support dynamic switching. Use the same microstep mode for both slewing & guiding + #ifndef DEC_SLEW_MICROSTEPPING + #define DEC_SLEW_MICROSTEPPING \ + 16 // Only UART drivers support dynamic switching. Use the same microstep mode for both slewing & guiding + #endif #define DEC_GUIDE_MICROSTEPPING DEC_SLEW_MICROSTEPPING #elif (DEC_DRIVER_TYPE == DRIVER_TYPE_ULN2003) #define DEC_SLEW_MICROSTEPPING 2 // Runs in half-step mode always diff --git a/Version.h b/Version.h index 5b553a1c..c5f76c72 100644 --- a/Version.h +++ b/Version.h @@ -2,4 +2,4 @@ // So 1.8.99 is ok, but 1.8.234 is not. Neither is 1.123.22 // Also, numbers are interpreted as simple numbers. _ __ _ // So 1.8 is actually 1.08, meaning that 1.12 is a later version than 1.8. \_(..)_/ -#define VERSION "V1.9.37" +#define VERSION "V1.9.38" diff --git a/boards/RAMPS/pins_RAMPS.hpp b/boards/RAMPS/pins_RAMPS.hpp new file mode 100644 index 00000000..70502e36 --- /dev/null +++ b/boards/RAMPS/pins_RAMPS.hpp @@ -0,0 +1,165 @@ +/** + * @brief a pins configuration file for a RAMPS 1.4 + Arduino Mega OAT. + */ + +#pragma once + +// DRIVER_TYPE_TMC2209_UART requires 4 digital pins in Arduino pin numbering +#ifndef RA_STEP_PIN + #define RA_STEP_PIN 54 // STEP +#endif +#ifndef RA_DIR_PIN + #define RA_DIR_PIN 55 // DIR +#endif +#ifndef RA_EN_PIN + #define RA_EN_PIN 38 // Enable +#endif +#ifndef RA_DIAG_PIN + #define RA_DIAG_PIN 43 // only needed for autohome function +#endif +// DRIVER_TYPE_TMC2209_UART requires 2 additional digital pins for SoftwareSerial, can be shared across all drivers +#ifndef RA_SERIAL_PORT_TX + #define RA_SERIAL_PORT_TX 23 // SoftwareSerial TX port +#endif +#ifndef RA_SERIAL_PORT_RX + #define RA_SERIAL_PORT_RX 25 // SoftwareSerial RX port +#endif +#ifndef RA_DRIVER_ADDRESS + #define RA_DRIVER_ADDRESS 0b00 +#endif +// DRIVER_TYPE_TMC2209_UART requires 4 digital pins in Arduino pin numbering +#ifndef DEC_STEP_PIN + #define DEC_STEP_PIN 60 // STEP +#endif +#ifndef DEC_DIR_PIN + #define DEC_DIR_PIN 61 // DIR +#endif +#ifndef DEC_EN_PIN + #define DEC_EN_PIN 56 // Enable +#endif +#ifndef DEC_DIAG_PIN + #define DEC_DIAG_PIN 45 // only needed for autohome function +#endif +// DRIVER_TYPE_TMC2209_UART requires 2 additional digital pins for SoftwareSerial, can be shared across all drivers +#ifndef DEC_SERIAL_PORT_TX + #define DEC_SERIAL_PORT_TX 27 // SoftwareSerial TX port +#endif +#ifndef DEC_SERIAL_PORT_RX + #define DEC_SERIAL_PORT_RX 29 // SoftwareSerial RX port +#endif +#ifndef DEC_DRIVER_ADDRESS + #define DEC_DRIVER_ADDRESS 0b00 +#endif + +#define SW_SERIAL_UART 1 + +// DRIVER_TYPE_TMC2209_UART requires 4 digital pins in Arduino pin numbering +#ifndef AZ_STEP_PIN + #define AZ_STEP_PIN 46 // STEP +#endif +#ifndef AZ_DIR_PIN + #define AZ_DIR_PIN 48 // DIR +#endif +#ifndef AZ_EN_PIN + #define AZ_EN_PIN 62 // Enable +#endif +#ifndef AZ_DIAG_PIN + #define AZ_DIAG_PIN 47 // only needed for autohome function +#endif +// DRIVER_TYPE_TMC2209_UART requires 2 additional digital pins for SoftwareSerial, can be shared across all drivers +#ifndef AZ_SERIAL_PORT_TX + #define AZ_SERIAL_PORT_TX 31 // SoftwareSerial TX port +#endif +#ifndef AZ_SERIAL_PORT_RX + #define AZ_SERIAL_PORT_RX 33 // SoftwareSerial RX port +#endif +#ifndef AZ_DRIVER_ADDRESS + #define AZ_DRIVER_ADDRESS 0b00 +#endif +// DRIVER_TYPE_TMC2209_UART requires 4 digital pins in Arduino pin numbering +#ifndef ALT_STEP_PIN + #define ALT_STEP_PIN 26 // STEP +#endif +#ifndef ALT_DIR_PIN + #define ALT_DIR_PIN 28 // DIR +#endif +#ifndef ALT_EN_PIN + #define ALT_EN_PIN 24 // Enable +#endif +#ifndef ALT_DIAG_PIN + #define ALT_DIAG_PIN 32 // only needed for autohome function +#endif +// DRIVER_TYPE_TMC2209_UART requires 2 additional digital pins for SoftwareSerial, can be shared across all drivers +#ifndef ALT_SERIAL_PORT_TX + #define ALT_SERIAL_PORT_TX 35 // SoftwareSerial TX port +#endif +#ifndef ALT_SERIAL_PORT_RX + #define ALT_SERIAL_PORT_RX 37 // SoftwareSerial RX port +#endif +#ifndef ALT_DRIVER_ADDRESS + #define ALT_DRIVER_ADDRESS 0b00 +#endif + +// DRIVER_TYPE_TMC2209_UART requires 4 digital pins in Arduino pin numbering. This is the E1 port. +#ifndef FOCUS_STEP_PIN + #define FOCUS_STEP_PIN 36 // STEP +#endif +#ifndef FOCUS_DIR_PIN + #define FOCUS_DIR_PIN 34 // DIR +#endif +#ifndef FOCUS_EN_PIN + #define FOCUS_EN_PIN 30 // Enable +#endif +#ifndef FOCUS_DIAG_PIN + #define FOCUS_DIAG_PIN 49 // only needed for autohome function +#endif +// DRIVER_TYPE_TMC2209_UART requires 2 additional digital pins for SoftwareSerial, can be shared across all drivers +#ifndef FOCUS_SERIAL_PORT_TX + #define FOCUS_SERIAL_PORT_TX 39 // SoftwareSerial TX port +#endif +#ifndef FOCUS_SERIAL_PORT_RX + #define FOCUS_SERIAL_PORT_RX 41 // SoftwareSerial RX port +#endif +#ifndef FOCUS_DRIVER_ADDRESS + #define FOCUS_DRIVER_ADDRESS 0b00 +#endif + +// RA Homing pin for Hall sensor +#ifndef RA_HOMING_SENSOR_PIN + #define RA_HOMING_SENSOR_PIN 53 +#endif + +//GPS pin configuration +#ifndef GPS_SERIAL_PORT + #define GPS_SERIAL_PORT Serial2 // Pins 16 and 17 +#endif + +// DISPLAY_TYPE_LCD_KEYPAD requires 6 digital & 1 analog output in Arduino pin numbering +#ifndef LCD_PIN4 + #define LCD_PIN4 63 +#endif +#ifndef LCD_PIN5 + #define LCD_PIN5 40 +#endif +#ifndef LCD_PIN6 + #define LCD_PIN6 42 +#endif +#ifndef LCD_PIN7 + #define LCD_PIN7 59 +#endif +#ifndef LCD_PIN8 + #define LCD_PIN8 64 +#endif +#ifndef LCD_PIN9 + #define LCD_PIN9 44 +#endif + +// DISPLAY_TYPE_LCD_KEYPAD requires 1 analog input in Arduino pin numbering +#ifndef LCD_KEY_SENSE_PIN + #define LCD_KEY_SENSE_PIN 65 +#endif + +//Pin to turn on dew heater MOSFET +#ifndef DEW_HEATER_PIN + #define DEW_HEATER_PIN 10 +#endif diff --git a/matrix_build.py b/matrix_build.py index bac82530..b2464421 100644 --- a/matrix_build.py +++ b/matrix_build.py @@ -18,6 +18,7 @@ "mksgenlv2", "mksgenlv1", "esp32", + "ramps", ] STEPPER_TYPES = [ @@ -162,6 +163,29 @@ def update_dict(orig, patch): "STEPPER_TYPE_NONE" ], }), + "ramps": update_dict(BUILD_FLAGS, { + "USE_GPS": [0], + "USE_GYRO_LEVEL": [0], + "DISPLAY_TYPE": [ + "DISPLAY_TYPE_NONE", + "DISPLAY_TYPE_LCD_KEYPAD" + ], + "RA_STEPPER_TYPE": [ + "STEPPER_TYPE_NEMA17" + ], + "DEC_STEPPER_TYPE": [ + "STEPPER_TYPE_NEMA17" + ], + "AZ_STEPPER_TYPE": [ + "STEPPER_TYPE_NEMA17" + ], + "ALT_STEPPER_TYPE": [ + "STEPPER_TYPE_NEMA17" + ], + "FOCUS_STEPPER_TYPE": [ + "STEPPER_TYPE_NEMA17" + ], + }), } SHORT_STRINGS = { diff --git a/platformio.ini b/platformio.ini index 9ddb1913..78a4d0ed 100644 --- a/platformio.ini +++ b/platformio.ini @@ -85,6 +85,12 @@ lib_deps = ${common.lib_deps} jdolinay/avr-debugger @ 1.2 +[env:ramps] +extends = env:mega2560 +build_flags = + ${env.build_flags} + -D BOARD=BOARD_AVR_RAMPS + [env:mksgenlv21] extends = env:mega2560 build_flags =