Skip to content

Commit

Permalink
Moved build configuration from CMakeLists.txt to my_machine.h.
Browse files Browse the repository at this point in the history
More changes for ESP32-S3 compatibility, still work in progress but getting closer.
Added support for third UART (serial port).
Further updates for assigning optional signals to aux input ports.
  • Loading branch information
terjeio committed Jan 12, 2024
1 parent 21111b1 commit c29bde5
Show file tree
Hide file tree
Showing 23 changed files with 3,460 additions and 791 deletions.
607 changes: 110 additions & 497 deletions main/CMakeLists.txt

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions main/bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Part of grblHAL
Copyright (c) 2018-2023 Terje Io
Copyright (c) 2018-2024 Terje Io
Some parts of the code is based on example code by Espressif, in the public domain
Expand All @@ -23,6 +23,10 @@
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/

#include "driver.h"

#if BLUETOOTH_ENABLE == 1

#include <stdint.h>
#include <string.h>
#include <stdbool.h>
Expand All @@ -39,7 +43,6 @@
#include "esp_bt_device.h"
#include "esp_spp_api.h"

#include "driver.h"
#include "bluetooth.h"
#include "grbl/grbl.h"
#include "grbl/report.h"
Expand Down Expand Up @@ -625,8 +628,6 @@ bool bluetooth_disable_local (void)
return true;
}

#if BLUETOOTH_ENABLE

static const setting_group_detail_t bluetooth_groups [] = {
{ Group_Root, Group_Bluetooth, "Bluetooth"},
};
Expand Down
9 changes: 4 additions & 5 deletions main/boards/BlackBoxX32_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,14 @@
#define COOLANT_FLOOD_PIN GPIO_NUM_21 // coolant
//#define COOLANT_MIST_PIN GPIO_NUM_21 // or mist

#define AUXINPUT0_PIN GPIO_NUM_0 // Mode button on front panel
#define AUXINPUT1_PIN GPIO_NUM_16

// Define user-control CONTROLs (cycle start, reset, feed hold) input pins.
#if SAFETY_DOOR_ENABLE
#define SAFETY_DOOR_PIN GPIO_NUM_16
#else
#define AUXINPUT1_PIN GPIO_NUM_16
#define SAFETY_DOOR_PIN AUXINPUT1_PIN
#endif

#define AUXINPUT0_PIN GPIO_NUM_0 // Mode button on front panel

// 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.
Expand Down
2 changes: 1 addition & 1 deletion main/boards/bdring_i2s_6_axis_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Part of grblHAL
Copyright (c) 2020-2023 Terje Io
Copyright (c) 2020-2024 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
Expand Down
2 changes: 1 addition & 1 deletion main/boards/bdring_i2s_6pack_ext_v2_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Part of grblHAL
Copyright (c) 2020-2023 Terje Io
Copyright (c) 2020-2024 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
Expand Down
15 changes: 8 additions & 7 deletions main/boards/bdring_v3.5_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Part of grblHAL
Copyright (c) 2020-2022 Terje Io
Copyright (c) 2020-2024 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
Expand Down Expand Up @@ -56,17 +56,19 @@
// Define driver spindle pins

#if DRIVER_SPINDLE_PWM_ENABLE
#define SPINDLE_PWM_PIN GPIO_NUM_17
#define SPINDLE_PWM_PIN GPIO_NUM_17
#else
#define AUXOUTPUT0_PIN GPIO_NUM_17
#define AUXOUTPUT0_PIN GPIO_NUM_17
#endif

#if DRIVER_SPINDLE_ENABLE
#define SPINDLE_ENABLE_PIN GPIO_NUM_22
#define SPINDLE_ENABLE_PIN GPIO_NUM_22
#else
#define AUXOUTPUT1_PIN GPIO_NUM_22
#define AUXOUTPUT1_PIN GPIO_NUM_22
#endif

#define AUXINPUT0_PIN GPIO_NUM_35

// Define flood and mist coolant enable output pins.

// N/A
Expand All @@ -76,7 +78,7 @@
#define FEED_HOLD_PIN GPIO_NUM_36
#define CYCLE_START_PIN GPIO_NUM_39
#if SAFETY_DOOR_ENABLE
#define SAFETY_DOOR_PIN GPIO_NUM_35
#define SAFETY_DOOR_PIN AUXINPUT0_PIN
#endif

// Define probe switch input pin.
Expand All @@ -97,4 +99,3 @@
#if KEYPAD_ENABLE
#error No free pins for keypad!
#endif

8 changes: 5 additions & 3 deletions main/boards/bdring_v4_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Part of grblHAL
Copyright (c) 2020-2023 Terje Io
Copyright (c) 2020-2024 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
Expand Down Expand Up @@ -59,6 +59,8 @@
#define SPINDLE_ENABLE_PIN GPIO_NUM_22
#endif

#define AUXINPUT0_PIN GPIO_NUM_35

// Define flood and mist coolant enable output pins.

#define COOLANT_FLOOD_PIN GPIO_NUM_25
Expand All @@ -71,7 +73,7 @@
#define FEED_HOLD_PIN GPIO_NUM_36
#define CYCLE_START_PIN GPIO_NUM_39
#if SAFETY_DOOR_ENABLE
#define SAFETY_DOOR_PIN GPIO_NUM_35
#define SAFETY_DOOR_PIN AUXINPUT0_PIN
#endif

