    char id[4]; // "fil" for identification
    int16_t size;   // size of the whole file, including this header
    byte flags;
-#define FILE_TABBY 0x01  // use Tabby 1/2 between each treadle step
+#define FILE_TABBY 0x01         // use Tabby 1/2 between each treadle step
+#define FILE_INVERT_TIEUPS 0x02 // invert the top and bottom of the fabric
    byte unused;
    byte checksum;
    char filename[MAX_FILENAME + 1]; // null-terminated string

         return steps; } } }

void do_calibration(void) {  // calibrate the center, bottom, and top positions of all shafts in use
   int shaft;
   for (shaft = 0; shaft < NUM_SHAFTS; ++shaft) {  // initialize all shafts as centered and nominal
      shaft_status[shaft].shaft_position = SHAFT_CENTER;
      shaft_status[shaft].steps_to_down = shaft_status[shaft].steps_to_up = NOMINAL_STEPS;
      shaft_status[shaft].steps_to_move = 0; }
   for (shaft = 0; shaft < NUM_SHAFTS; ++shaft) {  // now ask to recalibrate
      if (using_shaft(shaft)) {                    //  the shaft is in use for this pattern
         if (get_calibration(shaft, "center", true) != 999) { // calibrating this shaft
            shaft_status[shaft].steps_to_down = -get_calibration(shaft, "down", false);
            shaft_status[shaft].steps_to_move = shaft_status[shaft].steps_to_down; // return it to the center
            do_steps();  // (it will be the only motor to move)
            shaft_status[shaft].steps_to_up = get_calibration(shaft, "up", false);
            shaft_status[shaft].steps_to_move = -shaft_status[shaft].steps_to_up; // return it to the center
            do_steps(); // (it will be the only motor to move)
         } } }
   write_config(); // write the shaft calibration data
   info_message("calibration saved", 0); }

void center_all_shafts(void) {
   for (int shaft = 0; shaft < NUM_SHAFTS; ++shaft) {


   See https://github.com/LenShustek/loom for more information about this project.

   When you install a DRV8825 stepper motor driver, adjust the pot on the board so that
   there is 0.75V at the body of the pot, which is for 1.5A drive current to the motor.
   The motor doesn't have to be on when you that.

   ------------------------------------------------------------------------------------------------------
   Copyright (c) 2017, Len Shustek

