From 2f5dabbab8d4988515dd9045652a2ddd5eb8ade3 Mon Sep 17 00:00:00 2001 From: abe yoshimasa Date: Sun, 3 Oct 2021 15:14:55 +0900 Subject: [PATCH 1/4] =?UTF-8?q?resp32=E7=94=A8=E3=81=AE=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 2 +- Marlin/src/core/boards.h | 1 + .../pins/custom/esp32/pins_resp32_custom.h | 91 +++++++++++++++++++ Marlin/src/pins/pins.h | 2 + platformio.ini | 2 +- 5 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 Marlin/src/pins/custom/esp32/pins_resp32_custom.h diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 8f530369e3d6..b3bfbe98afdc 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -139,7 +139,7 @@ // Choose the name from boards.h that matches your setup #ifndef MOTHERBOARD - #define MOTHERBOARD BOARD_RAMPS_14_EFB + #define MOTHERBOARD BOARD_RESP32_CUSTOM #endif // Name displayed in the LCD "Ready" message and Info menu diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 2ed585919966..ba9947712bc0 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -422,6 +422,7 @@ // // Custom board // +#define BOARD_RESP32_CUSTOM 9001 // rutilea ESP32 custom board #define BOARD_CUSTOM 9998 // Custom pins definition for development and/or rare boards diff --git a/Marlin/src/pins/custom/esp32/pins_resp32_custom.h b/Marlin/src/pins/custom/esp32/pins_resp32_custom.h new file mode 100644 index 000000000000..e31d611181bc --- /dev/null +++ b/Marlin/src/pins/custom/esp32/pins_resp32_custom.h @@ -0,0 +1,91 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 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 + +/** + * Espressif ESP32 (Tensilica Xtensa LX6) pin assignments + */ + +#if NOT_TARGET(ARDUINO_ARCH_ESP32) + "Oops! Select an ESP32 board in 'Tools > Board.'" +#endif + +#define BOARD_INFO_NAME "Espressif ESP32" + +// +// I2S (steppers & other output-only pins) +// +#define I2S_STEPPER_STREAM +#define I2S_WS -1 +#define I2S_BCK -1 +#define I2S_DATA -1 + +// +// Limit Switches +// +#define X_MIN_PIN 34 +#define Y_MIN_PIN 35 +#define Z_MIN_PIN 15 + +// +// Steppers +// +#define X_STEP_PIN 27 +#define X_DIR_PIN 26 +#define X_ENABLE_PIN 25 +//#define X_CS_PIN 0 + +#define Y_STEP_PIN 33 +#define Y_DIR_PIN 32 +#define Y_ENABLE_PIN X_ENABLE_PIN +//#define Y_CS_PIN 13 + +#define Z_STEP_PIN 14 +#define Z_DIR_PIN 12 +#define Z_ENABLE_PIN X_ENABLE_PIN +//#define Z_CS_PIN 5 // SS_PIN + +#define E0_STEP_PIN 16 +#define E0_DIR_PIN 17 +#define E0_ENABLE_PIN X_ENABLE_PIN +//#define E0_CS_PIN 21 + +// +// Temperature Sensors +// +#define TEMP_0_PIN 36 // Analog Input +#define TEMP_BED_PIN 39 // Analog Input + +// +// Heaters / Fans +// +#define HEATER_0_PIN 2 +#define FAN_PIN 13 +#define HEATER_BED_PIN 4 + +// SPI + +#define MOSI_PIN 23 +#define MISO_PIN 19 +#define SCK_PIN 18 +#define SDSS 5 +#define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 28c7ed007170..a8085c1f77f0 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -683,6 +683,8 @@ #elif MB(CUSTOM) #include "pins_custom.h" // env:custom +#elif MB(RESP32_CUSTOM) + #include "custom/esp32/pins_resp32_custom.h" // ESP32 env:esp32 // // Linux Native Debug board diff --git a/platformio.ini b/platformio.ini index db4d12ea7fb3..cc5800d446b1 100644 --- a/platformio.ini +++ b/platformio.ini @@ -13,7 +13,7 @@ [platformio] src_dir = Marlin boards_dir = buildroot/share/PlatformIO/boards -default_envs = mega2560 +default_envs = esp32 include_dir = Marlin extra_configs = ini/avr.ini From 3996788f9cced13bdc17342c8f8906aaa99f3953 Mon Sep 17 00:00:00 2001 From: abe yoshimasa Date: Wed, 20 Oct 2021 09:54:05 +0900 Subject: [PATCH 2/4] add_fan_pin --- Marlin/src/pins/custom/esp32/pins_resp32_custom.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Marlin/src/pins/custom/esp32/pins_resp32_custom.h b/Marlin/src/pins/custom/esp32/pins_resp32_custom.h index e31d611181bc..0982e76bf2e8 100644 --- a/Marlin/src/pins/custom/esp32/pins_resp32_custom.h +++ b/Marlin/src/pins/custom/esp32/pins_resp32_custom.h @@ -79,8 +79,9 @@ // Heaters / Fans // #define HEATER_0_PIN 2 -#define FAN_PIN 13 -#define HEATER_BED_PIN 4 +#define FAN1_PIN 13 +#define FAN2_PIN 4 +#define HEATER_BED_PIN 2 // SPI From 62500af6b436fe2f6c1059aff8ac7536ccda84c3 Mon Sep 17 00:00:00 2001 From: abe yoshimasa Date: Sat, 4 Dec 2021 17:54:45 +0900 Subject: [PATCH 3/4] fix_temp --- Marlin/Configuration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index b3bfbe98afdc..2b3acaa3b6a2 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -482,7 +482,7 @@ * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * */ -#define TEMP_SENSOR_0 1 +#define TEMP_SENSOR_0 998 #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 #define TEMP_SENSOR_3 0 From 990b6326f366c1981e97bf16f64a22d136a1f15e Mon Sep 17 00:00:00 2001 From: abe yoshimasa Date: Sat, 4 Dec 2021 17:55:20 +0900 Subject: [PATCH 4/4] add_intpin_interruption --- Marlin/src/MarlinCore.cpp | 16 +++++++++++++++- .../src/pins/custom/esp32/pins_resp32_custom.h | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index acb7e9c39a8a..40557da49ed6 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -1125,6 +1125,15 @@ inline void tmc_standby_setup() { * - Open Touch Screen Calibration screen, if not calibrated * - Set Marlin to RUNNING State */ + +bool flag_hogee = false; + +void kill_hogee_ISR(){ + parser.command_letter='M'; + parser.codenum=410; + flag_hogee=true; +} + void setup() { #ifdef FASTIO_INIT FASTIO_INIT(); @@ -1630,6 +1639,8 @@ void setup() { marlin_state = MF_RUNNING; SETUP_LOG("setup() completed."); + pinMode(KILL_hogee, INPUT); + attachInterrupt(digitalPinToInterrupt(KILL_hogee), kill_hogee_ISR, HIGH); } /** @@ -1659,6 +1670,9 @@ void loop() { endstops.event_handler(); TERN_(HAS_TFT_LVGL_UI, printer_state_polling()); - + if (flag_hogee){ + gcode.process_parsed_command(); + flag_hogee=false; + } } while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards } diff --git a/Marlin/src/pins/custom/esp32/pins_resp32_custom.h b/Marlin/src/pins/custom/esp32/pins_resp32_custom.h index 0982e76bf2e8..387d8cf2d1c1 100644 --- a/Marlin/src/pins/custom/esp32/pins_resp32_custom.h +++ b/Marlin/src/pins/custom/esp32/pins_resp32_custom.h @@ -80,8 +80,9 @@ // #define HEATER_0_PIN 2 #define FAN1_PIN 13 -#define FAN2_PIN 4 +// #define FAN2_PIN 4 #define HEATER_BED_PIN 2 +#define KILL_hogee 4 // SPI