// Define probe switch input pin.
Expand All @@ -92,7 +94,7 @@
#if MODBUS_ENABLE & MODBUS_RTU_ENABLED
#define UART2_RX_PIN GPIO_NUM_22
#define UART2_TX_PIN GPIO_NUM_21
#if RS485_DIR_ENABLE
#if MODBUS_ENABLE & MODBUS_RTU_DIR_ENABLED
#define MODBUS_DIRECTION_PIN GPIO_NUM_2
#endif
#endif
Expand Down
8 changes: 5 additions & 3 deletions main/boards/cnc_boosterpack_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Part of grblHAL
Copyright (c) 2020-2023 Terje Io
Copyright (c) 2020-2024 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
Expand Down Expand Up @@ -90,12 +90,14 @@
#define COOLANT_FLOOD_PIN IOEXPAND
#define COOLANT_MIST_PIN IOEXPAND

#define AUXINPUT1_PIN GPIO_NUM_34

// 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
#define SAFETY_DOOR_PIN AUXINPUT1_PIN
#endif

// Define probe switch input pin.
Expand All @@ -110,7 +112,7 @@
#if MODBUS_ENABLE & MODBUS_RTU_ENABLED
#define UART2_RX_PIN GPIO_NUM_33
#define UART2_TX_PIN GPIO_NUM_25
#if RS485_DIR_ENABLE
#if MODBUS_ENABLE & MODBUS_RTU_DIR_ENABLED
#define MODBUS_DIRECTION_PIN GPIO_NUM_25
#endif
#endif
Expand Down
8 changes: 5 additions & 3 deletions main/boards/cnc_boosterpack_s3_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Part of grblHAL
Copyright (c)2023 Terje Io
Copyright (c)2023-2024 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
Expand Down Expand Up @@ -81,6 +81,8 @@
#define SPINDLE_ENABLE_PIN IOEXPAND
#endif

#define AUXINPUT1_PIN GPIO_NUM_34

// Define flood and mist coolant enable output pins.
#define COOLANT_FLOOD_PIN IOEXPAND
#define COOLANT_MIST_PIN IOEXPAND
Expand All @@ -90,7 +92,7 @@
#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
#define SAFETY_DOOR_PIN AUXINPUT1_PIN
#endif

// Define probe switch input pin.
Expand All @@ -105,7 +107,7 @@
#if MODBUS_ENABLE & MODBUS_RTU_ENABLED
#define UART2_RX_PIN GPIO_NUM_33
#define UART2_TX_PIN GPIO_NUM_25
#if RS485_DIR_ENABLE
#if MODBUS_ENABLE & MODBUS_RTU_DIR_ENABLED
#define MODBUS_DIRECTION_PIN GPIO_NUM_25
#endif
#endif
Expand Down
19 changes: 8 additions & 11 deletions main/boards/mks_tinybee_1_0_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Part of grblHAL
Copyright (c) 2022 Ennio Sesana
Copyright (c) 2023 Terje Io (added SD card, ModBus and MPG options)
Copyright (c) 2023-2024 Terje Io (added SD card, ModBus and MPG options)
Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -28,9 +28,13 @@
#define USE_I2S_OUT
#define I2S_OUT_PIN_BASE 64

#define SERIAL2_ENABLE 1
#define UART2_RX_PIN GPIO_NUM_16 // EXP_1
#define UART2_TX_PIN GPIO_NUM_17 // EXP_1

// timer definitions
#define STEP_TIMER_GROUP TIMER_GROUP_0
#define STEP_TIMER_INDEX TIMER_0
#define STEP_TIMER_GROUP TIMER_GROUP_0
#define STEP_TIMER_INDEX TIMER_0

#define I2S_OUT_BCK GPIO_NUM_25
#define I2S_OUT_WS GPIO_NUM_26
Expand Down Expand Up @@ -113,16 +117,9 @@
#define PROBE_PIN GPIO_NUM_35 // MT_DET
#endif

#if MODBUS_ENABLE & MODBUS_RTU_ENABLED
#define UART2_RX_PIN GPIO_NUM_16 // EXP_1
#define UART2_TX_PIN GPIO_NUM_17 // EXP_1
#if MODBUS_ENABLE & MODBUS_RTU_DIR_ENABLED
#define MODBUS_DIRECTION_PIN GPIO_NUM_13 // EXP_1
#endif
#endif

#if MPG_MODE == 1
#define UART2_RX_PIN GPIO_NUM_16 // EXP_1
#elif MPG_MODE == 1
#define MPG_ENABLE_PIN GPIO_NUM_13 // EXP_1
#endif

Expand Down
13 changes: 5 additions & 8 deletions main/boards/xPro_v5_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,26 +72,23 @@
#define AUXOUTPUT1_PIN GPIO_NUM_4
#endif

#define AUXINPUT0_PIN GPIO_NUM_13
#define AUXINPUT1_PIN GPIO_NUM_0

// Define flood and mist coolant enable output pins.
// Only one can be enabled!

#define COOLANT_MIST_PIN GPIO_NUM_21
//#define COOLANT_FLOOD_PIN GPIO_NUM_21
// Define user-control CONTROLs (cycle start, reset, feed hold) input pins.
#if SAFETY_DOOR_ENABLE
#define SAFETY_DOOR_PIN GPIO_NUM_16
#else
#define RESET_PIN GPIO_NUM_16 //??
#endif

#define RESET_PIN GPIO_NUM_16

// Define probe switch input pin.
#if PROBE_ENABLE
#define PROBE_PIN GPIO_NUM_22
#endif

#define AUXINPUT0_PIN GPIO_NUM_13
#define AUXINPUT1_PIN GPIO_NUM_0

// 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.
Expand Down
Loading

0 comments on commit c29bde5

Please sign in to comment.