HI,
I am programming for the BigTreeTech Octopus board. I am trying to make cycling through the motors using a multi-dimensional array.
Like this:
//// Steppers
//
#define M0_STEP_PIN PF13 // MOTOR 0
#define M0_DIR_PIN PF12
#define M0_ENABLE_PIN PF14
#define M0_CS_PIN PC4
#define M1_STEP_PIN PG0 // MOTOR 1
#define M1_DIR_PIN PG1
#define M1_ENABLE_PIN PF15
#define M1_CS_PIN PD11
#define M2_STEP_PIN PF11 // MOTOR 2
#define M2_DIR_PIN PG3
#define M2_ENABLE_PIN PG5
#define M2_CS_PIN PC6
#define M3_STEP_PIN PG4 // MOTOR 3
#define M3_DIR_PIN PC1
#define M3_ENABLE_PIN PA0
#define M3_CS_PIN PC7
#define M4_STEP_PIN PF9 // MOTOR 4
#define M4_DIR_PIN PF10
#define M4_ENABLE_PIN PG2
#define M4_CS_PIN PF2
#define M5_STEP_PIN PC13 // MOTOR 5
#define M5_DIR_PIN PF0
#define M5_ENABLE_PIN PF1
#define M5_CS_PIN PE4
#define M6_STEP_PIN PE2 // MOTOR 6
#define M6_DIR_PIN PE3
#define M6_ENABLE_PIN PD4
#define M6_CS_PIN PE1
#define M7_STEP_PIN PE6 // MOTOR 7
#define M7_DIR_PIN PA14
#define M7_ENABLE_PIN PE0
#define M7_CS_PIN PD3
const STEPPERS[8][4]{{M0_STEP_PIN, M0_DIR_PIN, M0_ENABLE_PIN, M0_CS_PIN},
{M1_STEP_PIN, M1_DIR_PIN, M1_ENABLE_PIN, M1_CS_PIN},
{M2_STEP_PIN, M2_DIR_PIN, M2_ENABLE_PIN, M2_CS_PIN},
{M3_STEP_PIN, M3_DIR_PIN, M3_ENABLE_PIN, M3_CS_PIN},
{M4_STEP_PIN, M4_DIR_PIN, M4_ENABLE_PIN, M4_CS_PIN},
{M5_STEP_PIN, M5_DIR_PIN, M5_ENABLE_PIN, M5_CS_PIN},
{M6_STEP_PIN, M6_DIR_PIN, M6_ENABLE_PIN, M6_CS_PIN},
{M7_STEP_PIN, M7_DIR_PIN, M7_ENABLE_PIN, M7_CS_PIN}};
Or this:
const STEPPERS[8][4]{{PF13, PF12, PF14, PC4},
{PG0, PG1, PF15, PD11},
{PF11, PG3, PG5, PC6},
{PG4, PC1, PA0, PC7},
{PF9, PF10, PG2, PF2},
{PC13, PF0, PF1, PE4},
{PE2, PE3, PD4, PE1},
{PE6, PA14, PE0, PD3}};
In Marlin this header file defines the pins, but some are integers, and some are strings : "Marlin-bugfix-2.1.x\buildroot\share\PlatformIO\variants\MARLIN_H723Zx*variant_MARLIN_STM32H723ZX.h*"
Like Such:
#define PE13 75
#define PE14 76
#define PE15 77
#define PF0 78
#define PF1 79
#define PF2 80
#define PF3 PIN_A14
#define PF4 PIN_A15
#define PF5 PIN_A16
#define PF6 PIN_A17
#define PF7 PIN_A18
#define PF8 PIN_A19
#define PF9 PIN_A20
#define PF10 PIN_A21
#define PF11 PIN_A22
#define PF12 PIN_A23
#define PF13 PIN_A24
#define PF14 PIN_A25
I am not really sure how to initialize a multi-dimentional array when the data being stored varies.
If you are not sure, but want to also use the BTT Octopus for something other than a 3D Printer, then you might want to check out this thread on the PlatformIO Forum:
Thank you,
Jason