testing

Dependencies:   mbed tinyshell X_NUCLEO_IHM02A1

Revision:
27:2abcf13d90a3
Parent:
26:caec5f51abe8
Child:
28:19b25daa7777
--- a/main.cpp	Mon Mar 13 17:53:12 2017 +0000
+++ b/main.cpp	Wed Mar 31 22:28:53 2021 +0000
@@ -51,12 +51,29 @@
 
 /* Definitions ---------------------------------------------------------------*/
 
+/* Motor specs */
+#define MOTOR_SUPPLY_VOLTAGE_V      12.0
+#define STEPS_PER_REV               200.0
+#define MAX_PHASE_CURRENT_A         0.67
+#define PHASE_RES_OHMS              12.0
+#define MOTOR_INITIAL_SPEED_SPS     1000.0
+#define MOTOR_ACCEL_SPS2            200.0
+#define MOTOR_MAX_SPEED_SPS         2000.0
+#define FULL_STEP_TH_SPS            602.7
+#define DUMMY_KVAL_V                3.06
+#define BEMF_ICPT_SPS               61.52
+#define START_SLOPE                 392.1569e-6
+#define FINAL_SLOPE                 643.1372e-6
+#define OCD_TH_MA                   600.0
+#define STALL_TH_MA                 1000.0
+
 /* Number of movements per revolution. */
 #define MPR_1 4
 
 /* Number of steps. */
-#define STEPS_1 (400 * 128)   /* 1 revolution given a 400 steps motor configured at 1/128 microstep mode. */
+#define STEPS_1 (20000 * 1)   /* 1 revolution given a 200 step motor and 100:1 gearbox, with full stepping */
 #define STEPS_2 (STEPS_1 * 2)
+#define SPEED_SPS 10000 // steps per second
 
 /* Delay in milliseconds. */
 #define DELAY_1 1000
