#pragma once
// clang-format off

/*
    3axis_v4.h
    Part of Grbl_ESP32

    Pin assignments for the ESP32 Development Controller, v4.1 and later.
    https://github.com/bdring/Grbl_ESP32_Development_Controller
    https://www.tindie.com/products/33366583/grbl_esp32-cnc-development-board-v35/

    2018    - Bart Dring
    2020    - Mitch Bradley

    Grbl_ESP32 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_ESP32.  If not, see <http://www.gnu.org/licenses/>.
*/
// #define CUSTOM_CODE_FILENAME    "../Custom/CoreXY.cpp"

// #define USE_KINEMATICS      // there are kinematic equations for this machine
// #define USE_FWD_KINEMATICS  // report in cartesian
// #define USE_MACHINE_INIT    // There is some custom initialization for this machine
// #define USE_CUSTOM_HOMING
// #define MIDTBOT             // applies the geometry correction to the kinematics 

#define MACHINE_NAME            "ESP32_V4"

//默认4轴或者3轴双Y


//corexy

// #define CUSTOM_CODE_FILENAME    "../Custom/CoreXY.cpp"

// #define USE_KINEMATICS      // there are kinematic equations for this machine
// #define USE_FWD_KINEMATICS  // report in cartesian
// #define USE_MACHINE_INIT    // There is some custom initialization for this machine
// #define USE_CUSTOM_HOMING

// 限制
//2024年10月31日 好像corexy 定义ABC的话,XYZ也会无输出?
// 仅限 XY 且可使用 CoreXY
// 最多 3 个轴（无 ABC 轴）
// 不能将多个轴放在一个归位循环中
// 您不能拥有任何双电机（联动）轴。

// #define MIDTBOT             //如果您使用的是 midTbot 风格的机器，也请添加此行。

//##corexy


#define X_STEP_PIN              GPIO_NUM_13
#define X_DIRECTION_PIN         GPIO_NUM_14

#define Y_STEP_PIN              GPIO_NUM_26
#define Y_DIRECTION_PIN         GPIO_NUM_12

#define Z_STEP_PIN              GPIO_NUM_15
#define Z_DIRECTION_PIN         GPIO_NUM_33

#define A_STEP_PIN              GPIO_NUM_25
#define A_DIRECTION_PIN         GPIO_NUM_32



// //激光
// #define SPINDLE_TYPE            SpindleType::LASER
// #define LASER_OUTPUT_PIN      GPIO_NUM_2   //PWM

// //激光      ####


#define X_LIMIT_PIN             GPIO_NUM_17
#define Y_LIMIT_PIN             GPIO_NUM_4
#define Z_LIMIT_PIN             GPIO_NUM_16
//#define A_LIMIT_PIN             GPIO_NUM_35   //默认不定义 也就是四轴,但是3个限位XYZ ,默认为暂停.然后双Y或者需要四轴四限位,则挤占此引脚,然后IO36启动/暂停改为单引脚,自动判断

// 步进驱动器使能引脚
#define STEPPERS_DISABLE_PIN    GPIO_NUM_27


#define SPINDLE_TYPE            SpindleType::PWM
#define SPINDLE_OUTPUT_PIN      GPIO_NUM_2   // PWM
#define SPINDLE_ENABLE_PIN      GPIO_NUM_22  // M3
#define SPINDLE_DIRECTION_PIN   GPIO_NUM_22  //主轴方向 不然激光M4不能用

#define COOLANT_FLOOD_PIN       GPIO_NUM_21  // m8


#define PROBE_PIN GPIO_NUM_34  // 探测 对刀


#define CONTROL_RESET_PIN       GPIO_NUM_39  // 复位
#define CONTROL_FEED_HOLD_PIN   GPIO_NUM_35  // 暂停
#define CONTROL_CYCLE_START_PIN GPIO_NUM_36  // 启动


//全部验证ok


