From 72f5c60c8c407a2d5826d80a4c4060d97b626dfd Mon Sep 17 00:00:00 2001 From: Sergey Date: Wed, 13 Oct 2021 16:05:44 +0300 Subject: [PATCH] Squashed commit of the following: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit b18aa933d14f9761d74b19be79db64e21356c563 Author: ellensp <530024+ellensp@users.noreply.github.com> Date: Wed Oct 13 14:28:45 2021 +1300 🐛 Fix G33 homing current (#22909) commit 0f519ebf854cdb0fd3d00828ca7a4b4d09c8d610 Author: mks-viva <1224833100@qq.com> Date: Tue Oct 12 20:01:18 2021 -0500 ✨ MKS Eagle (STM32F407VET6) board (#22897) commit 031f17b4f3dfca4a66384d40ce48b7d33315c75a Author: Minims Date: Sun Oct 10 01:10:21 2021 +0200 🩹 Adjust GTR 1.0 ST7920 display delay (#22904) commit 036f763eaaff571f07c7829e0f5a61b645e86269 Author: ellensp <530024+ellensp@users.noreply.github.com> Date: Thu Oct 7 09:42:59 2021 +1300 🎨 Define Octopus allocated endstop pins (#22882) Co-authored-by: Scott Lahteine commit d137f307ebea8c8832ecbef239ed08e188c5369b Author: Scott Lahteine Date: Mon Oct 4 22:19:05 2021 -0500 🎨 Tweak FORCE_INLINE commit 66048a5f27aa3ad9ecb2b407ada13fb87e86ebe9 Author: Mark Date: Tue Oct 5 12:23:02 2021 +0800 ✨ ESP32 Panda_ZHU and Panda_M4 (#22644) commit b8c32e24d86fff280621ab3f274511dd30669b93 Author: Scott Lahteine Date: Sat Oct 2 02:33:14 2021 -0500 🎨 Rename MarlinUI::zoffset_overlay commit 99d51af90facd02365d0ae91091303d7879f304d Author: Scott Lahteine Date: Tue Oct 5 21:35:31 2021 -0500 🔨 Port libsdl2_net required for macOS simulator commit f47ece0725d93cde7fde52b66d14b5ec551c46c2 Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Tue Oct 12 19:06:39 2021 -0700 🐛 Fix MKS Robin Pro 1.0 LCD reset pin (#22937) commit 975089a954460b10279bdbf60f08c9604c4f7d08 Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Tue Oct 12 19:05:37 2021 -0700 🔧 Remove obsolete G34 sanity check (#22929) commit 995230f5971995e41b97d14273f2dd3693ead6be Author: George Fu Date: Wed Oct 13 09:32:54 2021 +0800 🐛 Fix FYSETC Cheetah v2.0 build (#22926) commit adf7072fa846312d473a993ffc62ec3082b37c46 Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Tue Oct 12 18:26:42 2021 -0700 🐛 Fix SKR Mini E3 V2 I2C-based EEPROM (#22919) Followup to #20609 --- Marlin/src/HAL/AVR/HAL_SPI.cpp | 4 +- Marlin/src/HAL/ESP32/HAL.cpp | 28 +- Marlin/src/HAL/ESP32/HAL.h | 4 + Marlin/src/HAL/ESP32/HAL_SPI.cpp | 6 +- Marlin/src/HAL/ESP32/esp32.csv | 6 + Marlin/src/HAL/ESP32/fastio.h | 20 +- Marlin/src/HAL/ESP32/i2s.cpp | 3 + Marlin/src/HAL/ESP32/watchdog.h | 2 +- Marlin/src/HAL/STM32/HAL_SPI.cpp | 4 +- Marlin/src/HAL/TEENSY31_32/HAL_SPI.cpp | 5 +- Marlin/src/HAL/TEENSY35_36/HAL_SPI.cpp | 5 +- Marlin/src/HAL/TEENSY40_41/HAL_SPI.cpp | 7 +- Marlin/src/HAL/shared/Marduino.h | 2 +- Marlin/src/core/boards.h | 3 + Marlin/src/gcode/calibrate/G33.cpp | 4 +- Marlin/src/gcode/sd/M1001.cpp | 1 + Marlin/src/inc/SanityCheck.h | 18 +- Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 10 +- Marlin/src/lcd/e3v2/marlinui/ui_common.cpp | 14 +- Marlin/src/lcd/marlinui.cpp | 14 + Marlin/src/lcd/marlinui.h | 5 + Marlin/src/lcd/menu/menu.cpp | 5 +- Marlin/src/lcd/menu/menu.h | 4 - Marlin/src/lcd/menu/menu_ubl.cpp | 2 +- Marlin/src/pins/esp32/pins_PANDA_M4.h | 38 ++ Marlin/src/pins/esp32/pins_PANDA_ZHU.h | 61 +++ Marlin/src/pins/esp32/pins_PANDA_common.h | 98 +++++ Marlin/src/pins/pins.h | 6 + .../pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h | 3 + Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h | 2 +- Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h | 6 +- .../pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h | 29 +- Marlin/src/pins/stm32f4/pins_MKS_EAGLE.h | 35 ++ .../src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h | 343 +--------------- .../stm32f4/pins_MKS_ROBIN_NANO_V3_common.h | 375 ++++++++++++++++++ .../boards/marlin_FYSETC_CHEETAH_V20.json | 3 +- .../MARLIN_FYSETC_CHEETAH_V20/ldscript.ld | 2 +- ini/esp32.ini | 10 + ini/native.ini | 11 +- ini/stm32f1-maple.ini | 6 +- ini/stm32f4.ini | 46 ++- 41 files changed, 822 insertions(+), 428 deletions(-) create mode 100644 Marlin/src/HAL/ESP32/esp32.csv create mode 100644 Marlin/src/pins/esp32/pins_PANDA_M4.h create mode 100644 Marlin/src/pins/esp32/pins_PANDA_ZHU.h create mode 100644 Marlin/src/pins/esp32/pins_PANDA_common.h create mode 100644 Marlin/src/pins/stm32f4/pins_MKS_EAGLE.h create mode 100644 Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h diff --git a/Marlin/src/HAL/AVR/HAL_SPI.cpp b/Marlin/src/HAL/AVR/HAL_SPI.cpp index 319d64c8f6..8784bb07b3 100644 --- a/Marlin/src/HAL/AVR/HAL_SPI.cpp +++ b/Marlin/src/HAL/AVR/HAL_SPI.cpp @@ -34,7 +34,9 @@ #include "../../inc/MarlinConfig.h" void spiBegin() { - OUT_WRITE(SD_SS_PIN, HIGH); + #if PIN_EXISTS(SD_SS) + OUT_WRITE(SD_SS_PIN, HIGH); + #endif SET_OUTPUT(SD_SCK_PIN); SET_INPUT(SD_MISO_PIN); SET_OUTPUT(SD_MOSI_PIN); diff --git a/Marlin/src/HAL/ESP32/HAL.cpp b/Marlin/src/HAL/ESP32/HAL.cpp index 7818dbdd87..6a66d519b3 100644 --- a/Marlin/src/HAL/ESP32/HAL.cpp +++ b/Marlin/src/HAL/ESP32/HAL.cpp @@ -28,6 +28,10 @@ #include #include +#if ENABLED(USE_ESP32_TASK_WDT) + #include +#endif + #if ENABLED(WIFISUPPORT) #include #include "wifi.h" @@ -90,8 +94,24 @@ volatile int numPWMUsed = 0, #endif -void HAL_init_board() { +#if ENABLED(USE_ESP32_EXIO) + HardwareSerial YSerial2(2); + + void Write_EXIO(uint8_t IO, uint8_t v) { + if (ISRS_ENABLED()) { + DISABLE_ISRS(); + YSerial2.write(0x80 | (((char)v) << 5) | (IO - 100)); + ENABLE_ISRS(); + } + else + YSerial2.write(0x80 | (((char)v) << 5) | (IO - 100)); + } +#endif +void HAL_init_board() { + #if ENABLED(USE_ESP32_TASK_WDT) + esp_task_wdt_init(10, true); + #endif #if ENABLED(ESP3D_WIFISUPPORT) esp3dlib.init(); #elif ENABLED(WIFISUPPORT) @@ -127,7 +147,11 @@ void HAL_init_board() { // Initialize the i2s peripheral only if the I2S stepper stream is enabled. // The following initialization is performed after Serial1 and Serial2 are defined as // their native pins might conflict with the i2s stream even when they are remapped. - TERN_(I2S_STEPPER_STREAM, i2s_init()); + #if ENABLED(USE_ESP32_EXIO) + YSerial2.begin(460800 * 3, SERIAL_8N1, 16, 17); + #elif ENABLED(I2S_STEPPER_STREAM) + i2s_init(); + #endif } void HAL_idletask() { diff --git a/Marlin/src/HAL/ESP32/HAL.h b/Marlin/src/HAL/ESP32/HAL.h index 0f92052030..bc0ce4e037 100644 --- a/Marlin/src/HAL/ESP32/HAL.h +++ b/Marlin/src/HAL/ESP32/HAL.h @@ -142,6 +142,10 @@ void HAL_idletask(); inline void HAL_init() {} void HAL_init_board(); +#if ENABLED(USE_ESP32_EXIO) + void Write_EXIO(uint8_t IO, uint8_t v); +#endif + // // Delay in cycles (used by DELAY_NS / DELAY_US) // diff --git a/Marlin/src/HAL/ESP32/HAL_SPI.cpp b/Marlin/src/HAL/ESP32/HAL_SPI.cpp index 8743ac5be2..868ab1b671 100644 --- a/Marlin/src/HAL/ESP32/HAL_SPI.cpp +++ b/Marlin/src/HAL/ESP32/HAL_SPI.cpp @@ -53,11 +53,9 @@ static SPISettings spiConfig; // ------------------------ void spiBegin() { - #if !PIN_EXISTS(SD_SS) - #error "SD_SS_PIN not defined!" + #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_SS) + OUT_WRITE(SD_SS_PIN, HIGH); #endif - - OUT_WRITE(SD_SS_PIN, HIGH); } void spiInit(uint8_t spiRate) { diff --git a/Marlin/src/HAL/ESP32/esp32.csv b/Marlin/src/HAL/ESP32/esp32.csv new file mode 100644 index 0000000000..8f6e101f02 --- /dev/null +++ b/Marlin/src/HAL/ESP32/esp32.csv @@ -0,0 +1,6 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x5000, +otadata, data, ota, 0xe000, 0x2000, +app0, app, ota_0, 0x10000, 0x180000, +app1, app, ota_1, 0x190000, 0x180000, +spiffs, data, spiffs, 0x310000, 0xF0000, diff --git a/Marlin/src/HAL/ESP32/fastio.h b/Marlin/src/HAL/ESP32/fastio.h index 8db89dca12..c8e3f7e343 100644 --- a/Marlin/src/HAL/ESP32/fastio.h +++ b/Marlin/src/HAL/ESP32/fastio.h @@ -40,13 +40,19 @@ // Set pin as input with pullup mode #define _PULLUP(IO, v) pinMode(IO, v ? INPUT_PULLUP : INPUT) -// Read a pin wrapper -#define READ(IO) (IS_I2S_EXPANDER_PIN(IO) ? i2s_state(I2S_EXPANDER_PIN_INDEX(IO)) : digitalRead(IO)) - -// Write to a pin wrapper -#define WRITE(IO, v) (IS_I2S_EXPANDER_PIN(IO) ? i2s_write(I2S_EXPANDER_PIN_INDEX(IO), v) : digitalWrite(IO, v)) - -// Set pin as input wrapper +#if ENABLED(USE_ESP32_EXIO) + // Read a pin wrapper + #define READ(IO) digitalRead(IO) + // Write to a pin wrapper + #define WRITE(IO, v) (IO >= 100 ? Write_EXIO(IO, v) : digitalWrite(IO, v)) +#else + // Read a pin wrapper + #define READ(IO) (IS_I2S_EXPANDER_PIN(IO) ? i2s_state(I2S_EXPANDER_PIN_INDEX(IO)) : digitalRead(IO)) + // Write to a pin wrapper + #define WRITE(IO, v) (IS_I2S_EXPANDER_PIN(IO) ? i2s_write(I2S_EXPANDER_PIN_INDEX(IO), v) : digitalWrite(IO, v)) +#endif + +// Set pin as input wrapper (0x80 | (v << 5) | (IO - 100)) #define SET_INPUT(IO) _SET_INPUT(IO) // Set pin as input with pullup wrapper diff --git a/Marlin/src/HAL/ESP32/i2s.cpp b/Marlin/src/HAL/ESP32/i2s.cpp index c28c008793..557ea319e6 100644 --- a/Marlin/src/HAL/ESP32/i2s.cpp +++ b/Marlin/src/HAL/ESP32/i2s.cpp @@ -23,6 +23,8 @@ #include "../../inc/MarlinConfigPre.h" +#if DISABLED(USE_ESP32_EXIO) + #include "i2s.h" #include "../shared/Marduino.h" @@ -340,4 +342,5 @@ void i2s_push_sample() { dma.current[dma.rw_pos++] = i2s_port_data; } +#endif // !USE_ESP32_EXIO #endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/ESP32/watchdog.h b/Marlin/src/HAL/ESP32/watchdog.h index b6c169e347..43db813076 100644 --- a/Marlin/src/HAL/ESP32/watchdog.h +++ b/Marlin/src/HAL/ESP32/watchdog.h @@ -25,7 +25,7 @@ extern "C" { #endif - esp_err_t esp_task_wdt_reset(); + esp_err_t esp_task_wdt_reset(); #ifdef __cplusplus } diff --git a/Marlin/src/HAL/STM32/HAL_SPI.cpp b/Marlin/src/HAL/STM32/HAL_SPI.cpp index 85a5238b54..8ee4761647 100644 --- a/Marlin/src/HAL/STM32/HAL_SPI.cpp +++ b/Marlin/src/HAL/STM32/HAL_SPI.cpp @@ -47,7 +47,9 @@ static SPISettings spiConfig; #include "../shared/Delay.h" void spiBegin(void) { - OUT_WRITE(SD_SS_PIN, HIGH); + #if PIN_EXISTS(SD_SS) + OUT_WRITE(SD_SS_PIN, HIGH); + #endif OUT_WRITE(SD_SCK_PIN, HIGH); SET_INPUT(SD_MISO_PIN); OUT_WRITE(SD_MOSI_PIN, HIGH); diff --git a/Marlin/src/HAL/TEENSY31_32/HAL_SPI.cpp b/Marlin/src/HAL/TEENSY31_32/HAL_SPI.cpp index ff84e91f79..415c692229 100644 --- a/Marlin/src/HAL/TEENSY31_32/HAL_SPI.cpp +++ b/Marlin/src/HAL/TEENSY31_32/HAL_SPI.cpp @@ -36,10 +36,9 @@ static SPISettings spiConfig; // Initialize SPI bus void spiBegin() { - #if !PIN_EXISTS(SD_SS) - #error "SD_SS_PIN not defined!" + #if PIN_EXISTS(SD_SS) + OUT_WRITE(SD_SS_PIN, HIGH); #endif - OUT_WRITE(SD_SS_PIN, HIGH); SET_OUTPUT(SD_SCK_PIN); SET_INPUT(SD_MISO_PIN); SET_OUTPUT(SD_MOSI_PIN); diff --git a/Marlin/src/HAL/TEENSY35_36/HAL_SPI.cpp b/Marlin/src/HAL/TEENSY35_36/HAL_SPI.cpp index e63ab1c0e3..d80f57b2c4 100644 --- a/Marlin/src/HAL/TEENSY35_36/HAL_SPI.cpp +++ b/Marlin/src/HAL/TEENSY35_36/HAL_SPI.cpp @@ -36,10 +36,9 @@ static SPISettings spiConfig; void spiBegin() { - #if !PIN_EXISTS(SD_SS) - #error "SD_SS_PIN not defined!" + #if PIN_EXISTS(SD_SS) + OUT_WRITE(SD_SS_PIN, HIGH); #endif - OUT_WRITE(SD_SS_PIN, HIGH); SET_OUTPUT(SD_SCK_PIN); SET_INPUT(SD_MISO_PIN); SET_OUTPUT(SD_MOSI_PIN); diff --git a/Marlin/src/HAL/TEENSY40_41/HAL_SPI.cpp b/Marlin/src/HAL/TEENSY40_41/HAL_SPI.cpp index 610765ad49..9dcb812faf 100644 --- a/Marlin/src/HAL/TEENSY40_41/HAL_SPI.cpp +++ b/Marlin/src/HAL/TEENSY40_41/HAL_SPI.cpp @@ -51,12 +51,9 @@ static SPISettings spiConfig; // ------------------------ void spiBegin() { - #ifndef SD_SS_PIN - #error "SD_SS_PIN is not defined!" + #if PIN_EXISTS(SD_SS) + OUT_WRITE(SD_SS_PIN, HIGH); #endif - - OUT_WRITE(SD_SS_PIN, HIGH); - //SET_OUTPUT(SD_SCK_PIN); //SET_INPUT(SD_MISO_PIN); //SET_OUTPUT(SD_MOSI_PIN); diff --git a/Marlin/src/HAL/shared/Marduino.h b/Marlin/src/HAL/shared/Marduino.h index 56be8d7211..ddc3451fbe 100644 --- a/Marlin/src/HAL/shared/Marduino.h +++ b/Marlin/src/HAL/shared/Marduino.h @@ -83,7 +83,7 @@ #endif #ifndef FORCE_INLINE - #define FORCE_INLINE inline __attribute__((always_inline)) + #define FORCE_INLINE __attribute__((always_inline)) inline #endif #include "progmem.h" diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 46b2e5cf0c..dd08f6a1b4 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -402,6 +402,7 @@ #define BOARD_TH3D_EZBOARD_LITE_V2 4232 // TH3D EZBoard Lite v2.0 #define BOARD_INDEX_REV03 4233 // Index PnP Controller REV03 (STM32F407VET6/VGT6) #define BOARD_MKS_ROBIN_NANO_V1_3_F4 4234 // MKS Robin Nano V1.3 and MKS Robin Nano-S V1.3 (STM32F407VET6) +#define BOARD_MKS_EAGLE 4235 // MKS Eagle (STM32F407VET6) // // ARM Cortex M7 @@ -422,6 +423,8 @@ #define BOARD_MRR_ESPE 6002 // MRR ESPE based on ESP32 (with I2S stepper stream) #define BOARD_E4D_BOX 6003 // E4d@BOX #define BOARD_FYSETC_E4 6004 // FYSETC E4 +#define BOARD_PANDA_ZHU 6005 // Panda_ZHU +#define BOARD_PANDA_M4 6006 // Panda_M4 // // SAMD51 ARM Cortex M4 diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index 8867c168d2..24a985299f 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -73,9 +73,9 @@ float dcr; void ac_home() { endstops.enable(true); - TERN_(SENSORLESS_HOMING, probe.set_homing_current(true)); + TERN_(HAS_DELTA_SENSORLESS_PROBING, probe.set_homing_current(true)); home_delta(); - TERN_(SENSORLESS_HOMING, probe.set_homing_current(false)); + TERN_(HAS_DELTA_SENSORLESS_PROBING, probe.set_homing_current(false)); endstops.not_homing(); } diff --git a/Marlin/src/gcode/sd/M1001.cpp b/Marlin/src/gcode/sd/M1001.cpp index f5ee6a94d1..032ec1f198 100644 --- a/Marlin/src/gcode/sd/M1001.cpp +++ b/Marlin/src/gcode/sd/M1001.cpp @@ -27,6 +27,7 @@ #include "../gcode.h" #include "../../module/planner.h" #include "../../module/printcounter.h" +#include "../../module/temperature.h" #include "../../sd/cardreader.h" #ifdef SD_FINISHED_RELEASECOMMAND diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 58c02e7ebd..cb3314b25f 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -597,9 +597,9 @@ #error "SPINDLE_LASER_PWM (true) is now set with SPINDLE_LASER_USE_PWM (enabled)." #endif -#if MOTHERBOARD == BOARD_DUE3DOM_MINI && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD) +#if MB(DUE3DOM_MINI) && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD) #warning "Onboard temperature sensor for BOARD_DUE3DOM_MINI has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)." -#elif MOTHERBOARD == BOARD_BTT_SKR_E3_TURBO && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD) +#elif MB(BTT_SKR_E3_TURBO) && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD) #warning "Onboard temperature sensor for BOARD_BTT_SKR_E3_TURBO has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)." #endif @@ -900,7 +900,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "MESH_BED_LEVELING and BABYSTEP_ZPROBE_OFFSET is not a valid combination" #elif ENABLED(BABYSTEP_ZPROBE_OFFSET) && !HAS_BED_PROBE #error "BABYSTEP_ZPROBE_OFFSET requires a probe." - #elif ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) && !HAS_MARLINUI_U8GLIB + #elif ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) && NONE(HAS_MARLINUI_U8GLIB, IS_DWIN_MARLINUI) #error "BABYSTEP_ZPROBE_GFX_OVERLAY requires a Graphical LCD." #elif ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) && DISABLED(BABYSTEP_ZPROBE_OFFSET) #error "BABYSTEP_ZPROBE_GFX_OVERLAY requires a BABYSTEP_ZPROBE_OFFSET." @@ -1762,8 +1762,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif #endif -#if ENABLED(MESH_EDIT_GFX_OVERLAY) && !(ENABLED(AUTO_BED_LEVELING_UBL) && EITHER(HAS_MARLINUI_U8GLIB, IS_DWIN_MARLINUI)) - #error "MESH_EDIT_GFX_OVERLAY requires AUTO_BED_LEVELING_UBL and a Graphical LCD." +#if ENABLED(MESH_EDIT_GFX_OVERLAY) + #if DISABLED(AUTO_BED_LEVELING_UBL) + #error "MESH_EDIT_GFX_OVERLAY requires AUTO_BED_LEVELING_UBL." + #elif NONE(HAS_MARLINUI_U8GLIB, IS_DWIN_MARLINUI) + #error "MESH_EDIT_GFX_OVERLAY requires a Graphical LCD." + #endif #endif #if ENABLED(G29_RETRY_AND_RECOVER) && NONE(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) @@ -3431,10 +3435,6 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #endif #endif -#if BOTH(Z_STEPPER_AUTO_ALIGN, MECHANICAL_GANTRY_CALIBRATION) - #error "You cannot use Z_STEPPER_AUTO_ALIGN and MECHANICAL_GANTRY_CALIBRATION at the same time." -#endif - #if ENABLED(PRINTCOUNTER) && DISABLED(EEPROM_SETTINGS) #error "PRINTCOUNTER requires EEPROM_SETTINGS." #endif diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index f1c5eebbb5..4a7e26ae83 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -715,15 +715,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop B00001100,B00000000 }; - void _lcd_zoffset_overlay_gfx(const_float_t zvalue) { - // Determine whether the user is raising or lowering the nozzle. - static int8_t dir; - static float old_zvalue; - if (zvalue != old_zvalue) { - dir = zvalue ? zvalue < old_zvalue ? -1 : 1 : 0; - old_zvalue = zvalue; - } - + void MarlinUI::zoffset_overlay(const int8_t dir) { const unsigned char *rot_up = TERN(OVERLAY_GFX_REVERSE, ccw_bmp, cw_bmp), *rot_down = TERN(OVERLAY_GFX_REVERSE, cw_bmp, ccw_bmp); diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index 09458401be..9ad258b3ac 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -562,19 +562,11 @@ void MarlinUI::draw_status_message(const bool blink) { #endif // AUTO_BED_LEVELING_UBL - #if ANY(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY, BABYSTEP_GFX_OVERLAY) - - void _lcd_zoffset_overlay_gfx(const float zvalue) { - // Determine whether the user is raising or lowering the nozzle. - static int8_t dir; - static float old_zvalue; - if (zvalue != old_zvalue) { - dir = zvalue ? zvalue < old_zvalue ? -1 : 1 : 0; - old_zvalue = zvalue; - } + #if ANY(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) + void MarlinUI::zoffset_overlay(const int8_t dir) { const int rot_up = TERN(OVERLAY_GFX_REVERSE, ICON_RotateCCW, ICON_RotateCW), - rot_down = TERN(OVERLAY_GFX_REVERSE, ICON_RotateCW, ICON_RotateCCW); + rot_down = TERN(OVERLAY_GFX_REVERSE, ICON_RotateCW, ICON_RotateCCW); const int nozzle = (LCD_PIXEL_WIDTH / 2) - 20; diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index c194d43438..5c8298cf52 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1714,6 +1714,20 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; if (touch_calibration.need_calibration()) ui.goto_screen(touch_screen_calibration); #endif } + + #if EITHER(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) + void MarlinUI::zoffset_overlay(const_float_t zvalue) { + // Determine whether the user is raising or lowering the nozzle. + static int8_t dir; + static float old_zvalue; + if (zvalue != old_zvalue) { + dir = zvalue ? zvalue < old_zvalue ? -1 : 1 : 0; + old_zvalue = zvalue; + } + zoffset_overlay(dir); + } + #endif + #endif #if BOTH(EXTENSIBLE_UI, ADVANCED_PAUSE_FEATURE) diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 270ee3afce..02d5bf06bd 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -474,6 +474,11 @@ public: static bool did_first_redraw; #endif + #if EITHER(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) + static void zoffset_overlay(const int8_t dir); + static void zoffset_overlay(const_float_t zvalue); + #endif + static void draw_kill_screen(); #else // No LCD diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 76cdd51cd5..61a1a16c6a 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -257,9 +257,6 @@ void MarlinUI::synchronize(PGM_P const msg/*=nullptr*/) { * * encoderLine is the position based on the encoder * encoderTopLine is the top menu line to display - * _lcdLineNr is the index of the LCD line (e.g., 0-3) - * _menuLineNr is the menu item to draw and process - * _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM * screen_items is the total number of items in the menu (after one call) */ void scroll_screen(const uint8_t limit, const bool is_menu) { @@ -336,7 +333,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) { if (ui.should_draw()) { if (do_probe) { MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_ZPROBE_ZOFFSET), BABYSTEP_TO_STR(probe.offset.z)); - TERN_(BABYSTEP_ZPROBE_GFX_OVERLAY, _lcd_zoffset_overlay_gfx(probe.offset.z)); + TERN_(BABYSTEP_ZPROBE_GFX_OVERLAY, ui.zoffset_overlay(probe.offset.z)); } else { #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index ad2cf72000..50842dcaf8 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -39,10 +39,6 @@ typedef void (*selectFunc_t)(); #define SS_INVERT 0x02 #define SS_DEFAULT SS_CENTER -#if EITHER(HAS_MARLINUI_U8GLIB, IS_DWIN_MARLINUI) && EITHER(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) - void _lcd_zoffset_overlay_gfx(const_float_t zvalue); -#endif - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) && Z_PROBE_OFFSET_RANGE_MIN >= -9 && Z_PROBE_OFFSET_RANGE_MAX <= 9 #define BABYSTEP_TO_STR(N) ftostr43sign(N) #elif ENABLED(BABYSTEPPING) diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index 03aec39c83..8dea7d943d 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -83,7 +83,7 @@ void _lcd_mesh_fine_tune(PGM_P const msg) { if (ui.should_draw()) { const float rounded_f = rounded_mesh_value(); MenuEditItemBase::draw_edit_screen(msg, ftostr43sign(rounded_f)); - TERN_(MESH_EDIT_GFX_OVERLAY, _lcd_zoffset_overlay_gfx(rounded_f)); + TERN_(MESH_EDIT_GFX_OVERLAY, ui.zoffset_overlay(rounded_f)); TERN_(HAS_GRAPHICAL_TFT, ui.refresh(LCDVIEW_NONE)); } } diff --git a/Marlin/src/pins/esp32/pins_PANDA_M4.h b/Marlin/src/pins/esp32/pins_PANDA_M4.h new file mode 100644 index 0000000000..5e2e72af05 --- /dev/null +++ b/Marlin/src/pins/esp32/pins_PANDA_M4.h @@ -0,0 +1,38 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * Panda M4 pin assignments + */ + +#define BOARD_INFO_NAME "Panda_M4" + +#include "pins_PANDA_common.h" + +// +// Steppers +// +#define X_ENABLE_PIN 115 +#define Y_ENABLE_PIN 114 +#define Z_ENABLE_PIN 113 +#define E0_ENABLE_PIN 112 diff --git a/Marlin/src/pins/esp32/pins_PANDA_ZHU.h b/Marlin/src/pins/esp32/pins_PANDA_ZHU.h new file mode 100644 index 0000000000..4750057897 --- /dev/null +++ b/Marlin/src/pins/esp32/pins_PANDA_ZHU.h @@ -0,0 +1,61 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * Panda ZHU pin assignments + */ + +#define BOARD_INFO_NAME "Panda_ZHU" + +#include "pins_PANDA_common.h" + +// +// Steppers +// +#define X_ENABLE_PIN 128 // Shared with all steppers +#define Y_ENABLE_PIN X_ENABLE_PIN +#define Z_ENABLE_PIN X_ENABLE_PIN +#define E0_ENABLE_PIN X_ENABLE_PIN + +//#define X_CS_PIN 0 +//#define Y_CS_PIN 13 +//#define Z_CS_PIN 5 // SS_PIN +//#define E0_CS_PIN 21 + +#define E1_STEP_PIN 115 +#define E1_DIR_PIN 114 +#define E1_ENABLE_PIN X_ENABLE_PIN + +#define E2_STEP_PIN 112 +#define E2_DIR_PIN 113 +#define E2_ENABLE_PIN X_ENABLE_PIN + +#define E3_STEP_PIN 110 +#define E3_DIR_PIN 111 +#define E3_ENABLE_PIN X_ENABLE_PIN + +#define E4_STEP_PIN 121 +#define E4_DIR_PIN 122 +#define E4_ENABLE_PIN X_ENABLE_PIN + +#define HEATER_1_PIN 123 diff --git a/Marlin/src/pins/esp32/pins_PANDA_common.h b/Marlin/src/pins/esp32/pins_PANDA_common.h new file mode 100644 index 0000000000..81862fbd55 --- /dev/null +++ b/Marlin/src/pins/esp32/pins_PANDA_common.h @@ -0,0 +1,98 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * Panda common pin assignments + */ + +#include "env_validate.h" + +#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME + +// +// Servos +// +#define SERVO0_PIN 0 + +// +// Limit Switches +// +#define X_STOP_PIN 4 +#define Y_STOP_PIN 35 +#define Z_STOP_PIN 21 + +// +// Steppers +// +#define X_STEP_PIN 101 +#define X_DIR_PIN 100 + +#define Y_STEP_PIN 103 +#define Y_DIR_PIN 102 + +#define Z_STEP_PIN 105 +#define Z_DIR_PIN 104 + +#define E0_STEP_PIN 107 +#define E0_DIR_PIN 106 + +// +// Temperature Sensors +// +#define TEMP_0_PIN 39 // Analog Input +#define TEMP_BED_PIN 36 // Analog Input + +// +// Heaters / Fans +// +#define HEATER_0_PIN 108 +#define HEATER_BED_PIN 109 +#define FAN_PIN 118 // FAN0 +#define FAN1_PIN 119 // FAN1 + +#ifndef E0_AUTO_FAN_PIN + #define E0_AUTO_FAN_PIN 120 // FAN2 +#endif + +// +// SD card +// +#if ENABLED(SDSUPPORT) + #define SD_MOSI_PIN 23 + #define SD_MISO_PIN 19 + #define SD_SCK_PIN 18 + #define SDSS 5 + #define SD_DETECT_PIN 2 +#endif + +#if HAS_WIRED_LCD + #define BEEPER_PIN 129 + #define BTN_ENC 12 + + #define BTN_EN1 33 + #define BTN_EN2 32 + + #define LCD_PINS_RS 27 + #define LCD_PINS_ENABLE 26 + #define LCD_PINS_D4 14 +#endif diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 0293da1dba..14a13219dd 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -651,6 +651,8 @@ #include "stm32f4/pins_INDEX_REV03.h" // STM32F4 env:Index_Mobo_Rev03 #elif MB(MKS_ROBIN_NANO_V1_3_F4) #include "stm32f4/pins_MKS_ROBIN_NANO_V1_3_F4.h" // STM32F4 env:mks_robin_nano_v1_3_f4 +#elif MB(MKS_EAGLE) + #include "stm32f4/pins_MKS_EAGLE.h" // STM32F4 env:mks_eagle // // ARM Cortex M7 @@ -681,6 +683,10 @@ #include "esp32/pins_E4D.h" // ESP32 env:esp32 #elif MB(FYSETC_E4) #include "esp32/pins_FYSETC_E4.h" // ESP32 env:FYSETC_E4 +#elif MB(PANDA_ZHU) + #include "esp32/pins_PANDA_ZHU.h" // ESP32 env:PANDA +#elif MB(PANDA_M4) + #include "esp32/pins_PANDA_M4.h" // ESP32 env:PANDA // // Adafruit Grand Central M4 (SAMD51 ARM Cortex-M4) diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h index 9dc02c495b..c22409923b 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h @@ -28,7 +28,10 @@ // Onboard I2C EEPROM #if NO_EEPROM_SELECTED #define I2C_EEPROM + #define SOFT_I2C_EEPROM #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define I2C_SDA_PIN SDA + #define I2C_SCL_PIN SCL #undef NO_EEPROM_SELECTED #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h index fdee796692..8b67781b60 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h @@ -237,7 +237,7 @@ #define TFT_CS_PIN FSMC_CS_PIN #define TFT_RS_PIN FSMC_RS_PIN - #define LCD_RESET_PIN PF6 + #define LCD_RESET_PIN PC6 #define LCD_BACKLIGHT_PIN PD13 #define TFT_BUFFER_SIZE 14400 diff --git a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h index 68948f7de9..95f74efe84 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h @@ -483,9 +483,9 @@ #endif // Alter timing for graphical display - #if ENABLED(U8GLIB_ST7920) - #define BOARD_ST7920_DELAY_1 96 - #define BOARD_ST7920_DELAY_2 48 + #if IS_U8GLIB_ST7920 + #define BOARD_ST7920_DELAY_1 125 + #define BOARD_ST7920_DELAY_2 90 #define BOARD_ST7920_DELAY_3 600 #endif diff --git a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h index ab0a7dd962..4a667bbc20 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h @@ -37,6 +37,7 @@ // // Servos +// #define SERVO0_PIN PB6 // @@ -56,12 +57,30 @@ #define E2_DIAG_PIN PG14 // E2DET #define E3_DIAG_PIN PG15 // E3DET +// // Z Probe (when not Z_MIN_PIN) // #ifndef Z_MIN_PROBE_PIN #define Z_MIN_PROBE_PIN PB7 #endif +// +// Check for additional used endstop pins +// +#if HAS_EXTRA_ENDSTOPS + #define _ENDSTOP_IS_ANY(ES) X2_USE_ENDSTOP == ES || Y2_USE_ENDSTOP == ES || Z2_USE_ENDSTOP == ES || Z3_USE_ENDSTOP == ES || Z4_USE_ENDSTOP == ES + #if _ENDSTOP_IS_ANY(_XMIN_) || _ENDSTOP_IS_ANY(_XMAX_) + #define NEEDS_X_MINMAX 1 + #endif + #if _ENDSTOP_IS_ANY(_YMIN_) || _ENDSTOP_IS_ANY(_YMAX_) + #define NEEDS_Y_MINMAX 1 + #endif + #if _ENDSTOP_IS_ANY(_ZMIN_) || _ENDSTOP_IS_ANY(_ZMAX_) + #define NEEDS_Z_MINMAX 1 + #endif + #undef _ENDSTOP_IS_ANY +#endif + // // Limit Switches // @@ -72,7 +91,7 @@ #else #define X_MIN_PIN E0_DIAG_PIN // E0DET #endif -#elif EITHER(X_DUAL_ENDSTOPS, DUAL_X_CARRIAGE) +#elif EITHER(DUAL_X_CARRIAGE, NEEDS_X_MINMAX) #ifndef X_MIN_PIN #define X_MIN_PIN X_DIAG_PIN // X-STOP #endif @@ -90,7 +109,7 @@ #else #define Y_MIN_PIN E1_DIAG_PIN // E1DET #endif -#elif ENABLED(Y_DUAL_ENDSTOPS) +#elif NEEDS_Y_MINMAX #ifndef Y_MIN_PIN #define Y_MIN_PIN Y_DIAG_PIN // Y-STOP #endif @@ -108,7 +127,7 @@ #else #define Z_MIN_PIN E2_DIAG_PIN // PWRDET #endif -#elif ENABLED(Z_MULTI_ENDSTOPS) +#elif NEEDS_Z_MINMAX #ifndef Z_MIN_PIN #define Z_MIN_PIN Z_DIAG_PIN // Z-STOP #endif @@ -119,6 +138,10 @@ #define Z_STOP_PIN Z_DIAG_PIN // Z-STOP #endif +#undef NEEDS_X_MINMAX +#undef NEEDS_Y_MINMAX +#undef NEEDS_Z_MINMAX + // // Filament Runout Sensor // diff --git a/Marlin/src/pins/stm32f4/pins_MKS_EAGLE.h b/Marlin/src/pins/stm32f4/pins_MKS_EAGLE.h new file mode 100644 index 0000000000..50f06b7e81 --- /dev/null +++ b/Marlin/src/pins/stm32f4/pins_MKS_EAGLE.h @@ -0,0 +1,35 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#define ALLOW_STM32DUINO +#include "env_validate.h" + +#if HOTENDS > 2 || E_STEPPERS > 2 + #error "MKS Eagle supports up to 2 hotends / E-steppers." +#elif HAS_FSMC_TFT + #error "MKS Eagle doesn't support FSMC-based TFT displays." +#endif + +#define BOARD_INFO_NAME "MKS Eagle" + +#include "pins_MKS_ROBIN_NANO_V3_common.h" diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h index c9762a6914..4dc73e0312 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h @@ -32,80 +32,22 @@ #define BOARD_INFO_NAME "MKS Robin Nano V3" -// USB Flash Drive support -#define HAS_OTG_USB_HOST_SUPPORT - -// Avoid conflict with TIMER_TONE -#define STEP_TIMER 10 - -// Use one of these or SDCard-based Emulation will be used -//#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation -//#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation -#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) - #define I2C_EEPROM - #define MARLIN_EEPROM_SIZE 0x1000 // 4KB - #define I2C_SCL_PIN PB6 - #define I2C_SDA_PIN PB7 -#endif - -// -// Release PB4 (Z_DIR_PIN) from JTAG NRST role -// -//#define DISABLE_DEBUG - -// -// Servos -// -#define SERVO0_PIN PA8 // Enable BLTOUCH - -// -// Limit Switches -// -#define X_DIAG_PIN PA15 -#define Y_DIAG_PIN PD2 -#define Z_DIAG_PIN PC8 -#define E0_DIAG_PIN PC4 -#define E1_DIAG_PIN PE7 - -#define X_STOP_PIN X_DIAG_PIN -#define Y_STOP_PIN Y_DIAG_PIN -#define Z_MIN_PIN Z_DIAG_PIN -#define Z_MAX_PIN E0_DIAG_PIN - -// -// Steppers -// -#define X_ENABLE_PIN PE4 -#define X_STEP_PIN PE3 -#define X_DIR_PIN PE2 #ifndef X_CS_PIN #define X_CS_PIN PD5 #endif -#define Y_ENABLE_PIN PE1 -#define Y_STEP_PIN PE0 -#define Y_DIR_PIN PB9 #ifndef Y_CS_PIN #define Y_CS_PIN PD7 #endif -#define Z_ENABLE_PIN PB8 -#define Z_STEP_PIN PB5 -#define Z_DIR_PIN PB4 #ifndef Z_CS_PIN #define Z_CS_PIN PD4 #endif -#define E0_ENABLE_PIN PB3 -#define E0_STEP_PIN PD6 -#define E0_DIR_PIN PD3 #ifndef E0_CS_PIN #define E0_CS_PIN PD9 #endif -#define E1_ENABLE_PIN PA3 -#define E1_STEP_PIN PD15 -#define E1_DIR_PIN PA1 #ifndef E1_CS_PIN #define E1_CS_PIN PD8 #endif @@ -129,287 +71,4 @@ #endif #endif -#if HAS_TMC_UART - // - // Software serial - // No Hardware serial for steppers - // - #define X_SERIAL_TX_PIN PD5 - #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN - - #define Y_SERIAL_TX_PIN PD7 - #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN - - #define Z_SERIAL_TX_PIN PD4 - #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN - - #define E0_SERIAL_TX_PIN PD9 - #define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN - - #define E1_SERIAL_TX_PIN PD8 - #define E1_SERIAL_RX_PIN E1_SERIAL_TX_PIN - - // Reduce baud rate to improve software serial reliability - #define TMC_BAUD_RATE 19200 -#endif - -// -// Temperature Sensors -// -#define TEMP_0_PIN PC1 // TH1 -#define TEMP_1_PIN PA2 // TH2 -#define TEMP_BED_PIN PC0 // TB1 - -// -// Heaters / Fans -// -#define HEATER_0_PIN PE5 // HEATER1 -#define HEATER_1_PIN PB0 // HEATER2 -#define HEATER_BED_PIN PA0 // HOT BED - -#define FAN_PIN PC14 // FAN -#define FAN1_PIN PB1 // FAN1 - -// -// Thermocouples -// -//#define TEMP_0_CS_PIN HEATER_0_PIN // TC1 - CS1 -//#define TEMP_0_CS_PIN HEATER_1_PIN // TC2 - CS2 - -// -// Misc. Functions -// -#if HAS_TFT_LVGL_UI - #define MT_DET_1_PIN PA4 // MT_DET - #define MT_DET_2_PIN PE6 - #define MT_DET_PIN_STATE LOW -#endif - -#ifndef FIL_RUNOUT_PIN - #define FIL_RUNOUT_PIN MT_DET_1_PIN -#endif -#ifndef FIL_RUNOUT2_PIN - #define FIL_RUNOUT2_PIN MT_DET_2_PIN -#endif - -#ifndef POWER_LOSS_PIN - #define POWER_LOSS_PIN PA13 // PW_DET -#endif - -//#define SUICIDE_PIN PB2 -//#define LED_PIN PB2 -//#define KILL_PIN PA2 -//#define KILL_PIN_STATE LOW - -// -// Power Supply Control -// -#if ENABLED(MKS_PWC) - #if ENABLED(TFT_LVGL_UI) - #undef PSU_CONTROL - #undef MKS_PWC - #define SUICIDE_PIN PB2 - #define SUICIDE_PIN_STATE LOW - #else - #define PS_ON_PIN PB2 // PW_OFF - #endif - #define KILL_PIN PA13 // PW_DET - #define KILL_PIN_STATE HIGH -#endif - -// Random Info -#define USB_SERIAL -1 // USB Serial -#define WIFI_SERIAL 3 // USART3 -#define MKS_WIFI_MODULE_SERIAL 1 // USART1 -#define MKS_WIFI_MODULE_SPI 2 // SPI2 - -#ifndef SDCARD_CONNECTION - #define SDCARD_CONNECTION ONBOARD -#endif - -// MKS WIFI MODULE -#if ENABLED(MKS_WIFI_MODULE) - #define WIFI_IO0_PIN PC13 - #define WIFI_IO1_PIN PC7 - #define WIFI_RESET_PIN PE9 -#endif - -// MKS TEST -#if ENABLED(MKS_TEST) - #define MKS_TEST_POWER_LOSS_PIN PA13 // PW_DET - #define MKS_TEST_PS_ON_PIN PB2 // PW_OFF -#endif - -// -// Onboard SD card -// -// detect pin doesn't work when ONBOARD and NO_SD_HOST_DRIVE disabled -#if SD_CONNECTION_IS(ONBOARD) - #define ENABLE_SPI3 - #define SD_SS_PIN -1 - #define SDSS PC9 - #define SD_SCK_PIN PC10 - #define SD_MISO_PIN PC11 - #define SD_MOSI_PIN PC12 - #define SD_DETECT_PIN PD12 -#endif - -#define SPI_FLASH -#if ENABLED(SPI_FLASH) - #define HAS_SPI_FLASH 1 - #define SPI_DEVICE 2 - #define SPI_FLASH_SIZE 0x1000000 - #define SPI_FLASH_CS_PIN PB12 - #define SPI_FLASH_MOSI_PIN PC3 - #define SPI_FLASH_MISO_PIN PC2 - #define SPI_FLASH_SCK_PIN PB13 -#endif - -/** - * ------ ------ - * (BEEPER) PC5 |10 9 | PE13 (BTN_ENC) (SPI1 MISO) PA6 |10 9 | PA5 (SPI1 SCK) - * (LCD_EN) PD13 | 8 7 | PC6 (LCD_RS) (BTN_EN1) PE8 | 8 7 | PE10 (SPI1 CS) - * (LCD_D4) PE14 6 5 | PE15 (LCD_D5) (BTN_EN2) PE11 6 5 | PA7 (SPI1 MOSI) - * (LCD_D6) PD11 | 4 3 | PD10 (LCD_D7) (SPI1_RS) PE12 | 4 3 | RESET - * GND | 2 1 | 5V GND | 2 1 | 3.3V - * ------ ------ - * EXP1 EXP2 - */ -#define EXP1_03_PIN PD10 -#define EXP1_04_PIN PD11 -#define EXP1_05_PIN PE15 -#define EXP1_06_PIN PE14 -#define EXP1_07_PIN PC6 -#define EXP1_08_PIN PD13 -#define EXP1_09_PIN PE13 -#define EXP1_10_PIN PC5 - -#define EXP2_03_PIN -1 // RESET -#define EXP2_04_PIN PE12 -#define EXP2_05_PIN PA7 -#define EXP2_06_PIN PE11 -#define EXP2_07_PIN PE10 -#define EXP2_08_PIN PE8 -#define EXP2_09_PIN PA5 -#define EXP2_10_PIN PA6 - -// -// SPI SD Card -// -#if SD_CONNECTION_IS(LCD) - #define ENABLE_SPI1 - #define SDSS EXP2_07_PIN - #define SD_SCK_PIN EXP2_09_PIN - #define SD_MISO_PIN EXP2_10_PIN - #define SD_MOSI_PIN EXP2_05_PIN - #define SD_DETECT_PIN EXP2_04_PIN -#endif - -// -// LCD / Controller -// -#if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI) - #define TFT_CS_PIN EXP1_04_PIN - #define TFT_SCK_PIN EXP2_09_PIN - #define TFT_MISO_PIN EXP2_10_PIN - #define TFT_MOSI_PIN EXP2_05_PIN - #define TFT_DC_PIN EXP1_03_PIN - #define TFT_RST_PIN EXP1_07_PIN - #define TFT_A0_PIN TFT_DC_PIN - - #define TFT_RESET_PIN EXP1_07_PIN - #define TFT_BACKLIGHT_PIN EXP1_08_PIN - - #define TOUCH_BUTTONS_HW_SPI - #define TOUCH_BUTTONS_HW_SPI_DEVICE 1 - - #define LCD_BACKLIGHT_PIN EXP1_08_PIN - #ifndef TFT_WIDTH - #define TFT_WIDTH 480 - #endif - #ifndef TFT_HEIGHT - #define TFT_HEIGHT 320 - #endif - - #define TOUCH_CS_PIN EXP1_06_PIN // SPI1_NSS - #define TOUCH_SCK_PIN EXP2_09_PIN // SPI1_SCK - #define TOUCH_MISO_PIN EXP2_10_PIN // SPI1_MISO - #define TOUCH_MOSI_PIN EXP2_05_PIN // SPI1_MOSI - - #define LCD_READ_ID 0xD3 - #define LCD_USE_DMA_SPI - - #define TFT_BUFFER_SIZE 14400 - - #ifndef TOUCH_CALIBRATION_X - #define TOUCH_CALIBRATION_X -17253 - #endif - #ifndef TOUCH_CALIBRATION_Y - #define TOUCH_CALIBRATION_Y 11579 - #endif - #ifndef TOUCH_OFFSET_X - #define TOUCH_OFFSET_X 514 - #endif - #ifndef TOUCH_OFFSET_Y - #define TOUCH_OFFSET_Y -24 - #endif - #ifndef TOUCH_ORIENTATION - #define TOUCH_ORIENTATION TOUCH_LANDSCAPE - #endif - -#elif HAS_WIRED_LCD - - #define LCD_PINS_ENABLE EXP1_08_PIN - #define LCD_PINS_RS EXP1_07_PIN - #define LCD_BACKLIGHT_PIN -1 - - // MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor) - #if ENABLED(MKS_MINI_12864) - //#define LCD_BACKLIGHT_PIN -1 - //#define LCD_RESET_PIN -1 - #define DOGLCD_A0 EXP1_04_PIN - #define DOGLCD_CS EXP1_05_PIN - //#define DOGLCD_SCK EXP2_09_PIN - //#define DOGLCD_MOSI EXP2_05_PIN - - // Required for MKS_MINI_12864 with this board - //#define MKS_LCD12864B - //#undef SHOW_BOOTSCREEN - - #elif ENABLED(MKS_MINI_12864_V3) - #define DOGLCD_CS EXP1_08_PIN - #define DOGLCD_A0 EXP1_07_PIN - #define LCD_PINS_DC DOGLCD_A0 - #define LCD_BACKLIGHT_PIN -1 - #define LCD_RESET_PIN EXP1_06_PIN - #define NEOPIXEL_PIN EXP1_05_PIN - #define DOGLCD_MOSI EXP2_05_PIN - #define DOGLCD_SCK EXP2_09_PIN - #if SD_CONNECTION_IS(ONBOARD) - #define FORCE_SOFT_SPI - #endif - //#define LCD_SCREEN_ROT_180 - - #else // !MKS_MINI_12864 - - #define LCD_PINS_D4 EXP1_06_PIN - #if ENABLED(ULTIPANEL) - #define LCD_PINS_D5 EXP1_05_PIN - #define LCD_PINS_D6 EXP1_04_PIN - #define LCD_PINS_D7 EXP1_03_PIN - #endif - - #define BOARD_ST7920_DELAY_1 96 - #define BOARD_ST7920_DELAY_2 48 - #define BOARD_ST7920_DELAY_3 600 - - #endif // !MKS_MINI_12864 - -#endif // HAS_WIRED_LCD - -#if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI, HAS_WIRED_LCD) - #define BEEPER_PIN EXP1_10_PIN - #define BTN_EN1 EXP2_08_PIN - #define BTN_EN2 EXP2_06_PIN - #define BTN_ENC EXP1_09_PIN -#endif +#include "pins_MKS_ROBIN_NANO_V3_common.h" diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h new file mode 100644 index 0000000000..c3e3963b55 --- /dev/null +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h @@ -0,0 +1,375 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#pragma once + +// +// MKS Robin Nano V3, MKS Eagle pinmap +// + +// USB Flash Drive support +#define HAS_OTG_USB_HOST_SUPPORT + +// Avoid conflict with TIMER_TONE +#define STEP_TIMER 10 + +// Use one of these or SDCard-based Emulation will be used +//#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation +//#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation +#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM) + #define I2C_EEPROM + #define MARLIN_EEPROM_SIZE 0x1000 // 4KB + #define I2C_SCL_PIN PB6 + #define I2C_SDA_PIN PB7 +#endif + +// +// Release PB4 (Z_DIR_PIN) from JTAG NRST role +// +//#define DISABLE_DEBUG + +// +// Servos +// +#define SERVO0_PIN PA8 // Enable BLTOUCH + +// +// Limit Switches +// +#define X_DIAG_PIN PA15 +#define Y_DIAG_PIN PD2 +#define Z_DIAG_PIN PC8 +#define E0_DIAG_PIN PC4 +#define E1_DIAG_PIN PE7 + +#define X_STOP_PIN X_DIAG_PIN +#define Y_STOP_PIN Y_DIAG_PIN +#define Z_MIN_PIN Z_DIAG_PIN +#define Z_MAX_PIN E0_DIAG_PIN + +// +// Steppers +// +#define X_ENABLE_PIN PE4 +#define X_STEP_PIN PE3 +#define X_DIR_PIN PE2 + +#define Y_ENABLE_PIN PE1 +#define Y_STEP_PIN PE0 +#define Y_DIR_PIN PB9 + +#define Z_ENABLE_PIN PB8 +#define Z_STEP_PIN PB5 +#define Z_DIR_PIN PB4 + +#define E0_ENABLE_PIN PB3 +#define E0_STEP_PIN PD6 +#define E0_DIR_PIN PD3 + +#define E1_ENABLE_PIN PA3 +#define E1_STEP_PIN PD15 +#define E1_DIR_PIN PA1 + +#if HAS_TMC_UART + // + // Software serial + // No Hardware serial for steppers + // + #define X_SERIAL_TX_PIN PD5 + #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN + + #define Y_SERIAL_TX_PIN PD7 + #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN + + #define Z_SERIAL_TX_PIN PD4 + #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN + + #define E0_SERIAL_TX_PIN PD9 + #define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN + + #define E1_SERIAL_TX_PIN PD8 + #define E1_SERIAL_RX_PIN E1_SERIAL_TX_PIN + + // Reduce baud rate to improve software serial reliability + #define TMC_BAUD_RATE 19200 +#endif + +// +// Temperature Sensors +// +#define TEMP_0_PIN PC1 // TH1 +#define TEMP_1_PIN PA2 // TH2 +#define TEMP_BED_PIN PC0 // TB1 + +// +// Heaters / Fans +// +#define HEATER_0_PIN PE5 // HEATER1 +#define HEATER_1_PIN PB0 // HEATER2 +#define HEATER_BED_PIN PA0 // HOT BED + +#define FAN_PIN PC14 // FAN +#define FAN1_PIN PB1 // FAN1 + +// +// Thermocouples +// +//#define TEMP_0_CS_PIN HEATER_0_PIN // TC1 - CS1 +//#define TEMP_0_CS_PIN HEATER_1_PIN // TC2 - CS2 + +// +// Misc. Functions +// +#if HAS_TFT_LVGL_UI + #define MT_DET_1_PIN PA4 // MT_DET + #define MT_DET_2_PIN PE6 + #define MT_DET_PIN_STATE LOW +#endif + +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN MT_DET_1_PIN +#endif +#ifndef FIL_RUNOUT2_PIN + #define FIL_RUNOUT2_PIN MT_DET_2_PIN +#endif + +#ifndef POWER_LOSS_PIN + #define POWER_LOSS_PIN PA13 // PW_DET +#endif + +//#define SUICIDE_PIN PB2 +//#define LED_PIN PB2 +//#define KILL_PIN PA2 +//#define KILL_PIN_STATE LOW + +// +// Power Supply Control +// +#if ENABLED(MKS_PWC) + #if ENABLED(TFT_LVGL_UI) + #undef PSU_CONTROL + #undef MKS_PWC + #define SUICIDE_PIN PB2 + #define SUICIDE_PIN_STATE LOW + #else + #define PS_ON_PIN PB2 // PW_OFF + #endif + #define KILL_PIN PA13 // PW_DET + #define KILL_PIN_STATE HIGH +#endif + +// Random Info +#define USB_SERIAL -1 // USB Serial +#define WIFI_SERIAL 3 // USART3 +#define MKS_WIFI_MODULE_SERIAL 1 // USART1 +#define MKS_WIFI_MODULE_SPI 2 // SPI2 + +#ifndef SDCARD_CONNECTION + #define SDCARD_CONNECTION ONBOARD +#endif + +// MKS WIFI MODULE +#if ENABLED(MKS_WIFI_MODULE) + #define WIFI_IO0_PIN PC13 + #define WIFI_IO1_PIN PC7 + #define WIFI_RESET_PIN PE9 +#endif + +// MKS TEST +#if ENABLED(MKS_TEST) + #define MKS_TEST_POWER_LOSS_PIN PA13 // PW_DET + #define MKS_TEST_PS_ON_PIN PB2 // PW_OFF +#endif + +// +// Onboard SD card +// +// detect pin doesn't work when ONBOARD and NO_SD_HOST_DRIVE disabled +#if SD_CONNECTION_IS(ONBOARD) + #define ENABLE_SPI3 + #define SD_SS_PIN -1 + #define SDSS PC9 + #define SD_SCK_PIN PC10 + #define SD_MISO_PIN PC11 + #define SD_MOSI_PIN PC12 + #define SD_DETECT_PIN PD12 +#endif + +#define SPI_FLASH +#if ENABLED(SPI_FLASH) + #define HAS_SPI_FLASH 1 + #define SPI_DEVICE 2 + #define SPI_FLASH_SIZE 0x1000000 + #define SPI_FLASH_CS_PIN PB12 + #define SPI_FLASH_MOSI_PIN PC3 + #define SPI_FLASH_MISO_PIN PC2 + #define SPI_FLASH_SCK_PIN PB13 +#endif + +/** + * ------ ------ + * (BEEPER) PC5 |10 9 | PE13 (BTN_ENC) (SPI1 MISO) PA6 |10 9 | PA5 (SPI1 SCK) + * (LCD_EN) PD13 | 8 7 | PC6 (LCD_RS) (BTN_EN1) PE8 | 8 7 | PE10 (SPI1 CS) + * (LCD_D4) PE14 6 5 | PE15 (LCD_D5) (BTN_EN2) PE11 6 5 | PA7 (SPI1 MOSI) + * (LCD_D6) PD11 | 4 3 | PD10 (LCD_D7) (SPI1_RS) PE12 | 4 3 | RESET + * GND | 2 1 | 5V GND | 2 1 | 3.3V + * ------ ------ + * EXP1 EXP2 + */ +#define EXP1_03_PIN PD10 +#define EXP1_04_PIN PD11 +#define EXP1_05_PIN PE15 +#define EXP1_06_PIN PE14 +#define EXP1_07_PIN PC6 +#define EXP1_08_PIN PD13 +#define EXP1_09_PIN PE13 +#define EXP1_10_PIN PC5 + +#define EXP2_03_PIN -1 // RESET +#define EXP2_04_PIN PE12 +#define EXP2_05_PIN PA7 +#define EXP2_06_PIN PE11 +#define EXP2_07_PIN PE10 +#define EXP2_08_PIN PE8 +#define EXP2_09_PIN PA5 +#define EXP2_10_PIN PA6 + +// +// SPI SD Card +// +#if SD_CONNECTION_IS(LCD) + #define ENABLE_SPI1 + #define SDSS EXP2_07_PIN + #define SD_SCK_PIN EXP2_09_PIN + #define SD_MISO_PIN EXP2_10_PIN + #define SD_MOSI_PIN EXP2_05_PIN + #define SD_DETECT_PIN EXP2_04_PIN +#endif + +// +// LCD / Controller +// +#if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI) + #define TFT_CS_PIN EXP1_04_PIN + #define TFT_SCK_PIN EXP2_09_PIN + #define TFT_MISO_PIN EXP2_10_PIN + #define TFT_MOSI_PIN EXP2_05_PIN + #define TFT_DC_PIN EXP1_03_PIN + #define TFT_RST_PIN EXP1_07_PIN + #define TFT_A0_PIN TFT_DC_PIN + + #define TFT_RESET_PIN EXP1_07_PIN + #define TFT_BACKLIGHT_PIN EXP1_08_PIN + + #define TOUCH_BUTTONS_HW_SPI + #define TOUCH_BUTTONS_HW_SPI_DEVICE 1 + + #define LCD_BACKLIGHT_PIN EXP1_08_PIN + #ifndef TFT_WIDTH + #define TFT_WIDTH 480 + #endif + #ifndef TFT_HEIGHT + #define TFT_HEIGHT 320 + #endif + + #define TOUCH_CS_PIN EXP1_06_PIN // SPI1_NSS + #define TOUCH_SCK_PIN EXP2_09_PIN // SPI1_SCK + #define TOUCH_MISO_PIN EXP2_10_PIN // SPI1_MISO + #define TOUCH_MOSI_PIN EXP2_05_PIN // SPI1_MOSI + + #define LCD_READ_ID 0xD3 + #define LCD_USE_DMA_SPI + + #define TFT_BUFFER_SIZE 14400 + + #ifndef TOUCH_CALIBRATION_X + #define TOUCH_CALIBRATION_X -17253 + #endif + #ifndef TOUCH_CALIBRATION_Y + #define TOUCH_CALIBRATION_Y 11579 + #endif + #ifndef TOUCH_OFFSET_X + #define TOUCH_OFFSET_X 514 + #endif + #ifndef TOUCH_OFFSET_Y + #define TOUCH_OFFSET_Y -24 + #endif + #ifndef TOUCH_ORIENTATION + #define TOUCH_ORIENTATION TOUCH_LANDSCAPE + #endif + +#elif HAS_WIRED_LCD + + #define LCD_PINS_ENABLE EXP1_08_PIN + #define LCD_PINS_RS EXP1_07_PIN + #define LCD_BACKLIGHT_PIN -1 + + // MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor) + #if ENABLED(MKS_MINI_12864) + //#define LCD_BACKLIGHT_PIN -1 + //#define LCD_RESET_PIN -1 + #define DOGLCD_A0 EXP1_04_PIN + #define DOGLCD_CS EXP1_05_PIN + //#define DOGLCD_SCK EXP2_09_PIN + //#define DOGLCD_MOSI EXP2_05_PIN + + // Required for MKS_MINI_12864 with this board + //#define MKS_LCD12864B + //#undef SHOW_BOOTSCREEN + + #elif ENABLED(MKS_MINI_12864_V3) + #define DOGLCD_CS EXP1_08_PIN + #define DOGLCD_A0 EXP1_07_PIN + #define LCD_PINS_DC DOGLCD_A0 + #define LCD_BACKLIGHT_PIN -1 + #define LCD_RESET_PIN EXP1_06_PIN + #define NEOPIXEL_PIN EXP1_05_PIN + #define DOGLCD_MOSI EXP2_05_PIN + #define DOGLCD_SCK EXP2_09_PIN + #if SD_CONNECTION_IS(ONBOARD) + #define FORCE_SOFT_SPI + #endif + //#define LCD_SCREEN_ROT_180 + + #else // !MKS_MINI_12864 + + #define LCD_PINS_D4 EXP1_06_PIN + #if ENABLED(ULTIPANEL) + #define LCD_PINS_D5 EXP1_05_PIN + #define LCD_PINS_D6 EXP1_04_PIN + #define LCD_PINS_D7 EXP1_03_PIN + #endif + + #define BOARD_ST7920_DELAY_1 96 + #define BOARD_ST7920_DELAY_2 48 + #define BOARD_ST7920_DELAY_3 600 + + #endif // !MKS_MINI_12864 + +#endif // HAS_WIRED_LCD + +#if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI, HAS_WIRED_LCD) + #define BEEPER_PIN EXP1_10_PIN + #define BTN_EN1 EXP2_08_PIN + #define BTN_EN2 EXP2_06_PIN + #define BTN_ENC EXP1_09_PIN +#endif diff --git a/buildroot/share/PlatformIO/boards/marlin_FYSETC_CHEETAH_V20.json b/buildroot/share/PlatformIO/boards/marlin_FYSETC_CHEETAH_V20.json index e7b0d28afe..6c2e093c3b 100644 --- a/buildroot/share/PlatformIO/boards/marlin_FYSETC_CHEETAH_V20.json +++ b/buildroot/share/PlatformIO/boards/marlin_FYSETC_CHEETAH_V20.json @@ -14,7 +14,6 @@ "0x3748" ] ], - "ldscript": "stm32f401rc.ld", "mcu": "stm32f401rct6", "variant": "MARLIN_FYSETC_CHEETAH_V20" }, @@ -56,7 +55,7 @@ "dfu", "jlink" ], - "offset_address": "0x800C000", + "offset_address": "0x8008000", "require_upload_port": true, "use_1200bps_touch": false, "wait_for_upload_port": false diff --git a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/ldscript.ld index 9565cd89c6..eaaff196cd 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/ldscript.ld +++ b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/ldscript.ld @@ -61,7 +61,7 @@ _Min_Stack_Size = 0x400;; /* required amount of stack */ /* Specify the memory areas */ MEMORY { -FLASH (rx) : ORIGIN = 0x800C000, LENGTH = 256K +FLASH (rx) : ORIGIN = 0x8008000, LENGTH = 256K - 32K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K } diff --git a/ini/esp32.ini b/ini/esp32.ini index fcfa829608..9c0c44db67 100644 --- a/ini/esp32.ini +++ b/ini/esp32.ini @@ -27,3 +27,13 @@ monitor_speed = 250000 platform = espressif32@2.1.0 extends = env:esp32 board_build.partitions = default_16MB.csv + +[env:PANDA] +platform = espressif32@2.1.0 +extends = env:esp32 +build_flags = ${env:esp32.build_flags} -DUSE_ESP32_EXIO -DUSE_ESP32_TASK_WDT +lib_deps = ${common.lib_deps} + SoftwareSerialEsp32 +board_build.partitions = Marlin/src/HAL/ESP32/esp32.csv +upload_speed = 115200 +monitor_speed = 115200 diff --git a/ini/native.ini b/ini/native.ini index 2f38e715ed..981e93f996 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -70,13 +70,16 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags} # # Simulator for macOS (MacPorts) # -# sudo port install gcc10 gdb glm libsdl2 freetype +# sudo port install gcc10 gdb glm libsdl2 libsdl2_net freetype # sudo port install ld64 @3_3 +ld64_xcode -# sudo port uninstall ld64 ld64-latest +# # cd /opt/local/bin # sudo rm -f gcc g++ cc -# sudo ln gcc-mp-10 gcc ; sudo ln g++-mp-10 g++ ; sudo ln g++ cc -# cd - +# sudo ln -s gcc-mp-10 gcc ; sudo ln -s g++-mp-10 g++ ; sudo ln -s g++ cc +# This step may be obsolete: +# sudo port uninstall ld64 ld64-latest +# +# cd - # # Use 'sudo port install mesa' to get a if no Xcode is installed. # If Xcode is installed be sure to run `xcode-select --install` first. diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index 00ba93aa63..e11aa03560 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -65,8 +65,7 @@ build_flags = ${common_stm32f1.build_flags} extra_scripts = ${common_stm32f1.extra_scripts} pre:buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py -lib_deps = ${common.lib_deps} - SoftwareSerialM +lib_deps = ${common_stm32f1.lib_deps} USBComposite for STM32F1@0.91 custom_marlin.NEOPIXEL_LED = Adafruit NeoPixel=https://github.com/ccccmagicboy/Adafruit_NeoPixel#meeb_3dp_use debug_tool = stlink @@ -377,7 +376,8 @@ extra_scripts = ${common.extra_scripts} buildroot/share/PlatformIO/scripts/offset_and_rename.py build_flags = ${common_stm32f1.build_flags} -D__STM32F1__=1 -DDEBUG_LEVEL=0 -DSS_TIMER=4 -DSERIAL_USB -lib_deps = USBComposite for STM32F1@0.91 +lib_deps = ${common_stm32f1.lib_deps} + USBComposite for STM32F1@0.91 lib_ignore = Adafruit NeoPixel, SPI, SailfishLCD, SailfishRGB_LED, SlowSoftI2CMaster, TMCStepper [env:STM32F103RC_ZM3E2_USB_maple] diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 7ff0443df6..4544bf56a0 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -48,7 +48,7 @@ build_flags = ${stm32_variant.build_flags} platform = ${common_stm32.platform} extends = stm32_variant board = marlin_FYSETC_CHEETAH_V20 -board_build.offset = 0xC000 +board_build.offset = 0x8000 build_flags = ${stm32_variant.build_flags} -DSTM32F401xC # @@ -404,6 +404,49 @@ build_flags = ${env:mks_robin_nano_v3_usb_flash_drive.build_flags} -DUSBD_USE_CDC_MSC build_unflags = -DUSBD_USE_CDC +# +# MKS Eagle +# 5 TMC2209 uart mode on board +# +[env:mks_eagle] +platform = ${common_stm32.platform} +extends = stm32_variant +board = marlin_STM32F407VGT6_CCM +board_build.variant = MARLIN_F4x7Vx +board_build.offset = 0xC000 +board_upload.offset_address = 0x0800C000 +board_build.rename = mks_eagle.bin +build_flags = ${stm32_variant.build_flags} ${stm32f4_I2C1.build_flags} + -DHAL_PCD_MODULE_ENABLED + -DSTM32_FLASH_SIZE=512 +debug_tool = jlink +upload_protocol = jlink + +# +# MKS Eagle with USB Flash Drive Support +# Currently, using a STM32duino fork, until USB Host get merged +# +[env:mks_eagle_usb_flash_drive] +platform = ${common_stm32.platform} +extends = env:mks_eagle +platform_packages = ${stm_flash_drive.platform_packages} +build_flags = ${stm_flash_drive.build_flags} ${stm32f4_I2C1.build_flags} + -DUSE_USBHOST_HS + -DUSBD_IRQ_PRIO=5 + -DUSBD_IRQ_SUBPRIO=6 + -DUSE_USB_HS_IN_FS + +# +# MKS Eagle with USB Flash Drive Support and Shared Media +# Currently, using a STM32duino fork, until USB Host and USB Device MSC get merged +# +[env:mks_eagle_usb_flash_drive_msc] +platform = ${common_stm32.platform} +extends = env:mks_eagle_usb_flash_drive +build_flags = ${env:mks_eagle_usb_flash_drive.build_flags} + -DUSBD_USE_CDC_MSC +build_unflags = -DUSBD_USE_CDC + # # This I2C1(PB8:I2C1_SCL PB9:I2C1_SDA) is used by MKS Monster8 # @@ -423,6 +466,7 @@ board_upload.offset_address = 0x0800C000 board_build.rename = mks_monster8.bin build_flags = ${stm32_variant.build_flags} ${stm32f4_I2C1_CAN.build_flags} -DHAL_PCD_MODULE_ENABLED -DTIMER_SERIAL=TIM4 + -DSTM32_FLASH_SIZE=512 debug_tool = jlink upload_protocol = jlink