// TMC SPI stepper driver init

#if AXIS1_DRIVER_MODEL == TMC_SPI
  #if AXIS1_DRIVER_DECAY_MODE == OFF
    #undef AXIS1_DRIVER_DECAY_MODE
    #define AXIS1_DRIVER_DECAY_MODE SPREADCYCLE
  #endif
  #if AXIS1_DRIVER_DECAY_MODE_GOTO == OFF
    #undef AXIS1_DRIVER_DECAY_MODE_GOTO
    #define AXIS1_DRIVER_DECAY_MODE_GOTO SPREADCYCLE
  #endif
  #if AXIS1_DRIVER_INTPOL == OFF
    #undef AXIS1_DRIVER_INTPOL
    #define AXIS1_DRIVER_INTPOL true
  #endif
  #if AXIS1_DRIVER_IRUN == OFF
    #undef AXIS1_DRIVER_IRUN
    #define AXIS1_DRIVER_IRUN 2500
  #endif
  #if AXIS1_DRIVER_IHOLD == OFF
    #undef AXIS1_DRIVER_IHOLD
    #define AXIS1_DRIVER_IHOLD (AXIS1_DRIVER_IRUN/2)
  #endif
  #if AXIS1_DRIVER_IGOTO == OFF
    #undef AXIS1_DRIVER_IGOTO
    #define AXIS1_DRIVER_IGOTO AXIS1_DRIVER_IRUN
  #endif
  #ifndef AXIS1_DRIVER_RSENSE
    #define AXIS1_DRIVER_RSENSE (0.11+0.02)
  #endif
#endif

#if AXIS1_DRIVER_MODEL == TMC_SPI
  #if AXIS2_DRIVER_DECAY_MODE == OFF
    #undef AXIS2_DRIVER_DECAY_MODE
    #define AXIS2_DRIVER_DECAY_MODE SPREADCYCLE
  #endif
  #if AXIS2_DRIVER_DECAY_MODE_GOTO == OFF
    #undef AXIS2_DRIVER_DECAY_MODE_GOTO
    #define AXIS2_DRIVER_DECAY_MODE_GOTO SPREADCYCLE
  #endif
  #if AXIS2_DRIVER_INTPOL == OFF
    #undef AXIS2_DRIVER_INTPOL
    #define AXIS2_DRIVER_INTPOL true
  #endif
  #if AXIS2_DRIVER_IRUN == OFF
    #undef AXIS2_DRIVER_IRUN
    #define AXIS2_DRIVER_IRUN 2500
  #endif
  #if AXIS2_DRIVER_IHOLD == OFF
    #undef AXIS2_DRIVER_IHOLD
    #define AXIS2_DRIVER_IHOLD (AXIS2_DRIVER_IRUN/2)
  #endif
  #if AXIS2_DRIVER_IGOTO == OFF
    #undef AXIS2_DRIVER_IGOTO
    #define AXIS2_DRIVER_IGOTO AXIS1_DRIVER_IRUN
  #endif
  #ifndef AXIS2_DRIVER_RSENSE
    #define AXIS2_DRIVER_RSENSE (0.11+0.02)
  #endif
#endif

// Focuser/rotator

#if ROTATOR == ON && AXIS3_DRIVER_MODEL == TMC_SPI
  #if AXIS3_DRIVER_DECAY_MODE == OFF
    #undef AXIS3_DRIVER_DECAY_MODE
    #define AXIS3_DRIVER_DECAY_MODE SPREADCYCLE
  #endif
  #if AXIS3_DRIVER_INTPOL == OFF
    #undef AXIS3_DRIVER_INTPOL
    #define AXIS3_DRIVER_INTPOL true
  #endif
  #if AXIS3_DRIVER_IRUN == OFF
    #undef AXIS3_DRIVER_IRUN
    #define AXIS3_DRIVER_IRUN 2500
  #endif
  #if AXIS3_DRIVER_IHOLD == OFF
    #undef AXIS3_DRIVER_IHOLD
    #define AXIS3_DRIVER_IHOLD (AXIS3_DRIVER_IRUN/2)
  #endif
  #ifndef AXIS3_DRIVER_RSENSE
    #define AXIS3_DRIVER_RSENSE (0.11+0.02)
  #endif
#endif

#if FOCUSER1 == ON && AXIS4_DRIVER_MODEL == TMC_SPI
  #if AXIS4_DRIVER_DECAY_MODE == OFF
    #undef AXIS4_DRIVER_DECAY_MODE
    #define AXIS4_DRIVER_DECAY_MODE SPREADCYCLE
  #endif
  #if AXIS4_DRIVER_INTPOL == OFF
    #undef AXIS4_DRIVER_INTPOL
    #define AXIS4_DRIVER_INTPOL true
  #endif
  #if AXIS4_DRIVER_IRUN == OFF
    #undef AXIS4_DRIVER_IRUN
    #define AXIS4_DRIVER_IRUN 2500
  #endif
  #if AXIS4_DRIVER_IHOLD == OFF
    #undef AXIS4_DRIVER_IHOLD
    #define AXIS4_DRIVER_IHOLD (AXIS4_DRIVER_IRUN/2)
  #endif
  #ifndef AXIS4_DRIVER_RSENSE
    #define AXIS4_DRIVER_RSENSE (0.11+0.02)
  #endif
#endif

#if FOCUSER2 == ON && AXIS5_DRIVER_MODEL == TMC_SPI
  #if AXIS5_DRIVER_DECAY_MODE == OFF
    #undef AXIS5_DRIVER_DECAY_MODE
    #define AXIS5_DRIVER_DECAY_MODE SPREADCYCLE
  #endif
  #if AXIS5_DRIVER_INTPOL == OFF
    #undef AXIS5_DRIVER_INTPOL
    #define AXIS5_DRIVER_INTPOL true
  #endif
  #if AXIS5_DRIVER_IRUN == OFF
    #undef AXIS5_DRIVER_IRUN
    #define AXIS5_DRIVER_IRUN 2500
  #endif
  #if AXIS5_DRIVER_IHOLD == OFF
    #undef AXIS5_DRIVER_IHOLD
    #define AXIS5_DRIVER_IHOLD (AXIS5_DRIVER_IRUN/2)
  #endif
  #ifndef AXIS5_DRIVER_RSENSE
    #define AXIS5_DRIVER_RSENSE (0.11+0.02)
  #endif
#endif