@@ -73,58 +90,58 @@
 L6470_init_t init[L6470DAISYCHAINSIZE] = {
     /* First Motor. */
     {
-        9.0,                           /* Motor supply voltage in V. */
-        400,                           /* Min number of steps per revolution for the motor. */
-        1.7,                           /* Max motor phase voltage in A. */
-        3.06,                          /* Max motor phase voltage in V. */
-        300.0,                         /* Motor initial speed [step/s]. */
-        500.0,                         /* Motor acceleration [step/s^2] (comment for infinite acceleration mode). */
-        500.0,                         /* Motor deceleration [step/s^2] (comment for infinite deceleration mode). */
-        992.0,                         /* Motor maximum speed [step/s]. */
-        0.0,                           /* Motor minimum speed [step/s]. */
-        602.7,                         /* Motor full-step speed threshold [step/s]. */
-        3.06,                          /* Holding kval [V]. */
-        3.06,                          /* Constant speed kval [V]. */
-        3.06,                          /* Acceleration starting kval [V]. */
-        3.06,                          /* Deceleration starting kval [V]. */
-        61.52,                         /* Intersect speed for bemf compensation curve slope changing [step/s]. */
-        392.1569e-6,                   /* Start slope [s/step]. */
-        643.1372e-6,                   /* Acceleration final slope [s/step]. */
-        643.1372e-6,                   /* Deceleration final slope [s/step]. */
-        0,                             /* Thermal compensation factor (range [0, 15]). */
-        3.06 * 1000 * 1.10,            /* Ocd threshold [ma] (range [375 ma, 6000 ma]). */
-        3.06 * 1000 * 1.00,            /* Stall threshold [ma] (range [31.25 ma, 4000 ma]). */
-        StepperMotor::STEP_MODE_1_128, /* Step mode selection. */
-        0xFF,                          /* Alarm conditions enable. */
-        0x2E88                         /* Ic configuration. */
+        MOTOR_SUPPLY_VOLTAGE_V,                  /* Motor supply voltage in V. */
+        STEPS_PER_REV,                           /* Min number of steps per revolution for the motor. */
+        MAX_PHASE_CURRENT_A,                     /* Max motor phase voltage in A. */
+        MAX_PHASE_CURRENT_A * PHASE_RES_OHMS,    /* Max motor phase voltage in V. (12 ohms per phase) */
+        MOTOR_INITIAL_SPEED_SPS,                 /* Motor initial speed [step/s]. */
+        MOTOR_ACCEL_SPS2,                        /* Motor acceleration [step/s^2] (comment for infinite acceleration mode). */
+        MOTOR_ACCEL_SPS2,                        /* Motor deceleration [step/s^2] (comment for infinite deceleration mode). */
+        MOTOR_MAX_SPEED_SPS,                     /* Motor maximum speed [step/s]. */
+        0.0,                                     /* Motor minimum speed [step/s]. */
+        FULL_STEP_TH_SPS,                        /* Motor full-step speed threshold [step/s]. */
+        DUMMY_KVAL_V,                            /* Holding kval [V]. */
+        DUMMY_KVAL_V,                            /* Constant speed kval [V]. */
+        DUMMY_KVAL_V,                            /* Acceleration starting kval [V]. */
+        DUMMY_KVAL_V,                            /* Deceleration starting kval [V]. */
+        BEMF_ICPT_SPS,                           /* Intersect speed for bemf compensation curve slope changing [step/s]. */
+        START_SLOPE,                             /* Start slope [s/step]. */
+        FINAL_SLOPE,                             /* Acceleration final slope [s/step]. */
+        FINAL_SLOPE,                             /* Deceleration final slope [s/step]. */
+        0,                                       /* Thermal compensation factor (range [0, 15]). */
+        OCD_TH_MA,                               /* Ocd threshold [ma] (range [375 ma, 6000 ma]). */
+        STALL_TH_MA,                             /* Stall threshold [ma] (range [31.25 ma, 4000 ma]). */
+        StepperMotor::STEP_MODE_FULL,            /* Step mode selection. */
+        0xFF,                                    /* Alarm conditions enable. */
+        0x2E88                                   /* Ic configuration. */
     },
 
     /* Second Motor. */
     {
-        9.0,                           /* Motor supply voltage in V. */
-        400,                           /* Min number of steps per revolution for the motor. */
-        1.7,                           /* Max motor phase voltage in A. */
-        3.06,                          /* Max motor phase voltage in V. */
-        300.0,                         /* Motor initial speed [step/s]. */
-        500.0,                         /* Motor acceleration [step/s^2] (comment for infinite acceleration mode). */
-        500.0,                         /* Motor deceleration [step/s^2] (comment for infinite deceleration mode). */
-        992.0,                         /* Motor maximum speed [step/s]. */
-        0.0,                           /* Motor minimum speed [step/s]. */
-        602.7,                         /* Motor full-step speed threshold [step/s]. */
-        3.06,                          /* Holding kval [V]. */
-        3.06,                          /* Constant speed kval [V]. */
-        3.06,                          /* Acceleration starting kval [V]. */
-        3.06,                          /* Deceleration starting kval [V]. */
-        61.52,                         /* Intersect speed for bemf compensation curve slope changing [step/s]. */
-        392.1569e-6,                   /* Start slope [s/step]. */
-        643.1372e-6,                   /* Acceleration final slope [s/step]. */
-        643.1372e-6,                   /* Deceleration final slope [s/step]. */
-        0,                             /* Thermal compensation factor (range [0, 15]). */
-        3.06 * 1000 * 1.10,            /* Ocd threshold [ma] (range [375 ma, 6000 ma]). */
-        3.06 * 1000 * 1.00,            /* Stall threshold [ma] (range [31.25 ma, 4000 ma]). */
-        StepperMotor::STEP_MODE_1_128, /* Step mode selection. */
-        0xFF,                          /* Alarm conditions enable. */
-        0x2E88                         /* Ic configuration. */
+        MOTOR_SUPPLY_VOLTAGE_V,                  /* Motor supply voltage in V. */
+        STEPS_PER_REV,                           /* Min number of steps per revolution for the motor. */
+        MAX_PHASE_CURRENT_A,                     /* Max motor phase voltage in A. */
+        MAX_PHASE_CURRENT_A * PHASE_RES_OHMS,    /* Max motor phase voltage in V. (12 ohms per phase) */
+        MOTOR_INITIAL_SPEED_SPS,                 /* Motor initial speed [step/s]. */
+        MOTOR_ACCEL_SPS2,                        /* Motor acceleration [step/s^2] (comment for infinite acceleration mode). */
+        MOTOR_ACCEL_SPS2,                        /* Motor deceleration [step/s^2] (comment for infinite deceleration mode). */
+        MOTOR_MAX_SPEED_SPS,                     /* Motor maximum speed [step/s]. */
+        0.0,                                     /* Motor minimum speed [step/s]. */
+        FULL_STEP_TH_SPS,                        /* Motor full-step speed threshold [step/s]. */
+        DUMMY_KVAL_V,                            /* Holding kval [V]. */
+        DUMMY_KVAL_V,                            /* Constant speed kval [V]. */
+        DUMMY_KVAL_V,                            /* Acceleration starting kval [V]. */
+        DUMMY_KVAL_V,                            /* Deceleration starting kval [V]. */
+        BEMF_ICPT_SPS,                           /* Intersect speed for bemf compensation curve slope changing [step/s]. */
+        START_SLOPE,                             /* Start slope [s/step]. */
+        FINAL_SLOPE,                             /* Acceleration final slope [s/step]. */
+        FINAL_SLOPE,                             /* Deceleration final slope [s/step]. */
+        0,                                       /* Thermal compensation factor (range [0, 15]). */
+        OCD_TH_MA,                               /* Ocd threshold [ma] (range [375 ma, 6000 ma]). */
+        STALL_TH_MA,                             /* Stall threshold [ma] (range [31.25 ma, 4000 ma]). */
+        StepperMotor::STEP_MODE_FULL,            /* Step mode selection. */
+        0xFF,                                    /* Alarm conditions enable. */
+        0x2E88                                   /* Ic configuration. */
     }
 };
 
