diff --git a/driver.json b/driver.json index bfed664..77ffa84 100644 --- a/driver.json +++ b/driver.json @@ -50,7 +50,7 @@ "name": "BlackBox X32", "symbol": "BOARD_BLACKBOX_X32", "URL": "https://docs.openbuilds.com/doku.php?id=docs:blackbox-x32:start", - "MAP": "main/BlackBoxX32_map.h", + "MAP": "main/boards/BlackBoxX32_map.h", "caps": { "axes": 4, "digital_in": 0, @@ -66,7 +66,7 @@ "name": "BDRING 6-axis I2S", "symbol": "BOARD_BDRING_I2S6A", "URL": "https://github.com/bdring/6-Pack_CNC_Controller", - "MAP": "main/bdring_i2s_6_axis_map.h", + "MAP": "main/boards/bdring_i2s_6_axis_map.h", "caps": { "axes": 6, "digital_in": 0, @@ -85,7 +85,7 @@ { "name": "ESPDUINO-32 Wemos D1 R32", "symbol": "BOARD_ESPDUINO32", - "MAP": "main/espduino-32_wemos_d1_r32_uno_map.h ", + "MAP": "main/boards/espduino-32_wemos_d1_r32_uno_map.h ", "URL": "", "caps": { "axes": 3, @@ -101,7 +101,7 @@ "name": "MKS Tinybee V1.0", "symbol": "BOARD_MKS_TINYBEE_V1", "URL": "https://github.com/makerbase-mks/MKS-TinyBee", - "MAP": "main/mks_tinybee_1_0_map.h", + "MAP": "main/boards/mks_tinybee_1_0_map.h", "caps": { "axes": 5, "digital_in": 0, @@ -117,7 +117,7 @@ "name": "SourceRabbit 4-axis CNC", "symbol": "BOARD_SOURCERABBIT_4AXIS", "URL": "https://www.sourcerabbit.com/", - "MAP": "main/sourcerabbit_4axis.h", + "MAP": "main/boards/sourcerabbit_4axis.h", "caps": { "axes": 4, "auto_square": 0, @@ -134,7 +134,7 @@ "name": "Protoneer v3", "symbol": "BOARD_PROTONEER_3XX", "URL": "https://blog.protoneer.co.nz/arduino-cnc-shield/", - "MAP": "main/protoneer_3.xx_map.h", + "MAP": "main/boards/protoneer_3.xx_map.h", "caps": { "axes": 3, "digital_in": 0, @@ -150,7 +150,7 @@ "name": "Fysetc E4 v1.0", "symbol": "BOARD_FYSETC_E4", "URL": "https://www.fysetc.com/products/fysetc-e4-board-with-built-in-wi-fi-and-bluetooth-4-pcs-tmc2209-240mhz-16m-flash-3d-printer-control-board-based-for-3d-printer?variant=37558333341871", - "MAP": "main/fysetc_e4_map.h", + "MAP": "main/boards/fysetc_e4_map.h", "caps": { "axes": 4, "digital_in": 0, @@ -165,7 +165,7 @@ "name": "xPro v5", "symbol": "BOARD_XPRO_V5", "URL": "https://www.spark-concepts.com/cnc-xpro-v5/", - "MAP": "main/xPro_v5_map.h", + "MAP": "main/boards/xPro_v5_map.h", "caps": { "axes": 3, "digital_in": 2, @@ -182,7 +182,7 @@ "name": "MKS DLC32 2.0", "symbol": "BOARD_MKS_DLC32_V2P0", "URL": "https://github.com/makerbase-mks/MKS-DLC32", - "MAP": "main/mks_dlc32_2_0_map.h", + "MAP": "main/boards/mks_dlc32_2_0_map.h", "caps": { "axes": 3, "digital_in": 1, @@ -198,7 +198,7 @@ "name": "CNC 3040", "symbol": "BOARD_CNC3040", "URL": "https://github.com/shaise/grblHAL_CNC3040", - "MAP": "main/cnc3040_map.h", + "MAP": "main/boards/cnc3040_map.h", "caps": { "axes": 4, "serial_ports": 2, @@ -218,7 +218,7 @@ "name": "BDRING v3.5", "symbol": "BOARD_BDRING_V3P5", "URL": "", - "MAP": "main/bdring_v3.5_map.h", + "MAP": "main/boards/bdring_v3.5_map.h", "caps": { "axes": 3, "digital_in": 0, @@ -233,7 +233,7 @@ "name": "BDRING v4", "symbol": "BOARD_BDRING_V4", "URL": "", - "MAP": "main/bdring_v4_map.h", + "MAP": "main/boards/bdring_v4_map.h", "caps": { "axes": 3, "digital_in": 0, @@ -248,7 +248,7 @@ "name": "CNC BoosterPack", "symbol": "BOARD_CNC_BOOSTERPACK", "URL": "https://github.com/terjeio/CNC_Boosterpack", - "MAP": "main/boosterpack_map.h", + "MAP": "main/boards/boosterpack_map.h", "caps": { "axes": 3, "digital_in": 0, diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index c648ab6..a3b6578 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -223,7 +223,7 @@ set(SRCS i2c.c ioexpand.c i2s_out.c - BlackBoxX32.c + boards/BlackBoxX32.c networking/strutils.c grbl/grbllib.c grbl/coolant_control.c diff --git a/main/BlackBoxX32.c b/main/boards/BlackBoxX32.c similarity index 100% rename from main/BlackBoxX32.c rename to main/boards/BlackBoxX32.c diff --git a/main/BlackBoxX32_map.h b/main/boards/BlackBoxX32_map.h similarity index 100% rename from main/BlackBoxX32_map.h rename to main/boards/BlackBoxX32_map.h diff --git a/main/bdring_i2s_6_axis_map.h b/main/boards/bdring_i2s_6_axis_map.h similarity index 100% rename from main/bdring_i2s_6_axis_map.h rename to main/boards/bdring_i2s_6_axis_map.h diff --git a/main/boards/bdring_i2s_6pack_ext_v2_map.h b/main/boards/bdring_i2s_6pack_ext_v2_map.h new file mode 100644 index 0000000..103c339 --- /dev/null +++ b/main/boards/bdring_i2s_6pack_ext_v2_map.h @@ -0,0 +1,134 @@ +/* + bdring_i2s_6pack_ext_v2_map.h - An embedded CNC Controller with rs274/ngc (g-code) support + + Driver code for ESP32 + + Part of grblHAL + + Copyright (c) 2020-2023 Terje Io + + Grbl 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. + + Grbl 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 Grbl. If not, see . +*/ + +#define BOARD_NAME "BDRING 6-Pack External drives V2.0" + +#define USE_I2S_OUT +#define I2S_OUT_PIN_BASE 64 + +// timer definitions +#define STEP_TIMER_GROUP TIMER_GROUP_0 +#define STEP_TIMER_INDEX TIMER_0 + +#if SDCARD_ENABLE + +// Pin mapping when using SPI mode. +// With this mapping, SD card can be used both in SPI and 1-line SD mode. +// Note that a pull-up on CS line is required in SD mode. +#define PIN_NUM_MISO 19 +#define PIN_NUM_MOSI 23 +#define PIN_NUM_CLK 18 +#define PIN_NUM_CS 5 + +#endif // SDCARD_ENABLE + +#define I2S_OUT_BCK GPIO_NUM_22 +#define I2S_OUT_WS GPIO_NUM_17 +#define I2S_OUT_DATA GPIO_NUM_21 + +#define X_STEP_PIN I2SO(2) +#define X_DIRECTION_PIN I2SO(1) +#define X_ENABLE_PIN I2SO(0) +#define X_LIMIT_PIN GPIO_NUM_39 + +#define Y_STEP_PIN I2SO(5) +#define Y_DIRECTION_PIN I2SO(4) +#define Y_ENABLE_PIN I2SO(7) +#define Y_LIMIT_PIN GPIO_NUM_36 + +#define Z_STEP_PIN I2SO(10) +#define Z_DIRECTION_PIN I2SO(9) +#define Z_ENABLE_PIN I2SO(8) +#define Z_LIMIT_PIN GPIO_NUM_33 + +// Define ganged axis or A axis step pulse and step direction output pins. +#if N_ABC_MOTORS >= 1 +#define M3_AVAILABLE +#define M3_STEP_PIN I2SO(13) +#define M3_DIRECTION_PIN I2SO(12) +#define M3_ENABLE_PIN I2SO(15) +#define M3_LIMIT_PIN GPIO_NUM_32 +#endif + +// Define ganged axis or B axis step pulse and step direction output pins. +#if N_ABC_MOTORS >= 2 +#define M4_AVAILABLE +#define M4_STEP_PIN I2SO(18) +#define M4_DIRECTION_PIN I2SO(17) +#define M4_ENABLE_PIN I2SO(16) +#define M4_LIMIT_PIN GPIO_NUM_35 +#endif + +// Define ganged axis or B axis step pulse and step direction output pins. +#if N_ABC_MOTORS == 3 +#define M5_AVAILABLE +#define M5_STEP_PIN I2SO(21) +#define M5_DIRECTION_PIN I2SO(20) +#define M5_ENABLE_PIN I2SO(23) +#define M5_LIMIT_PIN GPIO_NUM_34 +#endif + +// Define driver spindle pins + +#if DRIVER_SPINDLE_PWM_ENABLE +#define SPINDLE_PWM_PIN GPIO_NUM_26 +#else +#define AUXOUTPUT0_PIN GPIO_NUM_26 +#endif + +#if DRIVER_SPINDLE_DIR_ENABLE +#define SPINDLE_DIRECTION_PIN GPIO_NUM_16 +#else +#define AUXOUTPUT1_PIN GPIO_NUM_16 +#endif + +#if DRIVER_SPINDLE_ENABLE +#define SPINDLE_ENABLE_PIN GPIO_NUM_4 +#else +#define AUXOUTPUT2_PIN GPIO_NUM_4 +#endif + +// Define flood and mist coolant enable output pins. + +//#define COOLANT_MIST_PIN ? + +// Define user-control CONTROLs (cycle start, reset, feed hold) input pins. + +// N/A + +#if MODBUS_ENABLE & MODBUS_RTU_ENABLED +#define UART2_RX_PIN GPIO_NUM_15 +#define UART2_TX_PIN GPIO_NUM_14 +#if MODBUS_ENABLE & MODBUS_RTU_DIR_ENABLED +#define MODBUS_DIRECTION_PIN GPIO_NUM_13 +#endif +#endif + +// Define probe switch input pin. +#if PROBE_ENABLE +#define PROBE_PIN GPIO_NUM_25 +#endif + +#if KEYPAD_ENABLE +#error No free pins for keypad! +#endif diff --git a/main/bdring_v3.5_map.h b/main/boards/bdring_v3.5_map.h similarity index 100% rename from main/bdring_v3.5_map.h rename to main/boards/bdring_v3.5_map.h diff --git a/main/bdring_v4_map.h b/main/boards/bdring_v4_map.h similarity index 100% rename from main/bdring_v4_map.h rename to main/boards/bdring_v4_map.h diff --git a/main/cnc3040_map.h b/main/boards/cnc3040_map.h similarity index 100% rename from main/cnc3040_map.h rename to main/boards/cnc3040_map.h diff --git a/main/cnc_boosterpack_map.h b/main/boards/cnc_boosterpack_map.h similarity index 100% rename from main/cnc_boosterpack_map.h rename to main/boards/cnc_boosterpack_map.h diff --git a/main/boards/cnc_boosterpack_s3_map.h b/main/boards/cnc_boosterpack_s3_map.h new file mode 100644 index 0000000..421bcfc --- /dev/null +++ b/main/boards/cnc_boosterpack_s3_map.h @@ -0,0 +1,132 @@ +/* + cnc_boosterpack_s3_map.h - An embedded CNC Controller with rs274/ngc (g-code) support + + Driver code for ESP32-S3 + + Part of grblHAL + + Copyright (c)2023 Terje Io + + Grbl 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. + + Grbl 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 Grbl. If not, see . +*/ +#if N_ABC_MOTORS > 0 +#error "Axis configuration is not supported!" +#endif + +#define BOARD_NAME "CNC BoosterPack" +#define BOARD_URL "https://github.com/terjeio/CNC_Boosterpack" + +#if TRINAMIC_ENABLE +#ifdef TRINAMIC_MIXED_DRIVERS +#undef TRINAMIC_MIXED_DRIVERS +#endif +#define TRINAMIC_MIXED_DRIVERS 0 +#ifdef TRINAMIC_I2C +#undef TRINAMIC_I2C +#endif +#define TRINAMIC_I2C 1 +#endif + +#if !EEPROM_ENABLE +#undef EEPROM_ENABLE +#define EEPROM_ENABLE 1 // I2C EEPROM (24LC16) support. +#endif + +// timer definitions +#define STEP_TIMER_GROUP TIMER_GROUP_0 +#define STEP_TIMER_INDEX TIMER_0 + +// Define step pulse output pins. +#define X_STEP_PIN GPIO_NUM_26 +#define Y_STEP_PIN GPIO_NUM_27 +#define Z_STEP_PIN GPIO_NUM_14 + +// Define step direction output pins. +#define X_DIRECTION_PIN GPIO_NUM_2 +#define Y_DIRECTION_PIN GPIO_NUM_15 +#define Z_DIRECTION_PIN GPIO_NUM_12 + +// Define stepper driver enable/disable output pin(s). +#define STEPPERS_ENABLE_PIN IOEXPAND + +// Define homing/hard limit switch input pins and limit interrupt vectors. +#define X_LIMIT_PIN GPIO_NUM_4 +#define Y_LIMIT_PIN GPIO_NUM_16 +#define Z_LIMIT_PIN GPIO_NUM_32 + +// Define driver spindle pins + +#if DRIVER_SPINDLE_PWM_ENABLE +#define SPINDLE_PWM_PIN GPIO_NUM_17 +#else +#define AUXOUTPUT0_PIN GPIO_NUM_17 +#endif + +#if DRIVER_SPINDLE_DIR_ENABLE +#define SPINDLE_DIRECTION_PIN IOEXPAND +#endif + +#if DRIVER_SPINDLE_ENABLE +#define SPINDLE_ENABLE_PIN IOEXPAND +#endif + +// Define flood and mist coolant enable output pins. +#define COOLANT_FLOOD_PIN IOEXPAND +#define COOLANT_MIST_PIN IOEXPAND + +// Define user-control CONTROLs (cycle start, reset, feed hold) input pins. +#define RESET_PIN GPIO_NUM_35 +#define FEED_HOLD_PIN GPIO_NUM_39 +#define CYCLE_START_PIN GPIO_NUM_36 +#if SAFETY_DOOR_ENABLE +#define SAFETY_DOOR_PIN GPIO_NUM_34 +#endif + +// Define probe switch input pin. +#define PROBE_PIN GPIO_NUM_13 + +#if I2C_STROBE_ENABLE +#define I2C_STROBE_PIN GPIO_NUM_33 +#else +#define AUXINPUT0_PIN GPIO_NUM_33 +#endif + +#if MODBUS_ENABLE & MODBUS_RTU_ENABLED +#define UART2_RX_PIN GPIO_NUM_33 +#define UART2_TX_PIN GPIO_NUM_25 +#if RS485_DIR_ENABLE +#define MODBUS_DIRECTION_PIN GPIO_NUM_25 +#endif +#endif + +#if MPG_MODE == 1 +#define UART2_RX_PIN GPIO_NUM_33 +#define MPG_ENABLE_PIN GPIO_NUM_25 +#endif + +// Define I2C port/pins +#define I2C_PORT I2C_NUM_1 +#define I2C_SDA GPIO_NUM_21 +#define I2C_SCL GPIO_NUM_22 +#define I2C_CLOCK 100000 + +#if SDCARD_ENABLE +// Pin mapping when using SPI mode. +// With this mapping, SD card can be used both in SPI and 1-line SD mode. +// Note that a pull-up on CS line is required in SD mode. +#define PIN_NUM_MISO GPIO_NUM_19 +#define PIN_NUM_MOSI GPIO_NUM_23 +#define PIN_NUM_CLK GPIO_NUM_18 +#define PIN_NUM_CS GPIO_NUM_5 +#endif diff --git a/main/espduino-32_wemos_d1_r32_uno_map.h b/main/boards/espduino-32_wemos_d1_r32_uno_map.h similarity index 100% rename from main/espduino-32_wemos_d1_r32_uno_map.h rename to main/boards/espduino-32_wemos_d1_r32_uno_map.h diff --git a/main/fysetc_e4_map.h b/main/boards/fysetc_e4_map.h similarity index 100% rename from main/fysetc_e4_map.h rename to main/boards/fysetc_e4_map.h diff --git a/main/generic_map.h b/main/boards/generic_map.h similarity index 100% rename from main/generic_map.h rename to main/boards/generic_map.h diff --git a/main/jackpot_map.h b/main/boards/jackpot_map.h similarity index 100% rename from main/jackpot_map.h rename to main/boards/jackpot_map.h diff --git a/main/mks_dlc32_2_0_map.h b/main/boards/mks_dlc32_2_0_map.h similarity index 100% rename from main/mks_dlc32_2_0_map.h rename to main/boards/mks_dlc32_2_0_map.h diff --git a/main/mks_tinybee_1_0_map.h b/main/boards/mks_tinybee_1_0_map.h similarity index 100% rename from main/mks_tinybee_1_0_map.h rename to main/boards/mks_tinybee_1_0_map.h diff --git a/main/protoneer_3.xx_map.h b/main/boards/protoneer_3.xx_map.h similarity index 100% rename from main/protoneer_3.xx_map.h rename to main/boards/protoneer_3.xx_map.h diff --git a/main/root_cnc_v2_map.h b/main/boards/root_cnc_v2_map.h similarity index 100% rename from main/root_cnc_v2_map.h rename to main/boards/root_cnc_v2_map.h diff --git a/main/root_cnc_v3_map.h b/main/boards/root_cnc_v3_map.h similarity index 100% rename from main/root_cnc_v3_map.h rename to main/boards/root_cnc_v3_map.h diff --git a/main/sourcerabbit_4axis.h b/main/boards/sourcerabbit_4axis.h similarity index 100% rename from main/sourcerabbit_4axis.h rename to main/boards/sourcerabbit_4axis.h diff --git a/main/xPro_v5_map.h b/main/boards/xPro_v5_map.h similarity index 100% rename from main/xPro_v5_map.h rename to main/boards/xPro_v5_map.h diff --git a/main/driver.h b/main/driver.h index b11a5ae..fdfa192 100644 --- a/main/driver.h +++ b/main/driver.h @@ -154,42 +154,42 @@ typedef struct { // End configuration #ifdef BOARD_CNC_BOOSTERPACK - #include "cnc_boosterpack_map.h" + #include "boards/cnc_boosterpack_map.h" #elif defined(BOARD_BDRING_V4) - #include "bdring_v4_map.h" + #include "boards/bdring_v4_map.h" #elif defined(BOARD_BDRING_V3P5) - #include "bdring_v3.5_map.h" + #include "boards/bdring_v3.5_map.h" #elif defined(BOARD_BDRING_I2S6A) - #include "bdring_i2s_6_axis_map.h" + #include "boards/bdring_i2s_6_axis_map.h" #elif defined(BOARD_ESPDUINO32) - #include "espduino-32_wemos_d1_r32_uno_map.h" + #include "boards/espduino-32_wemos_d1_r32_uno_map.h" #elif defined(BOARD_SOURCERABBIT_4AXIS) - #include "sourcerabbit_4axis.h" + #include "boards/sourcerabbit_4axis.h" #elif defined(BOARD_PROTONEER_3XX) - #include "protoneer_3.xx_map.h" + #include "boards/protoneer_3.xx_map.h" #elif defined(BOARD_FYSETC_E4) - #include "fysetc_e4_map.h" + #include "boards/fysetc_e4_map.h" #elif defined(BOARD_XPRO_V5) - #include "xPro_v5_map.h" + #include "boards/xPro_v5_map.h" #elif defined(BOARD_MKS_DLC32_V2P0) - #include "mks_dlc32_2_0_map.h" + #include "boards/mks_dlc32_2_0_map.h" #elif defined(BOARD_MKS_TINYBEE_V1) - #include "mks_tinybee_1_0_map.h" + #include "boards/mks_tinybee_1_0_map.h" #elif defined(BOARD_BLACKBOX_X32) - #include "BlackBoxX32_map.h" + #include "boards/BlackBoxX32_map.h" #elif defined(BOARD_ROOTCNC_V2) - #include "root_cnc_v2_map.h" + #include "boards/root_cnc_v2_map.h" #elif defined(BOARD_ROOTCNC_V3) - #include "root_cnc_v3_map.h" + #include "boards/root_cnc_v3_map.h" #elif defined(BOARD_BLOX) - #include "blox_map.h" + #include "boards/blox_map.h" #elif defined(BOARD_CNC3040) - #include "cnc3040_map.h" + #include "boards/cnc3040_map.h" #elif defined(BOARD_MY_MACHINE) - #include "my_machine_map.h" + #include "boards/my_machine_map.h" #else // default board - NOTE: NOT FINAL VERSION! #warning "Compiling for generic board!" - #include "generic_map.h" + #include "boards/generic_map.h" #endif #ifndef GRBL_ESP32 diff --git a/platformio.cnc3040.ini b/platformio.cnc3040.ini index 031839a..a2364fe 100644 --- a/platformio.cnc3040.ini +++ b/platformio.cnc3040.ini @@ -16,7 +16,7 @@ include_dir = main build_flags = [env:esp32doit-devkit-v1] -platform = espressif32 @ ~3.4.0 +platform = espressif32 @ @ ~4.0.0 framework = espidf board = esp32doit-devkit-v1 board_build.partitions = partitions.csv diff --git a/platformio.tpl b/platformio.tpl index d67a747..6bdcace 100644 --- a/platformio.tpl +++ b/platformio.tpl @@ -10,7 +10,7 @@ include_dir = main build_flags = [env:%env_name%] -platform = espressif32 @ ~3.4.0 +platform = espressif32 @ @ ~4.0.0 framework = espidf board =%board% board_build.partitions = partitions.csv