@@ -153,282 +170,292 @@
 
 
     /*----- Setting home and marke positions, getting positions, and going to positions. -----*/
-
-    /* Printing to the console. */
-    printf("--> Setting home position.\r\n");
-
-    /* Setting the home position. */
-    motors[0]->set_home();
-
-    /* Waiting. */
-    wait_ms(DELAY_1);
-
-    /* Getting the current position. */
-    int position = motors[0]->get_position();
-
-    /* Printing to the console. */
-    printf("--> Getting the current position: %d\r\n", position);
-
-    /* Waiting. */
-    wait_ms(DELAY_1);
-
-    /* Printing to the console. */
-    printf("--> Moving forward %d steps.\r\n", STEPS_1);
-
-    /* Moving. */
-    motors[0]->move(StepperMotor::FWD, STEPS_1);
-
-    /* Waiting while active. */
-    motors[0]->wait_while_active();
-
-    /* Getting the current position. */
-    position = motors[0]->get_position();
-    
-    /* Printing to the console. */
-    printf("--> Getting the current position: %d\r\n", position);
-
-    /* Printing to the console. */
-    printf("--> Marking the current position.\r\n");
-
-    /* Marking the current position. */
-    motors[0]->set_mark();
-
-    /* Waiting. */
-    wait_ms(DELAY_1);
-
-    /* Printing to the console. */
-    printf("--> Moving backward %d steps.\r\n", STEPS_2);
-
-    /* Moving. */
-    motors[0]->move(StepperMotor::BWD, STEPS_2);
-
-    /* Waiting while active. */
-    motors[0]->wait_while_active();
-
-    /* Waiting. */
-    wait_ms(DELAY_1);
-
-    /* Getting the current position. */
-    position = motors[0]->get_position();
-    
-    /* Printing to the console. */
-    printf("--> Getting the current position: %d\r\n", position);
-
-    /* Waiting. */
-    wait_ms(DELAY_1);
-
-    /* Printing to the console. */
-    printf("--> Going to marked position.\r\n");
-
-    /* Going to marked position. */
-    motors[0]->go_mark();
-    
-    /* Waiting while active. */
-    motors[0]->wait_while_active();
-
-    /* Waiting. */
-    wait_ms(DELAY_1);
-
-    /* Getting the current position. */
-    position = motors[0]->get_position();
-    
-    /* Printing to the console. */
-    printf("--> Getting the current position: %d\r\n", position);
-
-    /* Waiting. */
-    wait_ms(DELAY_1);
-
-    /* Printing to the console. */
-    printf("--> Going to home position.\r\n");
-
-    /* Going to home position. */
-    motors[0]->go_home();
-    
-    /* Waiting while active. */
-    motors[0]->wait_while_active();
-
-    /* Waiting. */
-    wait_ms(DELAY_1);
-
-    /* Getting the current position. */
-    position = motors[0]->get_position();
-    
-    /* Printing to the console. */
-    printf("--> Getting the current position: %d\r\n", position);
-
-    /* Waiting. */
-    wait_ms(DELAY_1);
-
-    /* Printing to the console. */
-    printf("--> Halving the microsteps.\r\n");
-
-    /* Halving the microsteps. */
-    init[0].step_sel = (init[0].step_sel > 0 ? init[0].step_sel -  1 : init[0].step_sel);
-    if (!motors[0]->set_step_mode((StepperMotor::step_mode_t) init[0].step_sel)) {
-        printf("    Step Mode not allowed.\r\n");
-    }
-
-    /* Waiting. */
-    wait_ms(DELAY_1);
-
-    /* Printing to the console. */
-    printf("--> Setting home position.\r\n");
-
-    /* Setting the home position. */
-    motors[0]->set_home();
-
-    /* Waiting. */
-    wait_ms(DELAY_1);
-
-    /* Getting the current position. */
-    position = motors[0]->get_position();
-    
-    /* Printing to the console. */
-    printf("--> Getting the current position: %d\r\n", position);
-
-    /* Waiting. */
-    wait_ms(DELAY_1);
-
-    /* Printing to the console. */
-    printf("--> Moving forward %d steps.\r\n", STEPS_1);
-
-    /* Moving. */
-    motors[0]->move(StepperMotor::FWD, STEPS_1);
-
-    /* Waiting while active. */
-    motors[0]->wait_while_active();
-
-    /* Getting the current position. */
-    position = motors[0]->get_position();
-    
-    /* Printing to the console. */
-    printf("--> Getting the current position: %d\r\n", position);
-
-    /* Printing to the console. */
-    printf("--> Marking the current position.\r\n");
-
-    /* Marking the current position. */
-    motors[0]->set_mark();
-
-    /* Waiting. */
-    wait_ms(DELAY_2);
-
-
-    /*----- Running together for a certain amount of time. -----*/
-
-    /* Printing to the console. */
-    printf("--> Running together for %d seconds.\r\n", DELAY_3 / 1000);
-
-    /* Preparing each motor to perform a run at a specified speed. */
     for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
-        motors[m]->prepare_run(StepperMotor::BWD, 400);
+        motors[m]->prepare_run(StepperMotor::BWD, SPEED_SPS);
     }
 
     /* Performing the action on each motor at the same time. */
     x_nucleo_ihm02a1->perform_prepared_actions();
-
-    /* Waiting. */
-    wait_ms(DELAY_3);
-
-
-    /*----- Increasing the speed while running. -----*/
-
-    /* Preparing each motor to perform a run at a specified speed. */
-    for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
-        motors[m]->prepare_get_speed();
-    }
-
-    /* Performing the action on each motor at the same time. */
-    uint32_t* results = x_nucleo_ihm02a1->perform_prepared_actions();
-
-    /* Printing to the console. */
-    printf("    Speed: M1 %d, M2 %d.\r\n", results[0], results[1]);
-
-    /* Printing to the console. */
-    printf("--> Doublig the speed while running again for %d seconds.\r\n", DELAY_3 / 1000);
-
-    /* Preparing each motor to perform a run at a specified speed. */
-    for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
-        motors[m]->prepare_run(StepperMotor::BWD, results[m] << 1);
-    }
-
-    /* Performing the action on each motor at the same time. */
-    results = x_nucleo_ihm02a1->perform_prepared_actions();
-
-    /* Waiting. */
-    wait_ms(DELAY_3);
-
-    /* Preparing each motor to perform a run at a specified speed. */
-    for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
-        motors[m]->prepare_get_speed();
-    }
-
-    /* Performing the action on each motor at the same time. */
-    results = x_nucleo_ihm02a1->perform_prepared_actions();
-
-    /* Printing to the console. */
-    printf("    Speed: M1 %d, M2 %d.\r\n", results[0], results[1]);
-
-    /* Waiting. */
-    wait_ms(DELAY_1);
+    
+    printf("Running.\r\n");
+}
 
 
-    /*----- Hard Stop. -----*/
-
-    /* Printing to the console. */
-    printf("--> Hard Stop.\r\n");
-
-    /* Preparing each motor to perform a hard stop. */
-    for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
-        motors[m]->prepare_hard_stop();
-    }
-
-    /* Performing the action on each motor at the same time. */
-    x_nucleo_ihm02a1->perform_prepared_actions();
+//    /* Printing to the console. */
+//    printf("--> Setting home position.\r\n");
+//
+//    /* Setting the home position. */
+//    motors[0]->set_home();
 
-    /* Waiting. */
-    wait_ms(DELAY_2);
-
-
-    /*----- Doing a full revolution on each motor, one after the other. -----*/
-
-    /* Printing to the console. */
-    printf("--> Doing a full revolution on each motor, one after the other.\r\n");
-
-    /* Doing a full revolution on each motor, one after the other. */
-    for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
-        for (int i = 0; i < MPR_1; i++) {
-            /* Computing the number of steps. */
-            int steps = (int) (((int) init[m].fullstepsperrevolution * pow(2.0f, init[m].step_sel)) / MPR_1);
+//    /* Waiting. */
+//    wait_ms(DELAY_1);
+//
+//    /* Getting the current position. */
+//    int position = motors[0]->get_position();
+//
+//    /* Printing to the console. */
+//    printf("--> Getting the current position: %d\r\n", position);
 
-            /* Moving. */
-            motors[m]->move(StepperMotor::FWD, steps);
-            
-            /* Waiting while active. */
-            motors[m]->wait_while_active();
-
-            /* Waiting. */
-            wait_ms(DELAY_1);
-        }
-    }
-
-    /* Waiting. */
-    wait_ms(DELAY_2);
-
-
-    /*----- High Impedance State. -----*/
-
-    /* Printing to the console. */
-    printf("--> High Impedance State.\r\n");
-
-    /* Preparing each motor to set High Impedance State. */
-    for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
-        motors[m]->prepare_hard_hiz();
-    }
-
-    /* Performing the action on each motor at the same time. */
-    x_nucleo_ihm02a1->perform_prepared_actions();
-
-    /* Waiting. */
-    wait_ms(DELAY_2);
-}
+//    /* Waiting. */
+//    wait_ms(DELAY_1);
+//
+//    /* Printing to the console. */
+//    printf("--> Moving forward %d steps.\r\n", STEPS_1);
+//
+//    /* Moving. */
+//    motors[0]->move(StepperMotor::FWD, STEPS_1);
+//
+//    /* Waiting while active. */
+//    motors[0]->wait_while_active();
+//
+//    /* Getting the current position. */
+//    position = motors[0]->get_position();
+//    
+//    /* Printing to the console. */
+//    printf("--> Getting the current position: %d\r\n", position);
+//
+//    /* Printing to the console. */
+//    printf("--> Marking the current position.\r\n");
+//
+//    /* Marking the current position. */
+//    motors[0]->set_mark();
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_1);
+//
+//    /* Printing to the console. */
+//    printf("--> Moving backward %d steps.\r\n", STEPS_2);
+//
+//    /* Moving. */
+//    motors[0]->move(StepperMotor::BWD, STEPS_2);
+//
+//    /* Waiting while active. */
+//    motors[0]->wait_while_active();
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_1);
+//
+//    /* Getting the current position. */
+//    position = motors[0]->get_position();
+//    
+//    /* Printing to the console. */
+//    printf("--> Getting the current position: %d\r\n", position);
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_1);
+//
+//    /* Printing to the console. */
+//    printf("--> Going to marked position.\r\n");
+//
+//    /* Going to marked position. */
+//    motors[0]->go_mark();
+//    
+//    /* Waiting while active. */
+//    motors[0]->wait_while_active();
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_1);
+//
+//    /* Getting the current position. */
+//    position = motors[0]->get_position();
+//    
+//    /* Printing to the console. */
+//    printf("--> Getting the current position: %d\r\n", position);
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_1);
+//
+//    /* Printing to the console. */
+//    printf("--> Going to home position.\r\n");
+//
+//    /* Going to home position. */
+//    motors[0]->go_home();
+//    
+//    /* Waiting while active. */
+//    motors[0]->wait_while_active();
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_1);
+//
+//    /* Getting the current position. */
+//    position = motors[0]->get_position();
+//    
+//    /* Printing to the console. */
+//    printf("--> Getting the current position: %d\r\n", position);
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_1);
+//
+//    /* Printing to the console. */
+//    printf("--> Halving the microsteps.\r\n");
+//
+//    /* Halving the microsteps. */
+//    init[0].step_sel = (init[0].step_sel > 0 ? init[0].step_sel -  1 : init[0].step_sel);
+//    if (!motors[0]->set_step_mode((StepperMotor::step_mode_t) init[0].step_sel)) {
+//        printf("    Step Mode not allowed.\r\n");
+//    }
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_1);
+//
+//    /* Printing to the console. */
+//    printf("--> Setting home position.\r\n");
+//
+//    /* Setting the home position. */
+//    motors[0]->set_home();
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_1);
+//
+//    /* Getting the current position. */
+//    position = motors[0]->get_position();
+//    
+//    /* Printing to the console. */
+//    printf("--> Getting the current position: %d\r\n", position);
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_1);
+//
+//    /* Printing to the console. */
+//    printf("--> Moving forward %d steps.\r\n", STEPS_1);
+//
+//    /* Moving. */
+//    motors[0]->move(StepperMotor::FWD, STEPS_1);
+//
+//    /* Waiting while active. */
+//    motors[0]->wait_while_active();
+//
+//    /* Getting the current position. */
+//    position = motors[0]->get_position();
+//    
+//    /* Printing to the console. */
+//    printf("--> Getting the current position: %d\r\n", position);
+//
+//    /* Printing to the console. */
+//    printf("--> Marking the current position.\r\n");
+//
+//    /* Marking the current position. */
+//    motors[0]->set_mark();
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_2);
+//
+//
+//    /*----- Running together for a certain amount of time. -----*/
+//
+//    /* Printing to the console. */
+//    printf("--> Running together for %d seconds.\r\n", DELAY_3 / 1000);
+//
+//    /* Preparing each motor to perform a run at a specified speed. */
+//    for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
+//        motors[m]->prepare_run(StepperMotor::BWD, 400);
+//    }
+//
+//    /* Performing the action on each motor at the same time. */
+//    x_nucleo_ihm02a1->perform_prepared_actions();
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_3);
+//
+//
+//    /*----- Increasing the speed while running. -----*/
+//
+//    /* Preparing each motor to perform a run at a specified speed. */
+//    for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
+//        motors[m]->prepare_get_speed();
+//    }
+//
+//    /* Performing the action on each motor at the same time. */
+//    uint32_t* results = x_nucleo_ihm02a1->perform_prepared_actions();
+//
+//    /* Printing to the console. */
+//    printf("    Speed: M1 %d, M2 %d.\r\n", results[0], results[1]);
+//
+//    /* Printing to the console. */
+//    printf("--> Doublig the speed while running again for %d seconds.\r\n", DELAY_3 / 1000);
+//
+//    /* Preparing each motor to perform a run at a specified speed. */
+//    for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
+//        motors[m]->prepare_run(StepperMotor::BWD, results[m] << 1);
+//    }
+//
+//    /* Performing the action on each motor at the same time. */
+//    results = x_nucleo_ihm02a1->perform_prepared_actions();
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_3);
+//
+//    /* Preparing each motor to perform a run at a specified speed. */
+//    for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
+//        motors[m]->prepare_get_speed();
+//    }
+//
+//    /* Performing the action on each motor at the same time. */
+//    results = x_nucleo_ihm02a1->perform_prepared_actions();
+//
+//    /* Printing to the console. */
+//    printf("    Speed: M1 %d, M2 %d.\r\n", results[0], results[1]);
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_1);
+//
+//
+//    /*----- Hard Stop. -----*/
+//
+//    /* Printing to the console. */
+//    printf("--> Hard Stop.\r\n");
+//
+//    /* Preparing each motor to perform a hard stop. */
+//    for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
+//        motors[m]->prepare_hard_stop();
+//    }
+//
+//    /* Performing the action on each motor at the same time. */
+//    x_nucleo_ihm02a1->perform_prepared_actions();
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_2);
+//
+//
+//    /*----- Doing a full revolution on each motor, one after the other. -----*/
+//
+//    /* Printing to the console. */
+//    printf("--> Doing a full revolution on each motor, one after the other.\r\n");
+//
+//    /* Doing a full revolution on each motor, one after the other. */
+//    for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
+//        for (int i = 0; i < MPR_1; i++) {
+//            /* Computing the number of steps. */
+//            int steps = (int) (((int) init[m].fullstepsperrevolution * pow(2.0f, init[m].step_sel)) / MPR_1);
+//
+//            /* Moving. */
+//            motors[m]->move(StepperMotor::FWD, steps);
+//            
+//            /* Waiting while active. */
+//            motors[m]->wait_while_active();
+//
+//            /* Waiting. */
+//            wait_ms(DELAY_1);
+//        }
+//    }
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_2);
+//
+//
+//    /*----- High Impedance State. -----*/
+//
+//    /* Printing to the console. */
+//    printf("--> High Impedance State.\r\n");
+//
+//    /* Preparing each motor to set High Impedance State. */
+//    for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
+//        motors[m]->prepare_hard_hiz();
+//    }
+//
+//    /* Performing the action on each motor at the same time. */
+//    x_nucleo_ihm02a1->perform_prepared_actions();
+//
+//    /* Waiting. */
+//    wait_ms(DELAY_2);
+//}