Browse Source

removed unused folders

cleaning atm_lien management, should appear as submodule
titi 5 years ago
parent
commit
b625bd0cce
76 changed files with 47593 additions and 11448 deletions
  1. 50 0
      .gitignore
  2. 0 605
      HTequi-firmware/lib/Atm_lien/Atm_AccelStepper.cpp
  3. 0 201
      HTequi-firmware/lib/Atm_lien/Atm_AccelStepper.h
  4. 0 416
      HTequi-firmware/lib/Atm_lien/Atm_Teenstep.cpp
  5. 0 161
      HTequi-firmware/lib/Atm_lien/Atm_Teenstep.h
  6. 0 40
      HTequi-firmware/lib/Atm_lien/Atm_Teenstep_OSC.cpp
  7. 0 35
      HTequi-firmware/lib/Atm_lien/Atm_Teenstep_OSC.h
  8. 0 263
      HTequi-firmware/lib/Atm_lien/Atm_out.cpp
  9. 0 71
      HTequi-firmware/lib/Atm_lien/Atm_out.h
  10. 0 21
      HTequi-firmware/lib/Atm_lien/examples/Atm_AccelStepper/Atm_AccelStepper.ino
  11. 0 134
      HTequi-firmware/lib/Atm_stepper.cpp
  12. 0 68
      HTequi-firmware/lib/Atm_stepper.h
  13. 0 17
      HTequi-firmware/lib/TeensyStep-2.0.0/.gitattributes
  14. 0 54
      HTequi-firmware/lib/TeensyStep-2.0.0/.gitignore
  15. 0 21
      HTequi-firmware/lib/TeensyStep-2.0.0/LICENCE
  16. 0 28
      HTequi-firmware/lib/TeensyStep-2.0.0/README.md
  17. 0 77
      HTequi-firmware/lib/TeensyStep-2.0.0/examples/Applications/Winder/Winder.cpp
  18. 0 34
      HTequi-firmware/lib/TeensyStep-2.0.0/examples/Applications/Winder/Winder.h
  19. 0 77
      HTequi-firmware/lib/TeensyStep-2.0.0/examples/Applications/Winder/Winder.ino
  20. 0 1
      HTequi-firmware/lib/TeensyStep-2.0.0/examples/Applications/Winder/readme.md
  21. 0 33
      HTequi-firmware/lib/TeensyStep-2.0.0/examples/HelloStepper/HelloStepper.ino
  22. 0 147
      HTequi-firmware/lib/TeensyStep-2.0.0/examples/Interfacing/Interfacing.ino
  23. 0 75
      HTequi-firmware/lib/TeensyStep-2.0.0/examples/MultipleSteppers/MultipleSteppers.ino
  24. 0 97
      HTequi-firmware/lib/TeensyStep-2.0.0/examples/Path_Following/RoseFunctionFollower/RoseFunctionFollower.ino
  25. 0 37
      HTequi-firmware/lib/TeensyStep-2.0.0/examples/StepperArray/StepperArray.ino
  26. 0 3
      HTequi-firmware/lib/TeensyStep-2.0.0/examples/StepperArray/readme.md
  27. 0 19
      HTequi-firmware/lib/TeensyStep-2.0.0/keywords.txt
  28. 0 21
      HTequi-firmware/lib/TeensyStep-2.0.0/library.json
  29. 0 10
      HTequi-firmware/lib/TeensyStep-2.0.0/library.properties
  30. BIN
      HTequi-firmware/lib/TeensyStep-2.0.0/media/indMove.png
  31. BIN
      HTequi-firmware/lib/TeensyStep-2.0.0/media/load_calculation.PNG
  32. BIN
      HTequi-firmware/lib/TeensyStep-2.0.0/media/load_calculation.xlsx
  33. BIN
      HTequi-firmware/lib/TeensyStep-2.0.0/media/seqMove.png
  34. BIN
      HTequi-firmware/lib/TeensyStep-2.0.0/media/stepperArray.png
  35. BIN
      HTequi-firmware/lib/TeensyStep-2.0.0/media/sycMove.png
  36. 0 148
      HTequi-firmware/lib/TeensyStep-2.0.0/src/MotorControlBase.h
  37. 0 152
      HTequi-firmware/lib/TeensyStep-2.0.0/src/RotateControlBase.h
  38. 0 143
      HTequi-firmware/lib/TeensyStep-2.0.0/src/StepControlBase.h
  39. 0 81
      HTequi-firmware/lib/TeensyStep-2.0.0/src/Stepper.cpp
  40. 0 89
      HTequi-firmware/lib/TeensyStep-2.0.0/src/Stepper.h
  41. 0 59
      HTequi-firmware/lib/TeensyStep-2.0.0/src/TeensyStep.h
  42. 0 90
      HTequi-firmware/lib/TeensyStep-2.0.0/src/accelerators/LinRotAccelerator.h
  43. 0 85
      HTequi-firmware/lib/TeensyStep-2.0.0/src/accelerators/LinStepAccelerator.h
  44. 0 81
      HTequi-firmware/lib/TeensyStep-2.0.0/src/accelerators/SinRotAccelerator.h
  45. 0 8
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/TF_Handler.h
  46. 0 22
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/TimerFieldBase.h
  47. 0 9
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/generic/TickTimer.cpp
  48. 0 159
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/generic/TickTimer.h
  49. 0 67
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/generic/TimerField.h
  50. 0 61
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy3/PIT.cpp
  51. 0 36
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy3/PIT.h
  52. 0 114
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy3/TeensyStepFTM.cpp
  53. 0 35
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy3/TeensyStepFTM.h
  54. 0 184
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy3/TimerField2.h
  55. 0 172
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy3/config.h
  56. 0 62
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy4/PIT.cppc
  57. 0 32
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy4/PIT.hc
  58. 0 109
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy4/TeensyStepFTM.cppbak
  59. 0 35
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy4/TeensyStepFTM.hh
  60. 0 158
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy4/TimerField.h
  61. 0 172
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy4/config.h
  62. 0 98
      HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy4/ticktimer.h
  63. 24 12
      HTequi-firmware/src/blobcnc_low/main.cpp
  64. 23 15
      HTequi-firmware/src/blobcnc_top/main.cpp
  65. 3536 591
      blob-CN/HTEQUI.noisette
  66. 3536 591
      blob-CN/HTEQUI_autosave/HTEQUI_autosave_0.noisette
  67. 3790 547
      blob-CN/HTEQUI_autosave/HTEQUI_autosave_1.noisette
  68. 3687 581
      blob-CN/HTEQUI_autosave/HTEQUI_autosave_2.noisette
  69. 3568 581
      blob-CN/HTEQUI_autosave/HTEQUI_autosave_3.noisette
  70. 3570 595
      blob-CN/HTEQUI_autosave/HTEQUI_autosave_4.noisette
  71. 3945 561
      blob-CN/HTEQUI_autosave/HTEQUI_autosave_5.noisette
  72. 3884 536
      blob-CN/HTEQUI_autosave/HTEQUI_autosave_6.noisette
  73. 3917 533
      blob-CN/HTEQUI_autosave/HTEQUI_autosave_7.noisette
  74. 3876 539
      blob-CN/HTEQUI_autosave/HTEQUI_autosave_8.noisette
  75. 3876 539
      blob-CN/HTEQUI_autosave/HTEQUI_autosave_9.noisette
  76. 6311 0
      blob-CN/HTEQUI_backup.noisette

+ 50 - 0
.gitignore

@@ -0,0 +1,50 @@
+*.png
+/HTequi-firmware/lib/Atm_lien/Atm_Teenstep.cpp
+no
+/HTequi-firmware/lib/Atm_lien/Atm_Teenstep.h.no
+/HTequi-firmware/lib/TeensyStep/.gitattributes
+/HTequi-firmware/lib/TeensyStep/.gitignore
+/HTequi-firmware/lib/TeensyStep/LICENCE
+/HTequi-firmware/lib/TeensyStep/README.md
+/HTequi-firmware/lib/TeensyStep/examples/Applications/Winder/Winder.cpp
+/HTequi-firmware/lib/TeensyStep/examples/Applications/Winder/Winder.h
+/HTequi-firmware/lib/TeensyStep/examples/Applications/Winder/Winder.ino
+/HTequi-firmware/lib/TeensyStep/examples/Applications/Winder/readme.md
+/HTequi-firmware/lib/TeensyStep/examples/HelloStepper/HelloStepper.ino
+/HTequi-firmware/lib/TeensyStep/examples/Interfacing/Interfacing.ino
+/HTequi-firmware/lib/TeensyStep/examples/MultipleSteppers/MultipleSteppers.ino
+/HTequi-firmware/lib/TeensyStep/examples/Path_Following/RoseFunctionFollower/RoseFunctionFollower.ino
+/HTequi-firmware/lib/TeensyStep/examples/StepperArray/StepperArray.ino
+/HTequi-firmware/lib/TeensyStep/examples/StepperArray/readme.md
+/HTequi-firmware/lib/TeensyStep/keywords.txt
+/HTequi-firmware/lib/TeensyStep/library.json
+/HTequi-firmware/lib/TeensyStep/library.properties
+/HTequi-firmware/lib/TeensyStep/media/load_calculation.PNG
+/HTequi-firmware/lib/TeensyStep/media/load_calculation.xlsx
+/HTequi-firmware/lib/TeensyStep/src/MotorControlBase.h
+/HTequi-firmware/lib/TeensyStep/src/RotateControlBase.h
+/HTequi-firmware/lib/TeensyStep/src/StepControlBase.h
+/HTequi-firmware/lib/TeensyStep/src/Stepper.cpp
+/HTequi-firmware/lib/TeensyStep/src/Stepper.h
+/HTequi-firmware/lib/TeensyStep/src/TeensyStep.h
+/HTequi-firmware/lib/TeensyStep/src/accelerators/LinRotAccelerator.h
+/HTequi-firmware/lib/TeensyStep/src/accelerators/LinStepAccelerator.h
+/HTequi-firmware/lib/TeensyStep/src/accelerators/SinRotAccelerator.h
+/HTequi-firmware/lib/TeensyStep/src/timer/TF_Handler.h
+/HTequi-firmware/lib/TeensyStep/src/timer/TimerFieldBase.h
+/HTequi-firmware/lib/TeensyStep/src/timer/generic/TickTimer.cpp
+/HTequi-firmware/lib/TeensyStep/src/timer/generic/TickTimer.h
+/HTequi-firmware/lib/TeensyStep/src/timer/generic/TimerField.h
+/HTequi-firmware/lib/TeensyStep/src/timer/teensy3/PIT.cpp
+/HTequi-firmware/lib/TeensyStep/src/timer/teensy3/PIT.h
+/HTequi-firmware/lib/TeensyStep/src/timer/teensy3/TeensyStepFTM.cpp
+/HTequi-firmware/lib/TeensyStep/src/timer/teensy3/TeensyStepFTM.h
+/HTequi-firmware/lib/TeensyStep/src/timer/teensy3/TimerField2.h
+/HTequi-firmware/lib/TeensyStep/src/timer/teensy3/config.h
+/HTequi-firmware/lib/TeensyStep/src/timer/teensy4/PIT.cppc
+/HTequi-firmware/lib/TeensyStep/src/timer/teensy4/PIT.hc
+/HTequi-firmware/lib/TeensyStep/src/timer/teensy4/TeensyStepFTM.cppbak
+/HTequi-firmware/lib/TeensyStep/src/timer/teensy4/TeensyStepFTM.hh
+/HTequi-firmware/lib/TeensyStep/src/timer/teensy4/TimerField.h
+/HTequi-firmware/lib/TeensyStep/src/timer/teensy4/config.h
+/HTequi-firmware/lib/TeensyStep/src/timer/teensy4/ticktimer.h

+ 0 - 605
HTequi-firmware/lib/Atm_lien/Atm_AccelStepper.cpp

@@ -1,605 +0,0 @@
-#include "Atm_AccelStepper.h"
-
-/* Add optional parameters for the state machine to begin()
- * Add extra initialization code
- */
-
-Atm_AccelStepper& Atm_AccelStepper::begin(int step_pin, int dir_pin) {
-  // clang-format off
-  const static state_t state_table[] PROGMEM = {
-    /*                       ON_ENTER           ON_LOOP          ON_EXIT  EVT_DISABLE  EVT_ENABLE  EVT_ENABLED_TIMEOUT    EVT_MOVE  EVT_STOP  EVT_EMERGENCY_STOP  EVT_ON_LIMIT_LOW  EVT_ON_LIMIT_HIGH  EVT_ON_TARGET  EVT_HOMING_LOW  EVT_HOMING_HIGH  ELSE */
-    /*    DISABLE */     ENT_DISABLED,              -1,              -1,         -1,    ENABLED,                  -1,     RUNNING,        -1,                -1,               -1,                -1,            -1,    HOMING_LOW,     HOMING_HIGH,   -1,
-    /*     ENABLED */     ENT_ENABLED,              -1,              -1,    DISABLE,         -1,             DISABLE,     RUNNING,      STOP,              STOP,        LIMIT_LOW,        LIMIT_HIGH,            -1,    HOMING_LOW,     HOMING_HIGH,   -1,
-    /*     RUNNING */     ENT_RUNNING,      LP_RUNNING,              -1,    DISABLE,         -1,                  -1,     RUNNING,      STOP,              STOP,        LIMIT_LOW,        LIMIT_HIGH,       ENABLED,            -1,              -1,   -1,
-    /*        STOP */        ENT_STOP,         LP_STOP,              -1,    DISABLE,         -1,                  -1,     RUNNING,        -1,                -1,               -1,                -1,       ENABLED,            -1,              -1,   -1,
-    /*  HOMING_LOW */  ENT_HOMING_LOW,   LP_HOMING_LOW,  EXT_HOMING_LOW,    DISABLE,         -1,                  -1,          -1,      STOP,              STOP,        LIMIT_LOW,        LIMIT_HIGH,            -1,            -1,              -1,   -1,
-    /* HOMING_HIGH */ ENT_HOMING_HIGH,  LP_HOMING_HIGH, EXT_HOMING_HIGH,    DISABLE,         -1,                  -1,          -1,      STOP,              STOP,        LIMIT_LOW,        LIMIT_HIGH,            -1,            -1,              -1,   -1,
-    /*   LIMIT_LOW */   ENT_LIMIT_LOW,    LP_LIMIT_LOW,              -1,         -1,         -1,                  -1,     RUNNING,      STOP,              STOP,        LIMIT_LOW,                -1,            -1,            -1,              -1,   -1,
-    /*  LIMIT_HIGH */  ENT_LIMIT_HIGH,   LP_LIMIT_HIGH,              -1,         -1,         -1,                  -1,     RUNNING,      STOP,              STOP,               -1,        LIMIT_HIGH,            -1,            -1,              -1,   -1
-  };
-  // clang-format on
-  Machine::begin( state_table, ELSE );
-  stepper = new AccelStepper(1, step_pin, dir_pin);
-  stepper->setMaxSpeed(max_speed);
-  stepper->setAcceleration(acceleration);
-  idle_timer.set(ATM_TIMER_OFF);
-  position_timer.set(POSITION_SEND_TIMER);
-
-  return *this;
-}
-
-/* Add C++ code for each internally handled event (input)
- * The code must return 1 to trigger the event
- */
-
-int Atm_AccelStepper::event( int id ) {
-  //updateLimitSwitch();
-  switch ( id ) {
-    case EVT_DISABLE:
-      return 0;
-    case EVT_ENABLE:
-      return 0;
-    case EVT_ENABLED_TIMEOUT:
-      return 0;
-    case EVT_MOVE:
-      return 0;
-    case EVT_STOP:
-      return 0;
-    case EVT_EMERGENCY_STOP:
-      return 0;
-    case EVT_ON_LIMIT_LOW:
-      previous_state = limitLow_State;
-      switch(_limitLow_Mode) {
-        case 0:
-          return 0;
-        case 1: //digital INPUT
-          // Serial.println("digital");
-          limitLow_State = digitalRead(_limitLow_Pin);
-          limitLow_State = _limitLow_Reversed ? !limitLow_State : limitLow_State;
-          return limitLow_State != previous_state;
-        case 2:
-          int analogTemp = analogRead(_limitLow_Pin);
-          limitLow_State = (_limitLow_Thresholds[0] < analogTemp) && (analogTemp < _limitLow_Thresholds[1]);
-          limitLow_State = _limitLow_Reversed ? !limitLow_State : limitLow_State;
-          if(limitLow_State){analogTemp = analogRead(_limitLow_Pin);
-          limitLow_State = (_limitLow_Thresholds[0] < analogTemp) && (analogTemp < _limitLow_Thresholds[1]);
-          limitLow_State = _limitLow_Reversed ? !limitLow_State : limitLow_State;}
-          return limitLow_State != previous_state;
-      }
-    case EVT_ON_LIMIT_HIGH:
-      previous_state = limitHigh_State;
-      switch(_limitHigh_Mode) {
-        case 0:
-          return 0;
-        case 1: //digital INPUT
-          limitHigh_State = digitalRead(_limitHigh_Pin);
-          limitHigh_State = _limitHigh_Reversed ? !limitHigh_State : limitHigh_State;
-          return limitHigh_State != previous_state;
-        case 2:
-        //Serial.println("analog");
-          int analogTemp = analogRead(_limitHigh_Pin);
-          limitHigh_State = (_limitHigh_Thresholds[0] < analogTemp) && (analogTemp < _limitHigh_Thresholds[1]);
-          limitHigh_State = _limitHigh_Reversed ? !limitHigh_State : limitHigh_State;
-          return limitHigh_State != previous_state;
-      }
-    case EVT_ON_TARGET:
-      return runMode ? 0 : _currentStep == _targetStep;
-    case EVT_HOMING_LOW:
-      return 0;
-    case EVT_HOMING_HIGH:
-      return 0;
-  }
-  return 0;
-}
-
-/* Add C++ code for each action
- * This generates the 'output' for the state machine
- *
- * Available connectors:
- *   push( connectors, ON_CHANGEPOSITION, 0, <v>, <up> );
- *   push( connectors, ON_CHANGESTATE, 0, <v>, <up> );
- *   push( connectors, ON_ONLIMITHIGH, 0, <v>, <up> );
- *   push( connectors, ON_ONLIMITLOW, 0, <v>, <up> );
- *   push( connectors, ON_ONTARGET, 0, <v>, <up> );
- *   push( connectors, ON_STOP, 0, <v>, <up> );
- */
-
-void Atm_AccelStepper::action( int id ) {
-  switch ( id ) {
-    case ENT_DISABLED:
-      push(connectors, ON_CHANGESTATE, 0,  state(), 0);
-      enabled = _enableReversed ? HIGH : LOW;
-      digitalWrite(_enablePin, enabled);
-      return;
-    case ENT_ENABLED:
-      _isHoming = 0 ;
-      if(last_trigger == EVT_ON_TARGET){push( connectors, ON_ONTARGET, 0, _currentStep, 0 );};
-      push(connectors, ON_CHANGESTATE, 0,  state(), 0);
-      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
-      enabled = _enableReversed ? LOW : HIGH ;
-      digitalWrite(_enablePin, enabled);
-
-
-      return;
-    case ENT_RUNNING:
-      push(connectors, ON_CHANGESTATE, 0,  state(), 0);
-      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
-      _isHoming = 0;
-      //reset limit state so that they trigger again if we're stopped on it
-      // limitLow_State = 0;
-      // limitHigh_State = 0;
-      Serial.print("target ");
-      Serial.println(_targetStep);
-      stepper->moveTo(_targetStep);
-      // stepper->computeNewSpeed();
-      //stepper_update();
-      //push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
-      position_timer.setFromNow(this, POSITION_SEND_TIMER);
-      return;
-    case LP_RUNNING:
-      stepper_update();
-      if(stepper->speed() == 0.) {trigger(EVT_ON_TARGET);}
-      return;
-    case ENT_STOP:
-    push(connectors, ON_CHANGESTATE, 0,  state(), 0);
-    push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
-      if (last_trigger == EVT_STOP) {
-        // runMode = 0 ;
-        stepper->stop();
-        _targetStep = stepper->targetPosition();
-        push( connectors, ON_STOP, 0, 0, 0 );
-      }
-      if (last_trigger == EVT_EMERGENCY_STOP) {
-        stepper->setSpeed(0);
-        _currentStep = stepper->currentPosition();
-        _targetStep = _currentStep ;
-        stepper->moveTo(_targetStep);
-        push( connectors, ON_STOP, 0, 1, 0 );
-      }
-      return;
-    case LP_STOP:
-      stepper_update();
-      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
-      if(stepper->speed() == 0.) {trigger(EVT_ON_TARGET);}
-      // _currentStep = stepper->currentPosition();
-      return;
-    case ENT_HOMING_LOW:
-      push(connectors, ON_CHANGESTATE, 0,  state(), 0);
-      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
-      runMode = 1;
-      _isHoming = 1 ;
-      stepper->setSpeed(-1*homing_speed);
-      return;
-    case LP_HOMING_LOW:
-      stepper_update();
-      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
-      return;
-    case EXT_HOMING_LOW:
-      runMode = 0;
-      _isHoming = 0;
-      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
-      if(last_trigger == EVT_ON_LIMIT_LOW) {
-        stepper->setCurrentPosition(0);
-        _currentStep = 0;
-        push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
-        Serial.println("homing low done");
-      }
-      else{Serial.println("homing low failed");}
-      trigger(EVT_EMERGENCY_STOP);
-
-      return;
-    case ENT_HOMING_HIGH:
-      push(connectors, ON_CHANGESTATE, 0,  state(), 0);
-      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
-      runMode = 1;
-      _isHoming = 2 ;
-      stepper->setSpeed(homing_speed);
-      return;
-    case LP_HOMING_HIGH:
-      stepper_update();
-      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
-      return;
-    case EXT_HOMING_HIGH:
-    push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
-      runMode = 0;
-      _isHoming = 0;
-      trigger(EVT_EMERGENCY_STOP);
-      if(last_trigger == EVT_ON_LIMIT_HIGH) {
-        _maxStep = stepper->currentPosition();
-        _currentStep = _maxStep;
-        Serial.println("homing high done");
-      }
-      else{Serial.println("homing high failed");}
-      _targetStep = _currentStep;
-      return;
-    case ENT_LIMIT_LOW:
-      /*triggered by a change in limit state
-       if state is 0, we may leave this state for running
-       if state is 1 we stay in limit state loop, where moves are allowed only in
-            the free direction, until a trigger comes with state 0
-      */
-      push( connectors, ON_ONLIMITLOW, 0, limitLow_State, 0 );
-      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
-      if (!limitLow_State){trigger(EVT_MOVE);}
-      return;
-
-    case LP_LIMIT_LOW:
-      //stop motor if going down, allow going up
-
-      if(_limitLow_Hard && (_targetStep < _currentStep)) {
-          // Serial.println("youpi");
-          _currentStep = stepper->currentPosition();
-          stepper->moveTo(_currentStep);
-          _targetStep = _currentStep;
-          stepper->setSpeed(0);
-        }
-        stepper_update();
-      //else{} // _isHoming ? trigger(EVT_STOP):
-      return;
-    case ENT_LIMIT_HIGH:
-      push( connectors, ON_ONLIMITHIGH, 0, limitHigh_State, 0 );
-      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
-      if (!limitHigh_State){trigger(EVT_MOVE);};
-      return;
-    case LP_LIMIT_HIGH:
-      //stop motor if going down, allow going up
-
-      if(_limitHigh_Hard && (_targetStep > _currentStep)) {
-          // Serial.println("youpi");
-          _currentStep = stepper->currentPosition();
-          stepper->moveTo(_currentStep);
-          _targetStep = _currentStep;
-          stepper->setSpeed(0);
-        }
-        stepper_update();
-      // else{}
-      return;
-  }
-}
-
-/* Optionally override the default trigger() method
- * Control how your machine processes triggers
- */
-
-Atm_AccelStepper& Atm_AccelStepper::trigger( int event ) {
-  Machine::trigger( event );
-  return *this;
-}
-
-/* Optionally override the default state() method
- * Control what the machine returns when another process requests its state
- */
-
-int Atm_AccelStepper::state( void ) {
-  return Machine::state();
-}
-
-/* Nothing customizable below this line
- ************************************************************************************************
-*/
-
-/* Still I'll customize a little just here
-*/
-
-void Atm_AccelStepper::stepper_update(void) {
-
-
-  switch (runMode) {
-    case 0: //positional modae
-      stepper->run();
-      break;
-    case 1: // speed mode
-      stepper->runSpeed();
-      break;
-  }
-  // Serial.print("update ");
-  // Serial.println(stepper->speed());
-  long int tempStep = stepper->currentPosition();
-  if (tempStep != _currentStep){
-    _currentStep =  tempStep;
-    //Serial.println(stepper->currentPosition());
-    if (position_timer.expired(this)){
-      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
-      position_timer.setFromNow(this, POSITION_SEND_TIMER);
-    }
-  }
-}
-
-Atm_AccelStepper& Atm_AccelStepper::setMaxSpeed( long int maxSpeed){
-  max_speed = maxSpeed ;
-  stepper->setMaxSpeed(max_speed);
-  return *this ;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::setHomingSpeed(long int homingSpeed){
-  homing_speed = homingSpeed ;
-  return *this ;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::setAcceleration(long int acc){
-  acceleration = acc ;
-  stepper->setAcceleration(acceleration);
-  return *this ;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::setPosition(long int position){
-  stepper->setCurrentPosition(position);
-  _currentStep = position ;
-  return *this ;
-}
-
-long int Atm_AccelStepper::getPosition(){
-  return stepper->currentPosition();;
-}
-
-long int Atm_AccelStepper::distanceToGo(){
-  return stepper->distanceToGo();;
-}
-
-
-bool Atm_AccelStepper::isRunning(){
-  return stepper->isRunning();
-}
-
-float Atm_AccelStepper::getSpeed(){
-  return stepper->speed();
-}
-
-Atm_AccelStepper& Atm_AccelStepper::position_refresh(long int refresh_ms){
-  POSITION_SEND_TIMER = refresh_ms ;
-  return *this ;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::move( long int stepRel) {
-  _targetStep   = _currentStep + stepRel;
-  runMode = 0;
-  _isHoming = 0;
-  //Serial.println(_targetStep);
-  stepper->moveTo(_targetStep);
-  enable();
-  trigger( EVT_MOVE );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::moveTo( long int stepAbs) {
-  _targetStep   = stepAbs;
-  _isHoming = 0 ;
-  runMode = 0;
-  stepper->moveTo(_targetStep);
-  enable();
-  trigger( EVT_MOVE );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::rotate( long  int speed) {
-  runMode = 1;
-  _isHoming = 0 ;
-  stepper->setSpeed( speed);
-  enable();
-  trigger( EVT_MOVE );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::homing( bool direction ){
-  enable();
-  direction == 1 ? _isHoming = 2 : _isHoming = 1;
-  direction == 1 ? this->trigger(EVT_HOMING_HIGH) : this->trigger(EVT_HOMING_LOW);
-
-  return *this;
-}
-
-// Atm_AccelStepper& Atm_AccelStepper::rotationReversed(bool reversed){
-//   _rotationReversed = reversed ? -1 : 1 ;
-// }
-
-Atm_AccelStepper& Atm_AccelStepper::setEnablePin( int enablePin ){
-  _enablePin = enablePin ;
-  pinMode(_enablePin, OUTPUT);
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::pinReversed( bool directionInvert,
-                              bool stepInvert, bool enableInvert){
-  stepper->setPinsInverted(directionInvert, stepInvert, enableInvert);
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::limitLow_set(int mode,  int pin,  int reversed){
-  _limitLow_Mode = mode ;
-  _limitLow_Pin = pin ;
-  _limitLow_Reversed = reversed ;
-  if (_limitLow_Mode==1) {pinMode(_limitLow_Pin, INPUT_PULLUP);}
-  if (_limitLow_Mode==2) {pinMode(_limitLow_Pin, INPUT);}
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::limitLow_isHard(bool hardlimit){
-  _limitLow_Hard = hardlimit;
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::limitLow_setThresholds (int threshold_low, int threshold_high){
-  _limitLow_Thresholds[0] = threshold_low ;
-  _limitLow_Thresholds[1] = threshold_high ;
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::limitHigh_set(int mode,  int pin,  int reversed){
-  _limitHigh_Mode = mode ;
-  _limitHigh_Pin = pin ;
-  _limitHigh_Reversed = reversed ;
-  if (_limitHigh_Mode==1) {pinMode(_limitHigh_Pin, INPUT_PULLUP);}
-  if (_limitHigh_Mode==2) {pinMode(_limitHigh_Pin, INPUT);}
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::limitHigh_isHard(bool hardlimit){
-  _limitHigh_Hard = hardlimit;
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::limitHigh_setThresholds (int threshold_low, int threshold_high){
-  _limitHigh_Thresholds[0] = threshold_low ;
-  _limitHigh_Thresholds[1] = threshold_high ;
-  return *this;
-}
-
-/* Public event methods
- *
- */
-
-Atm_AccelStepper& Atm_AccelStepper::disable() {
-  trigger( EVT_DISABLE );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::enable() {
-  trigger( EVT_ENABLE );
-  return *this;
-}
-
-// Atm_AccelStepper& Atm_AccelStepper::move() {
-//   trigger( EVT_MOVE );
-//   return *this;
-// }
-
-Atm_AccelStepper& Atm_AccelStepper::stop() {
-  trigger( EVT_STOP );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::emergency_stop() {
-  trigger( EVT_EMERGENCY_STOP );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::on_limit_low() {
-  trigger( EVT_ON_LIMIT_LOW );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::on_limit_high() {
-  trigger( EVT_ON_LIMIT_HIGH );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::on_target() {
-  trigger( EVT_ON_TARGET );
-  return *this;
-}
-
-
-
-/*
- * onChangeposition() push connector variants ( slots 1, autostore 0, broadcast 0 )
- */
-
-Atm_AccelStepper& Atm_AccelStepper::onChangeposition( Machine& machine, int event ) {
-  onPush( connectors, ON_CHANGEPOSITION, 0, 1, 1, machine, event );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::onChangeposition( atm_cb_push_t callback, int idx ) {
-  onPush( connectors, ON_CHANGEPOSITION, 0, 1, 1, callback, idx );
-  return *this;
-}
-
-/*
- * onChangestate() push connector variants ( slots 1, autostore 0, broadcast 0 )
- */
-
-Atm_AccelStepper& Atm_AccelStepper::onChangestate( Machine& machine, int event ) {
-  onPush( connectors, ON_CHANGESTATE, 0, 1, 1, machine, event );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::onChangestate( atm_cb_push_t callback, int idx ) {
-  onPush( connectors, ON_CHANGESTATE, 0, 1, 1, callback, idx );
-  return *this;
-}
-
-/*
- * onOnlimithigh() push connector variants ( slots 1, autostore 0, broadcast 0 )
- */
-
-Atm_AccelStepper& Atm_AccelStepper::onOnlimithigh( Machine& machine, int event ) {
-  onPush( connectors, ON_ONLIMITHIGH, 0, 1, 1, machine, event );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::onOnlimithigh( atm_cb_push_t callback, int idx ) {
-  onPush( connectors, ON_ONLIMITHIGH, 0, 1, 1, callback, idx );
-  return *this;
-}
-
-/*
- * onOnlimitlow() push connector variants ( slots 1, autostore 0, broadcast 0 )
- */
-
-Atm_AccelStepper& Atm_AccelStepper::onOnlimitlow( Machine& machine, int event ) {
-  onPush( connectors, ON_ONLIMITLOW, 0, 1, 1, machine, event );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::onOnlimitlow( atm_cb_push_t callback, int idx ) {
-  onPush( connectors, ON_ONLIMITLOW, 0, 1, 1, callback, idx );
-  return *this;
-}
-
-/*
- * onOntarget() push connector variants ( slots 1, autostore 0, broadcast 0 )
- */
-
-Atm_AccelStepper& Atm_AccelStepper::onOntarget( Machine& machine, int event ) {
-  onPush( connectors, ON_ONTARGET, 0, 1, 1, machine, event );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::onOntarget( atm_cb_push_t callback, int idx ) {
-  onPush( connectors, ON_ONTARGET, 0, 1, 1, callback, idx );
-  return *this;
-}
-
-/*
- * onStop() push connector variants ( slots 1, autostore 0, broadcast 0 )
- */
-
-Atm_AccelStepper& Atm_AccelStepper::onStop( Machine& machine, int event ) {
-  onPush( connectors, ON_STOP, 0, 1, 1, machine, event );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::onStop( atm_cb_push_t callback, int idx ) {
-  onPush( connectors, ON_STOP, 0, 1, 1, callback, idx );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::onOnhominglow( Machine& machine, int event ) {
-  onPush( connectors, ON_ONTARGET, 0, 1, 1, machine, event );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::onOnhominglow( atm_cb_push_t callback, int idx ) {
-  onPush( connectors, ON_ONTARGET, 0, 1, 1, callback, idx );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::onOnhominghigh( Machine& machine, int event ) {
-  onPush( connectors, ON_ONTARGET, 0, 1, 1, machine, event );
-  return *this;
-}
-
-Atm_AccelStepper& Atm_AccelStepper::onOnhominghigh( atm_cb_push_t callback, int idx ) {
-  onPush( connectors, ON_ONTARGET, 0, 1, 1, callback, idx );
-  return *this;
-}
-
-/* State trace method
- * Sets the symbol table and the default logging method for serial monitoring
- */
-
-Atm_AccelStepper& Atm_AccelStepper::trace( Stream & stream ) {
-  Machine::setTrace( &stream, atm_serial_debug::trace,
-    "ACCELSTEPPER\0EVT_DISABLE\0EVT_ENABLE\0EVT_ENABLED_TIMEOUT\0EVT_MOVE\0EVT_STOP\0EVT_EMERGENCY_STOP\0EVT_ON_LIMIT_LOW\0EVT_ON_LIMIT_HIGH\0EVT_ON_TARGET\0EVT_HOMING_LOW\0EVT_HOMING_HIGH\0ELSE\0DISABLED\0ENABLED\0RUNNING\0STOP\0HOMING_LOW\0HOMING_HIGH\0LIMIT_LOW\0LIMIT_HIGH" );
-  return *this;
-}

+ 0 - 201
HTequi-firmware/lib/Atm_lien/Atm_AccelStepper.h

@@ -1,201 +0,0 @@
-#pragma once
-
-#include <Automaton.h>
-#include <AccelStepper.h>
-
-class Atm_AccelStepper: public Machine {
-
- public:
-  enum { DISABLE, ENABLED, RUNNING, STOP, HOMING_LOW, HOMING_HIGH, LIMIT_LOW, LIMIT_HIGH }; // STATES
-  enum { EVT_DISABLE, EVT_ENABLE, EVT_ENABLED_TIMEOUT, EVT_MOVE, EVT_STOP,
-          EVT_EMERGENCY_STOP, EVT_ON_LIMIT_LOW, EVT_ON_LIMIT_HIGH, EVT_ON_TARGET,
-          EVT_HOMING_LOW, EVT_HOMING_HIGH, ELSE }; // EVENTS
-  Atm_AccelStepper( void ) : Machine() {};
-  Atm_AccelStepper& begin( int step_pin, int dir_pin );
-  Atm_AccelStepper& trace( Stream & stream );
-  Atm_AccelStepper& trigger( int event );
-  int state( void );
-  Atm_AccelStepper& onChangeposition( Machine& machine, int event = 0 );
-  Atm_AccelStepper& onChangeposition( atm_cb_push_t callback, int idx = 0 );
-  Atm_AccelStepper& onChangestate( Machine& machine, int event = 0 );
-  Atm_AccelStepper& onChangestate( atm_cb_push_t callback, int idx = 0 );
-  Atm_AccelStepper& onOnlimithigh( Machine& machine, int event = 0 );
-  Atm_AccelStepper& onOnlimithigh( atm_cb_push_t callback, int idx = 0 );
-  Atm_AccelStepper& onOnlimitlow( Machine& machine, int event = 0 );
-  Atm_AccelStepper& onOnlimitlow( atm_cb_push_t callback, int idx = 0 );
-  Atm_AccelStepper& onOntarget( Machine& machine, int event = 0 );
-  Atm_AccelStepper& onOntarget( atm_cb_push_t callback, int idx = 0 );
-  Atm_AccelStepper& onStop( Machine& machine, int event = 0 );
-  Atm_AccelStepper& onStop( atm_cb_push_t callback, int idx = 0 );
-  Atm_AccelStepper& onOnhominglow( Machine& machine, int event = 0 );
-  Atm_AccelStepper& onOnhominglow( atm_cb_push_t callback, int idx = 0 );
-  Atm_AccelStepper& onOnhominghigh( Machine& machine, int event = 0 );
-  Atm_AccelStepper& onOnhominghigh( atm_cb_push_t callback, int idx = 0 );
-  Atm_AccelStepper& disable( void );
-  Atm_AccelStepper& enable( void );
-  //Atm_AccelStepper& move( void );
-  Atm_AccelStepper& stop( void );
-  Atm_AccelStepper& emergency_stop( void );
-  Atm_AccelStepper& on_limit_low( void );
-  Atm_AccelStepper& on_limit_high( void );
-  Atm_AccelStepper& on_target( void );
-
-  AccelStepper *stepper;
-
-  long int homing_speed = 100;
-  long int max_speed = 10000;
-  long int acceleration = 1000;
-  Atm_AccelStepper& setMaxSpeed( long int maxSpeed );
-  Atm_AccelStepper& setHomingSpeed( long int homingSpeed);
-  Atm_AccelStepper& setAcceleration( long int acc);
-  Atm_AccelStepper& setPosition( long int position);
-  long int getPosition();
-  long int distanceToGo();
-  bool isRunning();
-  float getSpeed();
-
-  Atm_AccelStepper& move(long int stepRel );
-  Atm_AccelStepper& moveTo(long int stepAbs );
-  Atm_AccelStepper& rotate(long int speed );
-  Atm_AccelStepper& homing( bool direction );
-  int runMode = 0; // 0 uses run() for positioning, 1 uses runSpeed() for constant speed
-  Atm_AccelStepper& position_refresh( long int refresh_ms = 1000);
-
-  // Atm_AccelStepper& rotationReversed(bool reversed);
-
-  Atm_AccelStepper& setEnablePin( int enablePin );
-  Atm_AccelStepper& pinReversed( bool directionInvert=false,  bool stepInvert=false, bool enableInvert=false );
-  bool enabled ;
-
-
-  Atm_AccelStepper& limitLow_set(int mode = 0, int pin = -1, int reversed=0);
-  Atm_AccelStepper& limitLow_isHard(bool hardlimit = 1);
-  Atm_AccelStepper& limitLow_setThresholds (int threshold_low=510, int threshold_high = 1024);
-  Atm_AccelStepper& limitHigh_set(int mode = 0, int pin = -1, int reversed=0);
-  Atm_AccelStepper& limitHigh_isHard(bool hardlimit = 1);
-  Atm_AccelStepper& limitHigh_setThresholds (int threshold_low=510, int threshold_high = 1024);
-  bool limitLow_State;
-  bool limitHigh_State;
-  bool previous_state = limitLow_State;
-
-
- private:
-  // ACTIONS
-  enum { ENT_DISABLED, ENT_ENABLED,ENT_RUNNING, LP_RUNNING, ENT_STOP, LP_STOP,
-          ENT_HOMING_LOW, LP_HOMING_LOW, EXT_HOMING_LOW,
-          ENT_HOMING_HIGH, LP_HOMING_HIGH, EXT_HOMING_HIGH,
-          ENT_LIMIT_LOW, LP_LIMIT_LOW, ENT_LIMIT_HIGH, LP_LIMIT_HIGH };
-  // CONNECTORS
-  enum { ON_CHANGEPOSITION, ON_CHANGESTATE, ON_ONLIMITHIGH,
-          ON_ONLIMITLOW, ON_ONTARGET, ON_STOP, CONN_MAX };
-  atm_connector connectors[CONN_MAX];
-  int event( int id );
-  void action( int id );
-
-  void stepper_update(void);
-
-  long int _currentStep = 0;
-  long int _targetStep = 0;
-  long int _maxStep ;
-  atm_timer_millis position_timer ;
-  int POSITION_SEND_TIMER = 50 ;
-
-  // bool _rotationReversed = 0 ;
-
-  int _enablePin = -1;
-  bool _enableReversed = 0 ;
-  atm_timer_millis idle_timer ;
-  int IDLE_TIMEOUT_DURATION = 500000 ;
-
-  int _limitLow_Pin;
-  int _limitLow_Mode = 0; //0 no limit, 1 digital, 2 analog with thresholds
-  bool _limitLow_Reversed ; //invert logic of limit switches
-  int _limitLow_Thresholds[2] ; //analog value  range for two analog limits
-  bool _limitLow_Hard = 0;
-  int _limitHigh_Pin;
-  int _limitHigh_Mode=0; //0 no limit, 1 digital, 2 analog with thresholds
-  bool _limitHigh_Reversed ; //invert logic of limit switches
-  int _limitHigh_Thresholds[2] ; //analog value  range for two analog limits
-  bool _limitHigh_Hard = 0 ;
-  int _isHoming = 0 ;
-  void updateLimitSwitch();
-
-};
-
-/*
-Automaton::ATML::begin - Automaton Markup Language
-
-<?xml version="1.0" encoding="UTF-8"?>
-<machines>
-  <machine name="Atm_AccelStepper">
-    <states>
-      <DISABLED index="0" on_enter="ENT_DISABLED">
-        <EVT_ENABLE>ENABLED</EVT_ENABLE>
-      </DISABLED>
-      <ENABLED index="1" on_enter="ENT_ENABLED">
-        <EVT_DISABLE>DISABLED</EVT_DISABLE>
-        <EVT_ENABLED_TIMEOUT>DISABLED</EVT_ENABLED_TIMEOUT>
-        <EVT_STOP>STOP</EVT_STOP>
-        <EVT_EMERGENCY_STOP>STOP</EVT_EMERGENCY_STOP>
-      </ENABLED>
-      <RUNNING index="2" on_loop="LP_RUNNING">
-        <EVT_DISABLE>DISABLED</EVT_DISABLE>
-        <EVT_STOP>STOP</EVT_STOP>
-        <EVT_EMERGENCY_STOP>STOP</EVT_EMERGENCY_STOP>
-        <EVT_ON_LIMIT_LOW>LIMIT_LOW</EVT_ON_LIMIT_LOW>
-        <EVT_ON_LIMIT_HIGH>LIMIT_HIGH</EVT_ON_LIMIT_HIGH>
-        <EVT_ON_TARGET>ENABLED</EVT_ON_TARGET>
-      </RUNNING>
-      <STOP index="3">
-        <EVT_DISABLE>DISABLED</EVT_DISABLE>
-        <EVT_STOP>STOP</EVT_STOP>
-        <EVT_EMERGENCY_STOP>STOP</EVT_EMERGENCY_STOP>
-      </STOP>
-      <HOMING_LOW index="4" on_enter="ENT_HOMING_LOW" on_exit="EXT_HOMING_LOW">
-        <EVT_DISABLE>DISABLED</EVT_DISABLE>
-        <EVT_STOP>STOP</EVT_STOP>
-        <EVT_EMERGENCY_STOP>STOP</EVT_EMERGENCY_STOP>
-        <EVT_ON_LIMIT_LOW>ENABLED</EVT_ON_LIMIT_LOW>
-      </HOMING_LOW>
-      <HOMING_HIGH index="5" on_enter="ENT_HOMING_HIGH" on_exit="EXT_HOMING_HIGH">
-        <EVT_DISABLE>DISABLED</EVT_DISABLE>
-        <EVT_STOP>STOP</EVT_STOP>
-        <EVT_EMERGENCY_STOP>STOP</EVT_EMERGENCY_STOP>
-        <EVT_ON_LIMIT_HIGH>ENABLED</EVT_ON_LIMIT_HIGH>
-      </HOMING_HIGH>
-      <LIMIT_LOW index="6" on_enter="ENT_LIMIT_LOW">
-        <EVT_STOP>STOP</EVT_STOP>
-        <EVT_EMERGENCY_STOP>STOP</EVT_EMERGENCY_STOP>
-        <EVT_ON_LIMIT_LOW>LIMIT_LOW</EVT_ON_LIMIT_LOW>
-      </LIMIT_LOW>
-      <LIMIT_HIGH index="7" on_enter="ENT_LIMIT_HIGH">
-        <EVT_STOP>STOP</EVT_STOP>
-        <EVT_EMERGENCY_STOP>STOP</EVT_EMERGENCY_STOP>
-        <EVT_ON_LIMIT_HIGH>LIMIT_HIGH</EVT_ON_LIMIT_HIGH>
-      </LIMIT_HIGH>
-    </states>
-    <events>
-      <EVT_DISABLE index="0" access="MIXED"/>
-      <EVT_ENABLE index="1" access="MIXED"/>
-      <EVT_ENABLED_TIMEOUT index="2" access="PRIVATE"/>
-      <EVT_STOP index="3" access="MIXED"/>
-      <EVT_EMERGENCY_STOP index="4" access="MIXED"/>
-      <EVT_ON_LIMIT_LOW index="5" access="MIXED"/>
-      <EVT_ON_LIMIT_HIGH index="6" access="MIXED"/>
-      <EVT_ON_TARGET index="7" access="MIXED"/>
-    </events>
-    <connectors>
-      <CHANGEPOSITION autostore="0" broadcast="0" dir="PUSH" slots="1"/>
-      <CHANGESTATE autostore="0" broadcast="0" dir="PUSH" slots="1"/>
-      <ONLIMITHIGH autostore="0" broadcast="0" dir="PUSH" slots="1"/>
-      <ONLIMITLOW autostore="0" broadcast="0" dir="PUSH" slots="1"/>
-      <ONTARGET autostore="0" broadcast="0" dir="PUSH" slots="1"/>
-      <STOP autostore="0" broadcast="0" dir="PUSH" slots="1"/>
-    </connectors>
-    <methods>
-    </methods>
-  </machine>
-</machines>
-
-Automaton::ATML::end
-*/

+ 0 - 416
HTequi-firmware/lib/Atm_lien/Atm_Teenstep.cpp

@@ -1,416 +0,0 @@
-#if defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
-
-#include "Atm_Teenstep.h"
-
-/* Add optional parameters for the state machine to begin()
- * Add extra initialization code
- */
-
-Atm_Teenstep& Atm_Teenstep::begin(Stepper & motorRef, StepControl & stepControlRef) {
-  // clang-format off
-  const static state_t state_table[] PROGMEM = {
-    /*                             ON_ENTER     ON_LOOP          ON_EXIT  EVT_HOMING_LOW  EVT_HOMING_HIGH  EVT_MOVE_TIMEOUT  EVT_LIMIT_HIGH   EVT_LIMIT_LOW  EVT_EMERGENCYSTOP  EVT_STOP  EVT_ONTARGET  EVT_MOVE  EVT_DISABLE  EVT_ENABLE  ELSE */
-    /*       DISABLED */       ENT_DISABLED,         -1,              -1,     HOMING_LOW,     HOMING_HIGH,               -1,             -1,             -1,                -1,       -1,           -1,       -1,          -1,    ENABLED,   -1,
-    /*        ENABLED */        ENT_ENABLED,         -1,              -1,     HOMING_LOW,     HOMING_HIGH,               -1,             -1,             -1,                -1,       -1,           -1,  RUNNING,    DISABLED,         -1,   -1,
-    /*        RUNNING */        ENT_RUNNING, LP_RUNNING,              -1,     HOMING_LOW,     HOMING_HIGH,               -1,             -1,             -1,    EMERGENCY_STOP, STOPPING,      ENABLED,  RUNNING,          -1,         -1,   -1,
-    /*       STOPPING */       ENT_STOPPING,         -1,              -1,             -1,              -1,               -1, EMERGENCY_STOP, EMERGENCY_STOP,    EMERGENCY_STOP,       -1,           -1,  RUNNING,          -1,         -1,   -1,
-    /* EMERGENCY_STOP */ ENT_EMERGENCY_STOP,         -1,              -1,             -1,              -1,               -1,             -1,             -1,                -1,       -1,           -1,  RUNNING,          -1,    ENABLED,   -1,
-    /*    HOMING_HIGH */    ENT_HOMING_HIGH,         -1, EXT_HOMING_HIGH,             -1,              -1,               -1,        ENABLED,             -1,    EMERGENCY_STOP, STOPPING,           -1,       -1,          -1,         -1,   -1,
-    /*     HOMING_LOW */     ENT_HOMING_LOW,         -1,  EXT_HOMING_LOW,             -1,              -1,               -1,            -1,        ENABLED,    EMERGENCY_STOP, STOPPING,           -1,       -1,          -1,         -1,   -1,
-  };
-  // clang-format on
-  Machine::begin( state_table, ELSE );
-  this-> motor =   &motorRef;
-  this-> controller = &stepControlRef;
-  return *this;
-}
-
-/* Add C++ code for each internally handled event (input)
- * The code must return 1 to trigger the event
- */
-
-int Atm_Teenstep::event( int id ) {
-  updateLimitSwitch();
-  switch ( id ) {
-    case EVT_HOMING_LOW:
-      return 0;
-    case EVT_HOMING_HIGH:
-      return 0;
-    case EVT_MOVE_TIMEOUT:
-      return 0;
-    case EVT_LIMIT_HIGH:
-      return limitState[0];
-    case EVT_LIMIT_LOW:
-      return limitState[1];
-    case EVT_EMERGENCYSTOP:
-      return 0;
-    case EVT_STOP:
-      return 0;
-    case EVT_ONTARGET:
-      return _currentStep == _targetStep;
-    case EVT_MOVE:
-      return 0;
-    case EVT_DISABLE:
-      return 0;
-    case EVT_ENABLE:
-      return 0;
-  }
-  return 0;
-}
-
-/* Add C++ code for each action
- * This generates the 'output' for the state machine
- *
- * Available connectors:
- *   push( connectors, ON_CHANGE, 0, <v>, <up> );
- *   push( connectors, ON_CHANGEPOSITION, 0, <v>, <up> );
- *   push( connectors, ON_LIMITHIGH, 0, <v>, <up> );
- *   push( connectors, ON_LIMITLOW, 0, <v>, <up> );
- */
-
-void Atm_Teenstep::action( int id ) {
-  switch ( id ) {
-    long int tempStep ;
-    case ENT_DISABLED:
-      push(connectors, ON_CHANGE, 0,  state(), 0);
-      enabled = _enableReversed ? HIGH : LOW;
-      digitalWrite(_enablePin, enabled);
-      sendOSC();
-      return;
-    case ENT_ENABLED:
-      push(connectors, ON_CHANGE, 0,  state(), 0);
-      enabled = _enableReversed ? LOW : HIGH ;
-      digitalWrite(_enablePin, enabled);
-      sendOSC();
-      return;
-    case ENT_RUNNING:
-      push(connectors, ON_CHANGE, 0,  state(), 0);
-      push(connectors, ON_CHANGE, 0,  2, 0);
-      return;
-    case LP_RUNNING:
-      tempStep = motor->getPosition();
-      if (tempStep != _currentStep){
-        _currentStep =  tempStep;
-        push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, 0);
-      }
-
-      //updateLimitSwitch();
-      sendOSC();
-      return;
-    case ENT_STOPPING:
-      push(connectors, ON_CHANGE, 0,  state(), 0);
-      sendOSC();
-      return;
-    case ENT_EMERGENCY_STOP:
-      push(connectors, ON_CHANGE, 0,  state(), 0);
-      controller->emergencyStop();
-      trigger(EVT_ENABLE);
-      sendOSC();
-      return;
-    case ENT_HOMING_HIGH:
-      push(connectors, ON_CHANGE, 0,  state(), 0);
-      if(_limitType) {
-        motor->setTargetRel(2147483647);
-        controller->moveAsync(*motor);
-        }
-      sendOSC();
-      return;
-    case EXT_HOMING_HIGH:
-      controller->emergencyStop();
-      if(last_trigger == EVT_LIMIT_HIGH){
-        _maxStep = motor->getPosition();
-        push(connectors, ON_LIMITHIGH, 0,  _maxStep, 0);
-        Serial.print("Stepper maxPos ");
-        Serial.println(motor->getPosition());
-        trigger(EVT_ENABLE);
-      }
-      else{
-        push(connectors, ON_LIMITLOW, 0,  1, 0);
-        Serial.println("homing failed ");
-        trigger(EVT_EMERGENCYSTOP);
-      }
-
-      return;
-    case ENT_HOMING_LOW:
-      push(connectors, ON_CHANGE, 0,  state(), 0);
-      if(_limitType) {
-        motor->setTargetRel(-2147483647);
-        controller->moveAsync(*motor);
-        }
-      sendOSC();
-      return;
-    case EXT_HOMING_LOW:
-      controller->emergencyStop();
-      if(last_trigger == EVT_LIMIT_LOW){
-        push(connectors, ON_LIMITLOW, 0,  1, 0);
-        motor->setPosition(0);
-        Serial.print("Stepper homed ");
-        Serial.println(motor->getPosition());
-        trigger(EVT_ENABLE);
-      }
-      else{
-        push(connectors, ON_LIMITHIGH, 0,  1, 0);
-        Serial.println("homing failed ");
-        trigger(EVT_EMERGENCYSTOP);
-      }
-
-
-      return;
-  }
-}
-
-/* Optionally override the default trigger() method
- * Control how your machine processes triggers
- */
-
-Atm_Teenstep& Atm_Teenstep::trigger( int event ) {
-  Machine::trigger( event );
-  return *this;
-}
-
-/* Optionally override the default state() method
- * Control what the machine returns when another process requests its state
- */
-
-int Atm_Teenstep::state( void ) {
-  return Machine::state();
-}
-
-/* CUSTOM METHODS
-********************************************************************************************************
-*/
-
-// Atm_TeensyStep& Atm_TeensyStep::enable( bool enable ){
-//
-//   return *this;
-// }
-
-/////////   ENABLE/DISABLE    ////////
-
-Atm_Teenstep& Atm_Teenstep::setEnablePin( int enablePin ){
-  _enablePin = enablePin ;
-  pinMode(_enablePin, OUTPUT);
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::enableReversed( bool reverse ){
-  _enableReversed = reverse ;
-  return *this;
-}
-
-/////////   LIMITS    ////////
-
-Atm_Teenstep& Atm_Teenstep::setLimitPins( int limitPinLow){
-  _limitPin[0] = limitPinLow;
-  pinMode(_limitPin[0], INPUT);
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::setLimitPins( int limitPinLow, int limitPinHigh){
- _limitPin[0] = limitPinLow;
- _limitPin[1] = limitPinHigh;
- pinMode(_limitPin[0], INPUT);
- pinMode(_limitPin[1], INPUT);
- return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::setLimitType( int limitType){
- _limitType = limitType;
- return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::limitReversed( bool reversed){
- _limitReversed = reversed;
- return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::limitThresholds( int limitThreshold0,
-       int limitThreshold1,  int limitThreshold2, int limitThreshold3){
- _limitThresholds[0] = limitThreshold0;
- _limitThresholds[1] = limitThreshold1;
- _limitThresholds[2] = limitThreshold2;
- _limitThresholds[3] = limitThreshold3;
- return *this;
-}
-
-void Atm_Teenstep::updateLimitSwitch(){
-  switch (_limitType) { // limitType!=0 means there is limit to check
-    case NONE:
-      return ;
-    case DIGITAL_1:
-      limitState[0] = digitalRead(_limitPin[0]);
-      limitState[0] = _limitReversed ? !limitState[0] : limitState[0];
-      return;
-    case DIGITAL_2:
-    limitState[0] = digitalRead(_limitPin[0]);
-    limitState[1] = digitalRead(_limitPin[1]);
-    limitState[0] = _limitReversed ? !limitState[0] : limitState[0];
-    limitState[1] = _limitReversed ? !limitState[1] : limitState[1];
-      return;
-    case ANALOG_1:
-    int read = analogRead(_limitPin[0]) ;
-    limitState[0] = _limitThresholds[0] < read && read < _limitThresholds[1] ;
-    limitState[1] = _limitThresholds[2] < read && read < _limitThresholds[3] ;
-      return;
-  }
-
-}
-
-
-Atm_Teenstep& Atm_Teenstep::onOSC( void ){
-//  _enableReversed = reverse ;
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::sendOSC( void ){
-//  _enableReversed = reverse ;
-  return *this;
-}
-
-/* Nothing customizable below this line
- ************************************************************************************************
-*/
-
-/* Public event methods
- *
- */
- Atm_Teenstep& Atm_Teenstep::homing_low() {
-   trigger( EVT_HOMING_LOW );
-   return *this;
- }
-
- Atm_Teenstep& Atm_Teenstep::homing_high() {
-   trigger( EVT_HOMING_HIGH );
-   return *this;
- }
-
-Atm_Teenstep& Atm_Teenstep::move_timeout() {
-  trigger( EVT_MOVE_TIMEOUT );
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::limit_high() {
-  trigger( EVT_LIMIT_HIGH );
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::limit_low() {
-  trigger( EVT_LIMIT_LOW );
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::emergencystop() {
-  trigger( EVT_EMERGENCYSTOP );
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::stop() {
-  trigger( EVT_STOP );
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::ontarget() {
-  trigger( EVT_ONTARGET );
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::move(long int stepRel) {
-  _targetStep   = _currentStep + stepRel;
-  //Serial.println(_targetStep);
-  motor->setTargetAbs(_targetStep);
-  controller->moveAsync(*motor);
-  enable();
-  trigger( EVT_MOVE );
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::moveTo(long int stepAbs) {
-  _targetStep   = stepAbs;
-  motor->setTargetAbs(_targetStep);
-  controller->moveAsync(*motor);
-  enable();
-  trigger( EVT_MOVE );
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::disable() {
-  trigger( EVT_DISABLE );
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::enable() {
-  trigger( EVT_ENABLE );
-}
-
-Atm_Teenstep& Atm_Teenstep::homing(bool direction) {
-  direction ? trigger( EVT_HOMING_HIGH ) : trigger(EVT_HOMING_LOW);
-  return *this;
-}
-
-/*
- * onChange() push connector variants ( slots 1, autostore 0, broadcast 0 )
- */
-
-Atm_Teenstep& Atm_Teenstep::onChange( Machine& machine, int event ) {
-  onPush( connectors, ON_CHANGE, 0, 1, 1, machine, event );
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::onChange( atm_cb_push_t callback, int idx ) {
-  onPush( connectors, ON_CHANGE, 0, 1, 1, callback, idx );
-  return *this;
-}
-
-/*
- * onChangeposition() push connector variants ( slots 1, autostore 0, broadcast 0 )
- */
-
-Atm_Teenstep& Atm_Teenstep::onChangeposition( Machine& machine, int event ) {
-  onPush( connectors, ON_CHANGEPOSITION, 0, 1, 1, machine, event );
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::onChangeposition( atm_cb_push_t callback, int idx ) {
-  onPush( connectors, ON_CHANGEPOSITION, 0, 1, 1, callback, idx );
-  return *this;
-}
-
-/*
- * onLimithigh() push connector variants ( slots 1, autostore 0, broadcast 0 )
- */
-
-Atm_Teenstep& Atm_Teenstep::onLimithigh( Machine& machine, int event ) {
-  onPush( connectors, ON_LIMITHIGH, 0, 1, 1, machine, event );
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::onLimithigh( atm_cb_push_t callback, int idx ) {
-  onPush( connectors, ON_LIMITHIGH, 0, 1, 1, callback, idx );
-  return *this;
-}
-
-/*
- * onLimitlow() push connector variants ( slots 1, autostore 0, broadcast 0 )
- */
-
-Atm_Teenstep& Atm_Teenstep::onLimitlow( Machine& machine, int event ) {
-  onPush( connectors, ON_LIMITLOW, 0, 1, 1, machine, event );
-  return *this;
-}
-
-Atm_Teenstep& Atm_Teenstep::onLimitlow( atm_cb_push_t callback, int idx ) {
-  onPush( connectors, ON_LIMITLOW, 0, 1, 1, callback, idx );
-  return *this;
-}
-
-/* State trace method
- * Sets the symbol table and the default logging method for serial monitoring
- */
-
- Atm_Teenstep& Atm_Teenstep::trace( Stream & stream ) {
-   Machine::setTrace( &stream, atm_serial_debug::trace,
-     "TEENSTEP\0EVT_HOMING_LOW\0EVT_HOMING_HIGH\0EVT_MOVE_TIMEOUT\0EVT_LIMIT_HIGH\0EVT_LIMIT_LOW\0EVT_EMERGENCYSTOP\0EVT_STOP\0EVT_ONTARGET\0EVT_MOVE\0EVT_DISABLE\0EVT_ENABLE\0ELSE\0DISABLED\0ENABLED\0RUNNING\0STOPPING\0EMERGENCY_STOP\0HOMING_HIGH\0HOMING_LOW" );
-   return *this;
- }
-
-#endif

+ 0 - 161
HTequi-firmware/lib/Atm_lien/Atm_Teenstep.h

@@ -1,161 +0,0 @@
-#pragma once
-
-#if defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
-
-#include <Automaton.h>
-#include <TeensyStep.h>
-
-class Atm_Teenstep: public Machine {
-
- public:
-   enum { DISABLED, ENABLED, RUNNING, STOPPING, EMERGENCY_STOP, HOMING_HIGH, HOMING_LOW }; // STATES
-   enum { EVT_HOMING_LOW, EVT_HOMING_HIGH, EVT_MOVE_TIMEOUT, EVT_LIMIT_HIGH, EVT_LIMIT_LOW, EVT_EMERGENCYSTOP, EVT_STOP, EVT_ONTARGET, EVT_MOVE, EVT_DISABLE, EVT_ENABLE, ELSE }; // EVENTS
-  Atm_Teenstep( void ) : Machine() {};
-  Atm_Teenstep& begin( Stepper & motorRef, StepControl & stepControlRef );
-  Atm_Teenstep& trace( Stream & stream );
-  Atm_Teenstep& trigger( int event );
-  int state( void );
-  Atm_Teenstep& onChange( Machine& machine, int event = 0 );
-  Atm_Teenstep& onChange( atm_cb_push_t callback, int idx = 0 );
-  Atm_Teenstep& onChangeposition( Machine& machine, int event = 0 );
-  Atm_Teenstep& onChangeposition( atm_cb_push_t callback, int idx = 0 );
-  Atm_Teenstep& onLimithigh( Machine& machine, int event = 0 );
-  Atm_Teenstep& onLimithigh( atm_cb_push_t callback, int idx = 0 );
-  Atm_Teenstep& onLimitlow( Machine& machine, int event = 0 );
-  Atm_Teenstep& onLimitlow( atm_cb_push_t callback, int idx = 0 );
-  Atm_Teenstep& homing_low( void );
-  Atm_Teenstep& homing_high( void );
-  Atm_Teenstep& move_timeout( void );
-  Atm_Teenstep& limit_high( void );
-  Atm_Teenstep& limit_low( void );
-  Atm_Teenstep& emergencystop( void );
-  Atm_Teenstep& stop( void );
-  Atm_Teenstep& ontarget( void );
-  Atm_Teenstep& move( void );
-  Atm_Teenstep& disable( void );
-  Atm_Teenstep& enable( void );
-
-
-  Atm_Teenstep& move( long int stepRel );
-  Atm_Teenstep& moveTo( long int stepAbs );
-  Atm_Teenstep& homing( bool direction );
-
-  Atm_Teenstep& setLimitType( int limitType = 0);
-  Atm_Teenstep& setLimitPins( int limitPinLow);
-  Atm_Teenstep& setLimitPins( int limitPinLow, int limitPinHigh);
-  Atm_Teenstep& limitReversed( bool reversed );
-  Atm_Teenstep& limitThresholds( int limitThreshold0, int limitThreshold1,
-                                  int limitThreshold2, int limitThreshold3);
-  bool limitState[2] ; // up to two limits, at least one for homing
-
-  virtual Atm_Teenstep& onOSC( void );
-  virtual Atm_Teenstep& sendOSC( void );
-
-  Stepper * motor;
-  StepControl * controller;
-
-  Atm_Teenstep& setEnablePin( int enablePin );
-  Atm_Teenstep& enableReversed( bool reverse );
-  bool enabled ;
-
-
-
- private:
-  enum { ENT_DISABLED, ENT_ENABLED, ENT_RUNNING, LP_RUNNING, ENT_STOPPING, ENT_EMERGENCY_STOP, ENT_HOMING_HIGH, EXT_HOMING_HIGH, ENT_HOMING_LOW, EXT_HOMING_LOW }; // ACTIONS
-  enum { ON_CHANGE, ON_CHANGEPOSITION, ON_LIMITHIGH, ON_LIMITLOW, CONN_MAX }; // CONNECTORS
-  atm_connector connectors[CONN_MAX];
-  int event( int id );
-  void action( int id );
-
-  atm_timer_millis idle_timer ;
-  int IDLE_TIMEOUT_DURATION = 500000 ;
-  atm_timer_millis moving_timer ;
-  int MOVING_TIMEOUT_DURATION = 12000000 ;
-  atm_counter homing_counterout ;
-
-  long int _currentStep = 0;
-  long int _targetStep = 0;
-  long int _maxStep ;
-
-  int _enablePin = -1;
-  bool _enableReversed = 0 ;
-
-  int _limitPin[2];
-  enum { NONE, DIGITAL_1, DIGITAL_2, ANALOG_1 };
-  int _limitType; //type of limit switch, from list over
-  bool _limitReversed ; //invert logic of limit switches
-  int _limitThresholds[4] ; //analog value  range for two analog limits
-  void updateLimitSwitch();
-};
-
-#endif
-
-/*
-Automaton::ATML::begin - Automaton Markup Language
-
-<?xml version="1.0" encoding="UTF-8"?>
-<machines>
-  <machine name="Atm_Teenstep">
-    <states>
-      <DISABLED index="0" on_enter="ENT_DISABLED">
-        <EVT_ENABLE>ENABLED</EVT_ENABLE>
-      </DISABLED>
-      <ENABLED index="1" on_enter="ENT_ENABLED">
-        <EVT_MOVE>RUNNING</EVT_MOVE>
-        <EVT_DISABLE>DISABLED</EVT_DISABLE>
-      </ENABLED>
-      <RUNNING index="2" on_enter="ENT_RUNNING" on_loop="LP_RUNNING">
-        <EVT_LIMIT_HIGH>EMERGENCY_STOP</EVT_LIMIT_HIGH>
-        <EVT_LIMIT_LOW>EMERGENCY_STOP</EVT_LIMIT_LOW>
-        <EVT_EMERGENCYSTOP>EMERGENCY_STOP</EVT_EMERGENCYSTOP>
-        <EVT_STOP>STOPPING</EVT_STOP>
-        <EVT_ONTARGET>ENABLED</EVT_ONTARGET>
-        <EVT_MOVE>RUNNING</EVT_MOVE>
-      </RUNNING>
-      <STOPPING index="3" on_enter="ENT_STOPPING">
-        <EVT_LIMIT_HIGH>EMERGENCY_STOP</EVT_LIMIT_HIGH>
-        <EVT_LIMIT_LOW>EMERGENCY_STOP</EVT_LIMIT_LOW>
-        <EVT_EMERGENCYSTOP>EMERGENCY_STOP</EVT_EMERGENCYSTOP>
-        <EVT_MOVE>RUNNING</EVT_MOVE>
-      </STOPPING>
-      <EMERGENCY_STOP index="4" on_enter="ENT_EMERGENCY_STOP">
-        <EVT_MOVE>RUNNING</EVT_MOVE>
-        <EVT_ENABLE>ENABLED</EVT_ENABLE>
-      </EMERGENCY_STOP>
-      <HOMING_HIGH index="5" on_enter="ENT_HOMING_HIGH" on_exit="EXT_HOMING_HIGH">
-        <EVT_LIMIT_HIGH>ENABLED</EVT_LIMIT_HIGH>
-        <EVT_LIMIT_LOW>EMERGENCY_STOP</EVT_LIMIT_LOW>
-        <EVT_EMERGENCYSTOP>EMERGENCY_STOP</EVT_EMERGENCYSTOP>
-        <EVT_STOP>STOPPING</EVT_STOP>
-      </HOMING_HIGH>
-      <HOMING_LOW index="6" on_enter="ENT_HOMING_LOW" on_exit="EXT_HOMING_LOW">
-        <EVT_LIMIT_HIGH>EMERGENCY_STOP</EVT_LIMIT_HIGH>
-        <EVT_LIMIT_LOW>ENABLED</EVT_LIMIT_LOW>
-        <EVT_EMERGENCYSTOP>EMERGENCY_STOP</EVT_EMERGENCYSTOP>
-        <EVT_STOP>STOPPING</EVT_STOP>
-      </HOMING_LOW>
-    </states>
-    <events>
-      <EVT_MOVE_TIMEOUT index="0" access="MIXED"/>
-      <EVT_LIMIT_HIGH index="1" access="MIXED"/>
-      <EVT_LIMIT_LOW index="2" access="MIXED"/>
-      <EVT_EMERGENCYSTOP index="3" access="MIXED"/>
-      <EVT_STOP index="4" access="MIXED"/>
-      <EVT_ONTARGET index="5" access="MIXED"/>
-      <EVT_MOVE index="6" access="MIXED"/>
-      <EVT_DISABLE index="7" access="MIXED"/>
-      <EVT_ENABLE index="8" access="MIXED"/>
-    </events>
-    <connectors>
-      <CHANGE autostore="0" broadcast="0" dir="PUSH" slots="1"/>
-      <CHANGEPOSITION autostore="0" broadcast="0" dir="PUSH" slots="1"/>
-      <LIMITHIGH autostore="0" broadcast="0" dir="PUSH" slots="1"/>
-      <LIMITLOW autostore="0" broadcast="0" dir="PUSH" slots="1"/>
-    </connectors>
-    <methods>
-    </methods>
-  </machine>
-</machines>
-
-Automaton::ATML::end
-*/

+ 0 - 40
HTequi-firmware/lib/Atm_lien/Atm_Teenstep_OSC.cpp

@@ -1,40 +0,0 @@
-#ifdef ATM_TEENSTEP_OSC_H
-
-#include "Atm_Teenstep_OSC.h"
-
-Atm_Teenstep_OSC& Atm_Teenstep_OSC::begin(Atm_Teenstep& stepperMachineRef, EthernetUDP& udpRef, OSCBundle& bndl, const char* address) {
-  this-> stepperMachine = &stepperMachineRef;
-  _adress = address;
-  this->_udpRef =   &udpRef;
-  this->_bndl = &bndl ;
-  //stepperMachine->onChangeposition( sendPosition, 0);
-  return *this;
-}
-
-
-
-Atm_Teenstep_OSC& Atm_Teenstep_OSC::onOSC(OSCMessage& msg ){
-  Serial.println("OSC");
-  int patternOffset = msg.match(_adress) ;
-  if(patternOffset){
-    if(msg.fullMatch("/speedAcc", patternOffset)){
-      stepperMachine->motor->setMaxSpeed(msg.getInt(0));
-      stepperMachine->motor->setAcceleration(msg.getInt(1));
-    }
-    if(msg.fullMatch("/enable", patternOffset)){msg.getInt(0) ? stepperMachine->trigger(stepperMachine->EVT_ENABLE) : stepperMachine->trigger(stepperMachine->EVT_DISABLE);}
-    //if(msg.fullMatch("/home", patternOffset)){home(msg.getInt(0));}
-    if(msg.fullMatch("/move", patternOffset)){stepperMachine->move(msg.getInt(0));Serial.println(msg.getInt(0));}
-    if(msg.fullMatch("/moveTo", patternOffset)){stepperMachine->moveTo(msg.getInt(0));}
-    if(msg.fullMatch("/stop", patternOffset)){stepperMachine->stop();}
-    if(msg.fullMatch("/emergencyStop", patternOffset)){stepperMachine->emergencystop();}
-    if(msg.fullMatch("/home", patternOffset)){stepperMachine->homing(msg.getInt(0));}
-
-    return *this;
-  }
-}
-
-void Atm_Teenstep_OSC::sendPosition(int idx, int v, int up) {
-  _bndl->add(_adress).add(v);
-}
-
-#endif

+ 0 - 35
HTequi-firmware/lib/Atm_lien/Atm_Teenstep_OSC.h

@@ -1,35 +0,0 @@
-#pragma once
-
-#ifdef ATM_TEENSTEP_OSC_H
-
-#include "Atm_Teenstep.h"
-
-#include <EthernetUdp.h>
-#include <OSCMessage.h>
-#include <OSCBundle.h>
-
-class Atm_Teenstep_OSC {
-
-  public:
-    Atm_Teenstep_OSC( void ){};
-    Atm_Teenstep_OSC& begin(Atm_Teenstep & stepperMachineRef,
-                              EthernetUDP& udpRef,
-                               OSCBundle& bndl,
-                               const char* address);
-    Atm_Teenstep* stepperMachine ;
-    const char* _adress = "/OSC";
-    EthernetUDP* _udpRef ;
-    Atm_Teenstep_OSC& onOSC(OSCMessage& msg );
-    Atm_Teenstep_OSC& sendOSC( void );
-
-    void sendPosition(int idx, int v, int up);
-
-  private:
-   // AccelStepper _motor;
-   // Stepper *_motor;       // STEP pin: 2, DIR pin: 3
-   // StepControl _controller;
-   OSCBundle* _bndl;
-
-};
-
-#endif

+ 0 - 263
HTequi-firmware/lib/Atm_lien/Atm_out.cpp

@@ -1,263 +0,0 @@
-#if not defined(ARDUINO_ARCH_ESP32)
-
-#include "Atm_out.h"
-
-Atm_out& Atm_out::begin( int attached_pin, bool activeLow,
-            EthernetUDP& udpRef, OSCBundle& bndl, const char* address ) {
-  // clang-format off
-  static const state_t state_table[] PROGMEM = {
-    /*               ON_ENTER    ON_LOOP    ON_EXIT  EVT_ON_TIMER  EVT_OFF_TIMER EVT_WT_TIMER EVT_COUNTER  EVT_ON  EVT_OFF  EVT_BLINK  EVT_TOGGLE  EVT_TOGGLE_BLINK   ELSE */
-    /* IDLE      */  ENT_INIT, ATM_SLEEP,        -1,           -1,            -1,          -1,         -1,  WT_ON,      -1,  WT_START,         ON,         WT_START,    -1, // LED off
-    /* ON        */    ENT_ON, ATM_SLEEP,        -1,           -1,            -1,          -1,         -1,     -1,     OFF,  WT_START,        OFF,              OFF,    -1, // LED on
-    /* START     */    ENT_ON,        -1,        -1,    BLINK_OFF,            -1,          -1,         -1,  WT_ON,     OFF,        -1,        OFF,              OFF,    -1, // Start blinking
-    /* BLINK_OFF */   ENT_OFF,        -1,        -1,           -1,          LOOP,          -1,         -1,  WT_ON,     OFF,        -1,        OFF,              OFF,    -1,
-    /* LOOP      */        -1,        -1,        -1,           -1,            -1,          -1,       DONE,  WT_ON,     OFF,        -1,        OFF,              OFF, START,
-    /* DONE      */        -1,        -1, EXT_CHAIN,           -1,           OFF,          -1,         -1,  WT_ON,     OFF,  WT_START,        OFF,              OFF,    -1, // Wait after last blink
-    /* OFF       */   ENT_OFF,        -1,        -1,           -1,            -1,          -1,         -1,  WT_ON,     OFF,  WT_START,         -1,               -1,  IDLE, // All off -> IDLE
-    /* WT_ON     */        -1,        -1,        -1,           -1,            -1,          ON,         -1,  WT_ON,     OFF,  WT_START,         -1,               -1,    -1, // LEAD for ON
-    /* WT_START  */        -1,        -1,        -1,           -1,            -1,       START,         -1,  WT_ON,     OFF,  WT_START,         -1,               -1,    -1, // LEAD for BLINK
-  };
-  // clang-format on
-  Machine::begin( state_table, ELSE );
-  pin = attached_pin;
-  this->activeLow = activeLow;
-  level = 255;
-  toLow = 0;
-  toHigh = 255;
-  wrap = false;
-  pinMode( pin, OUTPUT );
-  digitalWrite( pin, activeLow ? HIGH : LOW );
-  on_timer.set( 500 );
-  off_timer.set( 500 );
-  pwm( 512, 1 );
-  lead_timer.set( 0 );
-  repeat_count = ATM_COUNTER_OFF;
-  counter.set( repeat_count );
-  while ( state() != 0 ) cycle();
-  _adress = address;
-  this->_udpRef =   &udpRef;
-  this->_bndl = &bndl ;
-  return *this;
-}
-
-Atm_out& Atm_out::pwm( uint16_t width, float freq ) {
-
-    if ( freq > -1 ) {
-		this->freq = freq;
-	} else {
-		freq = this->freq;
-	}
-	this->width = width;
-	float cycle_width = 1000 / freq;
-	on_timer.set( cycle_width / 1024 * this->width );
-	off_timer.set( cycle_width / 1024 * ( 1024 - this->width ) );
-	return *this;
-}
-
-Atm_out& Atm_out::frequency( float freq ) {
-
-	this->freq = freq;
-	float cycle_width = 1000 / freq;
-	on_timer.set( cycle_width / 1024 * this->width );
-	off_timer.set( cycle_width / 1024 * ( 1024 - this->width ) );
-	return *this;
-}
-
-int Atm_out::event( int id ) {
-  switch ( id ) {
-    case EVT_ON_TIMER:
-      return on_timer.expired( this );
-    case EVT_OFF_TIMER:
-      return off_timer.expired( this );
-    case EVT_WT_TIMER:
-      return lead_timer.expired( this );
-    case EVT_COUNTER:
-      return counter.expired();
-  }
-  return 0;
-}
-
-void Atm_out::action( int id ) {
-  switch ( id ) {
-    case ENT_INIT:
-      counter.set( repeat_count );
-      return;
-    case ENT_ON:
-      if ( on_timer.value > 0 ) { // Never turn if on_timer is zero (duty cycle 0 must be dark)
-        if ( activeLow ) {
-          digitalWrite( pin, LOW );
-        } else {
-          if ( level == toHigh ) {
-            digitalWrite( pin, HIGH );
-          } else {
-            analogWrite( pin, mapLevel( level ) );
-          }
-        }
-      }
-      return;
-    case ENT_OFF:
-      counter.decrement();
-      if ( !activeLow ) {
-        digitalWrite( pin, LOW );
-      } else {
-        if ( level == toHigh ) {
-          digitalWrite( pin, HIGH );
-        } else {
-          analogWrite( pin, mapLevel( level ) );
-        }
-      }
-      return;
-    case EXT_CHAIN:
-      onfinish.push( 0 );
-      return;
-  }
-}
-
-int Atm_out::mapLevel( int level ) {
-  if ( levelMapSize ) {
-    return levelMap[level];
-  } else {
-    return map( level, toLow, toHigh, 0, 255 );
-  }
-}
-
-Atm_out& Atm_out::on( void ) {
-  trigger( EVT_ON );
-  return *this;
-}
-
-Atm_out& Atm_out::off( void ) {
-  trigger( EVT_OFF );
-  return *this;
-}
-
-Atm_out& Atm_out::toggle( void ) {
-  trigger( EVT_TOGGLE );
-  return *this;
-}
-
-Atm_out& Atm_out::toggleBlink( void ) {
-  trigger( EVT_TOGGLE_BLINK );
-  return *this;
-}
-
-Atm_out& Atm_out::start( void ) {
-  trigger( EVT_BLINK );
-  return *this;
-}
-
-Atm_out& Atm_out::onFinish( Machine& machine, int event /* = 0 */ ) {
-  onfinish.set( &machine, event );
-  return *this;
-}
-
-Atm_out& Atm_out::onFinish( atm_cb_push_t callback, int idx /* = 0 */ ) {
-  onfinish.set( callback, idx );
-  return *this;
-}
-
-Atm_out& Atm_out::blink( uint32_t duration, uint32_t pause_duration, uint16_t repeat_count /* = ATM_COUNTER_OFF */ ) {
-  blink( duration );  // Time in which led is fully on
-  pause( pause_duration );
-  repeat( repeat_count );
-  return *this;
-}
-
-Atm_out& Atm_out::blink( uint32_t duration ) {
-  on_timer.set( duration );  // Time in which led is fully on
-  return *this;
-}
-
-Atm_out& Atm_out::blink( void ) {
-  trigger( EVT_BLINK );
-  return *this;
-}
-
-Atm_out& Atm_out::range( int toLow, int toHigh, bool wrap /* = false */ ) {
-  this->toLow = toLow;
-  this->toHigh = toHigh;
-  this->wrap = wrap;
-  level = toHigh;
-  return *this;
-}
-
-Atm_out& Atm_out::levels( unsigned char* map, int mapsize, bool wrap /* = false */ ) {
-  this->levelMap = map;
-  levelMapSize = mapsize;
-  range( 0, mapsize - 1, wrap );
-  return *this;
-}
-
-Atm_out& Atm_out::pause( uint32_t duration ) {  // Time in which led is fully off
-  off_timer.set( duration ? duration : 1 );     // Make sure off_timer is never 0 (work around)
-  return *this;
-}
-
-Atm_out& Atm_out::fade( int fade ) {
-  return *this;
-}  // Dummy for method compatibility with Atm_fade
-
-Atm_out& Atm_out::lead( uint32_t ms ) {
-  lead_timer.set( ms );
-  return *this;
-}
-
-Atm_out& Atm_out::repeat( uint16_t repeat ) {
-  counter.set( repeat_count = repeat );
-  return *this;
-}
-
-int Atm_out::brightness( int level /* = -1 */ ) {
-  if ( level > -1 ) {
-    this->level = level;
-    if ( current == ON || current == START ) {
-      analogWrite( pin, mapLevel( level ) );
-    }
-  }
-  return this->level;
-}
-
-int Atm_out::brighten( int v ) {
-  if ( abs( v ) == 1 ) {
-    int br = (int)this->level + v;
-    if ( br > toHigh )
-      br = wrap ? toLow : toHigh;
-    if ( br < toLow )
-      br = wrap ? toHigh : toLow;
-    brightness( br );
-  }
-  return this->level;
-}
-
-Atm_out& Atm_out::trigger( int event ) {
-  if ( event > ELSE ) {
-    brighten( event == EVT_BRUP ? 1 : -1 );
-  } else {
-    Machine::trigger( event );
-  }
-  return *this;
-}
-
-Atm_out& Atm_out::onOSC(OSCMessage& msg ){
-  Serial.println("OSC");
-  int patternOffset = msg.match(_adress) ;
-  if(patternOffset){
-
-    if(msg.fullMatch("/on", patternOffset)){trigger(EVT_ON);}
-    if(msg.fullMatch("/off", patternOffset)){trigger(EVT_OFF);}
-    if(msg.fullMatch("/toggle", patternOffset)){trigger(EVT_TOGGLE);}
-    if(msg.fullMatch("/blink", patternOffset)){trigger(EVT_BLINK);}
-    if(msg.fullMatch("/brightness", patternOffset)){brightness(msg.getInt(0));}
-  }
-  return *this;
-}
-
-Atm_out& Atm_out::trace( Stream& stream ) {
-  setTrace( &stream, atm_serial_debug::trace,
-            "LED\0EVT_ON_TIMER\0EVT_OFF_TIMER\0EVT_WT_TIMER\0EVT_COUNTER\0EVT_ON\0EVT_OFF\0EVT_"
-            "BLINK\0EVT_TOGGLE\0EVT_TOGGLE_BLINK\0ELSE\0"
-            "IDLE\0ON\0START\0BLINK_OFF\0LOOP\0DONE\0OFF\0WT_ON\0WT_START" );
-  return *this;
-}
-
-#endif

+ 0 - 71
HTequi-firmware/lib/Atm_lien/Atm_out.h

@@ -1,71 +0,0 @@
-#pragma once
-
-#if not defined(ARDUINO_ARCH_ESP32) 
-
-#include <Automaton.h>
-
-#include <EthernetUdp.h>
-#include <OSCMessage.h>
-#include <OSCBundle.h>
-
-class Atm_out : public Machine {
- public:
-  enum { IDLE, ON, START, BLINK_OFF, LOOP, DONE, OFF, WT_ON, WT_START };
-  enum { EVT_ON_TIMER, EVT_OFF_TIMER, EVT_WT_TIMER, EVT_COUNTER, EVT_ON, EVT_OFF, EVT_BLINK, EVT_TOGGLE, EVT_TOGGLE_BLINK, ELSE, EVT_BRUP, EVT_BRDN }; // BRUP/BRDN pseudo
-  enum { EVT_START = EVT_BLINK };
-
-  Atm_out( void ) : Machine(){};
-  Atm_out& begin( int attached_pin, bool activeLow,
-          EthernetUDP& udpRef, OSCBundle& bndl, const char* address  );
-  Atm_out& blink( void );
-  Atm_out& blink( uint32_t duration );
-  Atm_out& blink( uint32_t duration, uint32_t pause_duration, uint16_t repeat_count = ATM_COUNTER_OFF );
-  Atm_out& pwm( uint16_t width, float freq = -1 );
-  Atm_out& frequency( float freq );
-  Atm_out& pause( uint32_t duration );
-  Atm_out& fade( int fade );
-  Atm_out& lead( uint32_t ms );
-  Atm_out& repeat( uint16_t repeat );
-  int brightness( int level = -1 );
-  Atm_out& on( void );
-  Atm_out& off( void );
-  Atm_out& toggle( void );
-  Atm_out& toggleBlink( void );
-  Atm_out& start( void );
-  Atm_out& trace( Stream& stream );
-  Atm_out& onFinish( Machine& machine, int event = 0 );
-  Atm_out& onFinish( atm_cb_push_t callback, int idx = 0 );
-  Atm_out& range( int toLow, int toHigh, bool wrap = false );
-  Atm_out& levels( unsigned char* map, int mapsize, bool wrap = false );
-  int brighten( int v = 1 );
-  Atm_out& trigger( int event );
-
-  const char* _adress = "/OSC";
-  EthernetUDP* _udpRef ;
-  Atm_out& onOSC(OSCMessage& msg );
-  OSCBundle* _bndl;
-
-
- private:
-  enum { ENT_INIT, ENT_ON, ENT_OFF, EXT_CHAIN };
-  uint8_t level;
-  short pin;
-  bool activeLow;
-  uint8_t toHigh, toLow;
-  bool wrap;
-  uint16_t repeat_count;
-  uint16_t width;
-  float freq;
-  atm_timer_millis on_timer, off_timer, lead_timer;
-  atm_counter counter;
-  atm_connector onfinish;
-  unsigned char* levelMap;
-  int levelMapSize;
-  int mapLevel( int level );
-
-
-  int event( int id );
-  void action( int id );
-};
-
-#endif

+ 0 - 21
HTequi-firmware/lib/Atm_lien/examples/Atm_AccelStepper/Atm_AccelStepper.ino

@@ -1,21 +0,0 @@
-#include <Automaton.h>
-#include "Atm_AccelStepper.h"
-
-// Basic Arduino sketch - instantiates the state machine and nothing else
-
-Atm_AccelStepper AccelStepper;
-
-void setup() {
-
-  // Serial.begin( 9600 );
-  // AccelStepper.trace( Serial );
-
-  AccelStepper.begin();
-
-}
-
-void loop() {
-  automaton.run();
-}
-
-

+ 0 - 134
HTequi-firmware/lib/Atm_stepper.cpp

@@ -1,134 +0,0 @@
-#include "Atm_stepper.h"
-
-/* Add optional parameters for the state machine to begin()
- * Add extra initialization code
- */
-
-Atm_stepper& Atm_stepper::begin(int stepPin, int dirPin) {
-  // clang-format off
-  const static state_t state_table[] PROGMEM = {
-    /*                 ON_ENTER     ON_LOOP       ON_EXIT  EVT_IDLE_TIMER  EVT_ON_TARGET  EVT_GOTO  ELSE */
-    /*     IDLE */     ENT_IDLE,         -1,           -1,             -1,            -1,  RUNNING,   -1,
-    /*    READY */    ENT_READY,         -1,           -1,           IDLE,            -1,  RUNNING,   -1,
-    /*  RUNNING */  ENT_RUNNING, LP_RUNNING,           -1,             -1,      STOPPING,  RUNNING,   -1,
-    /* STOPPING */ ENT_STOPPING,         -1, EXT_STOPPING,             -1,         READY,       -1,   -1,
-  };
-  // clang-format on
-  Machine::begin( state_table, ELSE );
-  AccelStepper _motor (1, stepPin, dirPin);
-  // Stepper _motor(stepPin, dirPin );
-  // StepControl _controller;
-  // _motor.setMaxSpeed(20000);
-  // _motor.setAcceleration(1000);
-  //_controller = new StepControl;
-  pinMode(0, OUTPUT);
-  digitalWrite(0, HIGH);
-  return *this;
-}
-
-/* Add C++ code for each internally handled event (input)
- * The code must return 1 to trigger the event
- */
-
-int Atm_stepper::event( int id ) {
-  switch ( id ) {
-    case EVT_IDLE_TIMER:
-      return 0;
-    case EVT_ON_TARGET:
-
-      return _motor.distanceToGo()== 0 ;
-  }
-  return 0;
-}
-
-/* Add C++ code for each action
- * This generates the 'output' for the state machine
- *
- * Available connectors:
- *   push( connectors, ON_ONCHANGE, 0, <v>, <up> );
- */
-
-void Atm_stepper::action( int id ) {
-  switch ( id ) {
-    case ENT_IDLE:
-      digitalWrite(0, LOW);
-      return;
-    case ENT_READY:
-    digitalWrite(0, HIGH);
-      return;
-    case ENT_RUNNING:
-      digitalWrite(0, HIGH);
-      // _controller.moveAsync(*_motor);
-      return;
-    case LP_RUNNING:
-      _motor.run();
-
-     Serial.println(_motor.currentPosition());
-      return;
-    case ENT_STOPPING:
-      return;
-    case EXT_STOPPING:
-      return;
-  }
-}
-
-/* Optionally override the default trigger() method
- * Control how your machine processes triggers
- */
-
-Atm_stepper& Atm_stepper::trigger( int event ) {
-  Machine::trigger( event );
-  return *this;
-}
-
-/* Optionally override the default state() method
- * Control what the machine returns when another process requests its state
- */
-
-int Atm_stepper::state( void ) {
-  return Machine::state();
-}
-
-/* Nothing customizable below this line
- ************************************************************************************************
-*/
-
-/* Public event methods
- *
- */
-
-Atm_stepper& Atm_stepper::gotoStep(long int targetStep ) {
-  // _motor->setTargetRel(targetStep);
-
-  _motor.move(targetStep);
-  _motor.run();
-  Serial.println(_motor.distanceToGo());
-  _motor.setMaxSpeed(5000);
-  _motor.setAcceleration(6000);
-  trigger( EVT_GOTO );
-  return *this;
-}
-
-/*
- * onOnchange() push connector variants ( slots 1, autostore 0, broadcast 0 )
- */
-
-Atm_stepper& Atm_stepper::onOnchange( Machine& machine, int event ) {
-  onPush( connectors, ON_ONCHANGE, 0, 1, 1, machine, event );
-  return *this;
-}
-
-Atm_stepper& Atm_stepper::onOnchange( atm_cb_push_t callback, int idx ) {
-  onPush( connectors, ON_ONCHANGE, 0, 1, 1, callback, idx );
-  return *this;
-}
-
-/* State trace method
- * Sets the symbol table and the default logging method for serial monitoring
- */
-
-Atm_stepper& Atm_stepper::trace( Stream & stream ) {
-  Machine::setTrace( &stream, atm_serial_debug::trace,
-    "STEPPER\0EVT_IDLE_TIMER\0EVT_ON_TARGET\0EVT_GOTO\0ELSE\0IDLE\0READY\0RUNNING\0STOPPING" );
-  return *this;
-}

+ 0 - 68
HTequi-firmware/lib/Atm_stepper.h

@@ -1,68 +0,0 @@
-#pragma once
-
-#include <Automaton.h>
-// #include <TeensyStep.h>
-#include "AccelStepper.h"
-class Atm_stepper: public Machine {
-
- public:
-  enum { IDLE, READY, RUNNING, STOPPING }; // STATES
-  enum { EVT_IDLE_TIMER, EVT_ON_TARGET, EVT_GOTO, ELSE }; // EVENTS
-  Atm_stepper( void ) : Machine()  {};
-  Atm_stepper& begin( int setpPin, int dirPin ) ;
-  Atm_stepper& trace( Stream & stream );
-  Atm_stepper& trigger( int event );
-  int state( void );
-  Atm_stepper& onOnchange( Machine& machine, int event = 0 );
-  Atm_stepper& onOnchange( atm_cb_push_t callback, int idx = 0 );
-  Atm_stepper& gotoStep( long int targetStep );
-
- private:
-  AccelStepper _motor;
-  // Stepper *_motor;       // STEP pin: 2, DIR pin: 3
-  // StepControl _controller;
-  enum { ENT_IDLE, ENT_READY, ENT_RUNNING, LP_RUNNING, ENT_STOPPING, EXT_STOPPING }; // ACTIONS
-  enum { ON_ONCHANGE, CONN_MAX }; // CONNECTORS
-  atm_connector connectors[CONN_MAX];
-  int event( int id );
-  void action( int id );
-
-};
-
-/*
-Automaton::ATML::begin - Automaton Markup Language
-
-<?xml version="1.0" encoding="UTF-8"?>
-<machines>
-  <machine name="Atm_stepper">
-    <states>
-      <IDLE index="0" on_enter="ENT_IDLE">
-        <EVT_GOTO>RUNNING</EVT_GOTO>
-      </IDLE>
-      <READY index="1" on_enter="ENT_READY">
-        <EVT_IDLE_TIMER>IDLE</EVT_IDLE_TIMER>
-        <EVT_GOTO>RUNNING</EVT_GOTO>
-      </READY>
-      <RUNNING index="2" on_enter="ENT_RUNNING" on_loop="LP_RUNNING">
-        <EVT_ON_TARGET>STOPPING</EVT_ON_TARGET>
-        <EVT_GOTO>RUNNING</EVT_GOTO>
-      </RUNNING>
-      <STOPPING index="3" on_enter="ENT_STOPPING" on_exit="EXT_STOPPING">
-        <EVT_ON_TARGET>READY</EVT_ON_TARGET>
-      </STOPPING>
-    </states>
-    <events>
-      <EVT_IDLE_TIMER index="0" access="PRIVATE"/>
-      <EVT_ON_TARGET index="1" access="PRIVATE"/>
-      <EVT_GOTO index="2" access="PUBLIC"/>
-    </events>
-    <connectors>
-      <ONCHANGE autostore="0" broadcast="0" dir="PUSH" slots="1"/>
-    </connectors>
-    <methods>
-    </methods>
-  </machine>
-</machines>
-
-Automaton::ATML::end
-*/

+ 0 - 17
HTequi-firmware/lib/TeensyStep-2.0.0/.gitattributes

@@ -1,17 +0,0 @@
-# Auto detect text files and perform LF normalization
-* text=auto 
-
-# Custom for Visual Studio
-*.cs     diff=csharp
-
-# Standard to msysgit
-*.doc	 diff=astextplain
-*.DOC	 diff=astextplain
-*.docx diff=astextplain
-*.DOCX diff=astextplain
-*.dot  diff=astextplain
-*.DOT  diff=astextplain
-*.pdf  diff=astextplain
-*.PDF	 diff=astextplain
-*.rtf	 diff=astextplain
-*.RTF	 diff=astextplain

+ 0 - 54
HTequi-firmware/lib/TeensyStep-2.0.0/.gitignore

@@ -1,54 +0,0 @@
-# Windows image file caches 
-Thumbs.db
-ehthumbs.db
-
-# Ignore docs files
-_gh_pages
-_site*
-_drafts
-.vscode*
-.ruby-version
-
-# Folder config file
-Desktop.ini
-
-# Recycle Bin used on file shares
-$RECYCLE.BIN/
-
-# Windows Installer files
-*.cab
-*.msi
-*.msm
-*.msp
-
-# Windows shortcuts
-*.lnk
-
-# =========================
-# Operating System Files
-# =========================
-
-# OSX
-# =========================
-
-.DS_Store
-.AppleDouble
-.LSOverride
-
-# Thumbnails
-._*
-
-# Files that might appear in the root of a volume
-.DocumentRevisions-V100
-.fseventsd
-.Spotlight-V100
-.TemporaryItems
-.Trashes
-.VolumeIcon.icns
-
-# Directories potentially created on remote AFP share
-.AppleDB
-.AppleDesktop
-Network Trash Folder
-Temporary Items
-.apdisk

+ 0 - 21
HTequi-firmware/lib/TeensyStep-2.0.0/LICENCE

@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2017 Lutz Niggl
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.

+ 0 - 28
HTequi-firmware/lib/TeensyStep-2.0.0/README.md

@@ -1,28 +0,0 @@
-# TeensyStep V2 - Fast Stepper Library for PJRC Teensy boards
-
-Please note: This is version 2 of the library. This version has a new user interface. The version 1 is still available in the branch [Version-1](https://github.com/luni64/TeensyStep/tree/Version-1).
-
-
-## Detailed Documentation can be found here [https://luni64.github.io/TeensyStep/](https://luni64.github.io/TeensyStep/)
-
-
-## Purpose of the Library
-**TeensyStep** is an efficient Arduino library compatible with Teensy 3.0, 3.1, 3.2, 3.5 and 3.6. The library is able to handle synchronous and independent movement and continuous rotation of steppers with pulse rates of up to 300'000 steps per second. The following table shows a summary of the **TeensyStep** specification:
-
-| Description                                | Specification             | Default          |
-|:-------------------------------------------|:-------------------------:|:----------------:|
-| Motor speed / pulse rate                   |1 - 300'000 stp/s          |   800 stp/s      |
-| Acceleration                               | 0 - 500'000 stp/s^2       |   2500 stp/s^2   |
-| Pull in speed                              | 50-10'000 stp/s           | 100 stp/s |
-| Synchronous movement of motors             | up to 10                  | -                |
-| Independent movement of motors             | 4 groups of 1 to 10 motors| -                |
-| Settable step pulse polarity               | Active HIGH or LOW        | Active HIGH      |
-| Settable step pulse width                  | 1-100µs                   | 5µs              |
-| Settable direction signal polarity         | cw / ccw                  | cw               |
-
-Here a quick demonstration video showing two motors running in sync with 160'000 steps/sec
-
-<a href="http://www.youtube.com/watch?feature=player_embedded&v=Fzt75I_Zi14
-" target="_blank"><img src="http://img.youtube.com/vi/Fzt75I_Zi14/0.jpg" 
-alt="IMAGE ALT TEXT HERE" width="600" height="450" border="10" /></a>
-

+ 0 - 77
HTequi-firmware/lib/TeensyStep-2.0.0/examples/Applications/Winder/Winder.cpp

@@ -1,77 +0,0 @@
-#include "Winder.h"
-
-Winder::Winder(Stepper &_spindle, Stepper &_feeder)
-    : spindle(_spindle), feeder(_feeder), feederCtrl(5, 1000), spindleCtrl(5, 1000)
-{    
-}
-
-Winder& Winder::setSpindleParams(unsigned stepsPerRev, unsigned acc)
-{
-    spindleStpPerRev = stepsPerRev;
-    spindleAcc =  acc;
-
-    spindle.setMaxSpeed(1);   // -> parameter of overrideSpeed equals real speed
-    spindle.setAcceleration(spindleAcc);
-
-    oldSpindleSpeed = 0.0f;
-    oldPitch = 1.0f;
-   
-    return *this;
-}
-
-Winder& Winder::setFeederParams(unsigned stpPerMM, unsigned acc)
-{
-    feederStpPerMM = stpPerMM;
-    feederAcc = acc;
-
-    feeder.setMaxSpeed(1); 
-    feeder.setAcceleration(spindleAcc);
-
-    return *this;
-}
-
-void Winder::begin() 
-{
-    pitchFactor = (float)feederStpPerMM / spindleStpPerRev;
-    
-    // startup controllers   
-    feederCtrl.rotateAsync(feeder);
-    feederCtrl.overrideSpeed(0.0f);
-    
-    spindleCtrl.rotateAsync(spindle);
-    spindleCtrl.overrideSpeed(0.0f);   
-}
-
-void Winder::setSpindleSpeed(float rpm)
-{
-    targetSpindleSpeed = rpm / 60.0f * spindleStpPerRev;
-}
-
-void Winder::setPitch(float pitch)
-{
-    if(pitch > 0) targetPitch = pitch;
-}
-
-void Winder::updateSpeeds()
-{   
-    float targetFeederSpeed =  targetPitch * pitchFactor * targetSpindleSpeed;
-
-    if(targetSpindleSpeed != oldSpindleSpeed)  // if target speed changed -> update all
-    {
-        oldSpindleSpeed = targetSpindleSpeed;
-
-        float feederAccFactor = targetPitch * pitchFactor;
-
-        //Serial.println(feederAccFactor);
-
-        feederCtrl.overrideAcceleration(feederAccFactor);
-        feederCtrl.overrideSpeed(targetFeederSpeed);
-        spindleCtrl.overrideSpeed(targetSpindleSpeed);
-    }
-    else if(targetPitch != oldPitch)           // if only target pitch changed, update feeder speed only
-    {        
-        oldPitch = targetPitch;
-        feederCtrl.overrideAcceleration(feederAcc / spindleAcc);
-        feederCtrl.overrideSpeed(targetFeederSpeed);
-    }
-}

+ 0 - 34
HTequi-firmware/lib/TeensyStep-2.0.0/examples/Applications/Winder/Winder.h

@@ -1,34 +0,0 @@
-#pragma once
-
-#include "TeensyStep.h"
- 
-class Winder
-{
-public:
-    Winder(Stepper &spindle, Stepper &feeder);
-
-    void begin();
-
-    Winder &setSpindleParams(unsigned stpPerRev, unsigned acceleration);  // steps per spindle revolution & acceleration in stp/s^2
-    Winder &setFeederParams(unsigned stpPerMM, unsigned acceleration);    // steps to move the feeder 1mm, acceleration for pitch trimming 
-
-    void setSpindleSpeed(float rpm);  // changes the spindle speed to the given rpm
-    void setPitch(float pitch_in_mm); // changes the winder pitch to the given value
-    void updateSpeeds();
-
-    inline int getCurSpindleSpeed() { return spindleCtrl.isRunning() ? spindleCtrl.getCurrentSpeed() : 0; }
-    inline int getCurFeederSpeed() { return feederCtrl.isRunning() ? feederCtrl.getCurrentSpeed() : 0; }
-    inline float getCurPitch(){return (float)getCurFeederSpeed()/getCurSpindleSpeed()/pitchFactor; }
-
-protected:
-    Stepper &spindle;
-    Stepper &feeder;
-
-    unsigned spindleStpPerRev, spindleAcc, feederStpPerMM, feederAcc;
-    float pitchFactor;
-
-    float targetSpindleSpeed, targetPitch;
-    float oldSpindleSpeed, oldPitch;
-
-    RotateControl feederCtrl, spindleCtrl;
-};

+ 0 - 77
HTequi-firmware/lib/TeensyStep-2.0.0/examples/Applications/Winder/Winder.ino

@@ -1,77 +0,0 @@
-#include "Encoder.h"
-#include "TeensyStep.h"
-#include "Winder.h"
-
-constexpr unsigned feederStpPerMM = 200 * 8 * 5.0f * 0.8f; // e.g. fullstep/rev * microstepping * leadscrew pitch * gearRatio
-constexpr unsigned spindleStpPerRev = 200 * 16;            // e.g. fullstep/rev * microstepping
-constexpr unsigned spindleAcceleration = 15000;
-
-Stepper spindle(0, 1);
-Stepper feeder(2, 3);
-Winder winder(spindle, feeder); 
-
-float pitch = 0.2; //mm
-
-Encoder trimmer(5, 6);
-int oldTrimmerVal = 0;
-
-IntervalTimer printTimer;                                  // used to print out current speeds in the background
-
-void setup()
-{
-  while (!Serial && millis() < 500);
-
-  // setup background printing
-  printTimer.begin(printCurrent, 25000);
-  printTimer.priority(255); // lowest priority, we don't want to disturb stepping
-
-  // setup the winder
-  winder
-      .setSpindleParams(spindleStpPerRev, spindleAcceleration)
-      .setFeederParams(feederStpPerMM, 50000)
-      .begin();
-
-  // startup the winder
-  winder.setSpindleSpeed(600); // spindle speed in rpm
-  winder.setPitch(0.2f);       // pitch in mm
-  winder.updateSpeeds();       // apply new settings
-  delay(3000);
-}
-
-void loop()
-{
-  // read in the trimmer and adjust the pitch (+/- 0.01 per encoder detent)
-  int trimmerVal = trimmer.read(); 
-  if (trimmerVal != oldTrimmerVal)
-  {
-    oldTrimmerVal = trimmerVal;
-    pitch = 0.2f + trimmerVal / 400.0f;  // e.g. 0.01 per 4 encoder steps
-    winder.setPitch(pitch);
-    winder.updateSpeeds();
-  }
-
-  if (millis() > 15000)                 // stop the spindle after 15s
-  {
-    winder.setSpindleSpeed(0);
-    winder.updateSpeeds();
-    while (1)
-      yield();                          // stop sketch here
-  }
-
-  delay(50);                            // dont overrun the winder by sending new values to often. 
-}
-
-// helpers ----------------------------------------------
-
-void printCurrent()
-{
-  unsigned t = millis();
-  unsigned feederSpeed = winder.getCurFeederSpeed();
-  unsigned spindleSpeed = winder.getCurSpindleSpeed();
-  float curPitch = winder.getCurPitch();
-
-  if (spindleSpeed != 0 || feederSpeed != 0)
-  {
-      Serial.printf("%d\t%i\t%i\t%.3f\t%.3f\n", t, spindleSpeed, feederSpeed, curPitch, pitch);     
-  }
-}

+ 0 - 1
HTequi-firmware/lib/TeensyStep-2.0.0/examples/Applications/Winder/readme.md

@@ -1 +0,0 @@
-To be done

+ 0 - 33
HTequi-firmware/lib/TeensyStep-2.0.0/examples/HelloStepper/HelloStepper.ino

@@ -1,33 +0,0 @@
-/*==========================================================================
- * This is a minimal sketch showing the usage of TeensyStep
- *  
- * STEP Pulses on Pin 2    (can be any pin)
- * DIR  Signall on Pin 3   (can be any pin)
- * 
- * The target position is set to 1000 steps relative to the
- * current position. The move command of the controller 
- * moves the motor to the target position.  
- *  
- * Default parameters are 
- * Speed:          800 steps/s
- * Acceleration:  2500 steps/s^2
- * 
- * (slow, but good to start with since they will work on any normal stepper)
- *
- ===========================================================================*/
-
-#include "TeensyStep.h"
-
-Stepper motor(2, 3);       // STEP pin: 2, DIR pin: 3
-StepControl controller;    // Use default settings 
-
-void setup()
-{
-}
-
-void loop() 
-{
-  motor.setTargetRel(1000);  // Set target position to 1000 steps from current position
-  controller.move(motor);    // Do the move
-  delay(500);
-}

+ 0 - 147
HTequi-firmware/lib/TeensyStep-2.0.0/examples/Interfacing/Interfacing.ino

@@ -1,147 +0,0 @@
-/*----------------------------------------------------------
-This example demonstrates how to use the serial interface and
-digital IO while the controller moves a motor in
-the background.
-
-The following serial commands are implemented
-   m: move motor
-   s: start stop sequence
-   e: emergency stop
-   h: help
-
-Additionally a pin can be used to stop the motor
-
-------------------------------------------------------------*/
-#include "TeensyStep.h"
-
-// stepper and  controller
-constexpr int stpPin = 0, dirPin = 1;
-Stepper motor(stpPin, dirPin);
-StepControl controller;
-
-// pin to stop the motor, connect a push button to this pin
-constexpr int stopPin = 2;
-
-// stopwatches 
-elapsedMillis displayStopwatch = 0;  // timing the display of the current position
-elapsedMillis blinkStopwatch = 0;    // timing the heartbeat LED
-elapsedMillis debounceTimer = 0;     // debouncing input pins
-
-int lastPos = 0;
-
-void handlePins();
-void handleCommands();
-
-void setup()
-{
-    while (!Serial);
-    Serial.println("Simple Serial Stepper Example");    
-    Serial.println("(type h for help)");
-    
-
-    motor.setMaxSpeed(5000);
-    motor.setAcceleration(50000);
-
-    pinMode(LED_BUILTIN, OUTPUT);
-    pinMode(stopPin, INPUT_PULLUP);  // touch the pin with GND to stop the motor
-}
-
-
-void loop()
-{
-    // handle incomming commands on the serial interface ------------------
-    handleCommands();
-
-    // handle input from pins ---------------------------------------------
-    handlePins();
-
-    // display the current motor position every 20ms ----------------------
-    if (displayStopwatch > 20)
-    {
-        displayStopwatch = 0;
-
-        int currentPos = motor.getPosition();
-        if (currentPos != lastPos)  // only display if it changed
-        {
-            lastPos = currentPos;
-            Serial.println(currentPos);
-        }
-    }
-
-    // the usual heartbeat ------------------------------------------------
-    if (blinkStopwatch > 250)
-    {
-        blinkStopwatch = 0;
-        digitalWriteFast(LED_BUILTIN, !digitalReadFast(LED_BUILTIN)); // toggle LED
-    }
-}
-
-
-//------------------------------------------------
-// Very simple command interface on USB-Serial:
-// m : starts the motor
-// s : starts stop sequence
-// e : emergency stop
-
-void handleCommands()
-{
-    if (Serial.available() > 0)                 // skip if the serial buffer is empty
-    {
-        char cmd = Serial.read();               // get one char from the buffer...
-        switch (cmd)                            // ... and analyze it
-        {
-        case 'm':                               // move command
-            if (!controller.isRunning())        // skip move command if motor is running already
-            {
-                motor.setTargetRel(20000);
-                controller.moveAsync(motor);
-                Serial.println("Started motor movement");
-            }
-            else
-            {
-                Serial.println("Ignored, motor is already running");
-            }
-            break;
-
-        case 's':                               // stop command
-            controller.stopAsync();             // initiate stopping procedure
-            Serial.println("Stopping motor");
-            break;
-
-        case 'e':                               // emergency stop command
-            controller.emergencyStop();
-            Serial.println("Emergency Stop");
-            break;
-
-        case 'h':                               // help / usage command
-        case 'u':
-            Serial.println("\nUsage:");
-            Serial.println("  m: move motor");
-            Serial.println("  s: start stop sequence");
-            Serial.println("  e: emergency stop");
-            Serial.println("  h: display this help");            
-            break;
-
-        default:
-            break;
-        }
-    }
-}
-
-
-//------------------------------------------------
-// Connect a pushbutton to the stop pin. 
-// Stop command will be issued when pin is 
-// pulled to GND.
-// Only very simple debouncing implemented. Use "debounce2.h" or 
-// similar for a real application
-
-void handlePins()
-{    
-    if (controller.isRunning() && !digitalReadFast(stopPin) && debounceTimer > 200)
-    {
-        debounceTimer = 0;                   
-        controller.stopAsync();              // initiate stopping procedure
-        Serial.println("Stopping motor");
-    }
-}

+ 0 - 75
HTequi-firmware/lib/TeensyStep-2.0.0/examples/MultipleSteppers/MultipleSteppers.ino

@@ -1,75 +0,0 @@
-/*==========================================================================
- * The sketch shows how to move more than one motor. 
- * 
- * If more than one motor is moved by one controller all motors will arrive at 
- * their targets at the same time. E.g., if the motors are part of a 
- * x/y transport system, the transport move on a straight diagonal line to the
- * target coordinates.
- * 
- * The sketch also shows examples how the motor properties are set up
- *
- * A 1/16 microstep driver is assumed. You probably want to adjust speed, 
- * acceleration and distances if you are using a driver with another microstep 
- * resolution.
- ===========================================================================*/
-
-#include "TeensyStep.h"
-
-Stepper motor_1(2, 3);   //STEP pin =  2, DIR pin = 3
-Stepper motor_2(9,10);   //STEP pin =  9, DIR pin = 10
-Stepper motor_3(14,15);  //STEP pin = 14, DIR pin = 15
-
-StepControl controller;
-
-void setup()
-{
-  // setup the motors 
-   motor_1
-    .setMaxSpeed(50000)       // steps/s
-    .setAcceleration(200000); // steps/s^2 
-  
-  motor_2
-    .setMaxSpeed(50000)       // steps/s
-    .setAcceleration(200000); // steps/s^2 
-  motor_3
-    //.setPullInSpeed(300)      // steps/s     currently deactivated...
-    .setMaxSpeed(10000)       // steps/s
-    .setAcceleration(50000)   // steps/s^2     
-    .setStepPinPolarity(LOW); // driver expects active low pulses
-}
-
-void loop() 
-{  
-  constexpr int spr = 16*200;  // 3200 steps per revolution
-  
-  // lets shake    
-  for(int i = 0; i < 5; i++)
-  {
-    motor_1.setTargetRel(spr/4); // 1/4 revolution
-    controller.move(motor_1);  
-
-    motor_1.setTargetRel(-spr/4);
-    controller.move(motor_1);  
-  }
-  delay(500);
-  
-  // move motor_1 to absolute position (10 revolutions from zero)
-  // move motor_2 half a revolution forward  
-  // both motors will arrive their target positions at the same time
-  motor_1.setTargetAbs(10*spr);
-  motor_2.setTargetRel(spr/2);
-  controller.move(motor_1, motor_2);
-
-  // now move motor_2 together with motor_3
-  motor_2.setTargetRel(300);
-  motor_3.setTargetRel(-800);
-  controller.move(motor_2, motor_3);
-
-  // move all motors back to their start positions
-  motor_1.setTargetAbs(0);
-  motor_2.setTargetAbs(0);
-  motor_3.setTargetAbs(0);
-  controller.move(motor_1, motor_2, motor_3);
- 
-  delay(1000);
-}

+ 0 - 97
HTequi-firmware/lib/TeensyStep-2.0.0/examples/Path_Following/RoseFunctionFollower/RoseFunctionFollower.ino

@@ -1,97 +0,0 @@
-#include "Arduino.h"
-#include "TeensyStep.h"
-
-//spindle settings
-constexpr unsigned rpm = 15;
-constexpr unsigned spindleSPR = 6400;                    // stp per rev
-constexpr unsigned spindleSpeed = rpm * spindleSPR / 60; // stp/sec
-constexpr unsigned spindleStepPin = 1;
-constexpr unsigned spindleDirPin = 2;
-
-//slide settings
-constexpr unsigned slideAmplitude = 10000; // stp
-constexpr unsigned slideSpeed = 35000;     //stp/sec
-constexpr unsigned slideStepPin = 3;
-constexpr unsigned slideDirPin = 4;
-
-//accuracy
-IntervalTimer tickTimer;
-constexpr unsigned recalcPeriod = 25'000; //µs  period for calculation of new target points. Straight lines between those points.
-constexpr float dt = recalcPeriod / 1E6;  // seconds
-
-// rose fuction
-constexpr int n = 5;
-constexpr int d = 8;
-constexpr float k = (float)n / d;
-
-float slideFunc(float spindleAngle)
-{
-  float phi = fmodf(spindleAngle * k, TWO_PI);
-  return slideAmplitude * cosf(phi);
-}
-
-// TeensyStep
-RotateControl slideController;
-RotateControl spindleController;
-
-Stepper spindle(spindleStepPin, spindleDirPin);
-Stepper slide(slideStepPin, slideDirPin);
-
-
-//------------------------------------------------------------------------------------
-// tick()
-//
-// This function is called periodically with period recalcPeriod. 
-// It calculates 
-//  1) a new target value for the slide depending on the spindle angle
-//  2) the new speed for the spindle so that it will reach the target until it is called again
-
-void tick()
-{
-  float spindleAngle = spindle.getPosition() * (TWO_PI / spindleSPR); //convert steps to angle
-  float slidePosition = slide.getPosition();
-  float slideTarget = slideFunc(spindleAngle);
-
-  float newSpeed = (slideTarget - slidePosition) / dt; // speed to reach target in given delta t (neglecting acceleration)
-  float speedFac = newSpeed / slideSpeed;              // transform in relative factor (-1.0 .. 1.0)
-
-  slideController.overrideSpeed(speedFac);             // set new speed
-}
-
-void setup()
-{
-  pinMode(LED_BUILTIN, OUTPUT);
- 
-  while (!Serial && millis() < 1000);
-
-  spindle
-      .setMaxSpeed(spindleSpeed)
-      .setAcceleration(50000);
-
-  slide
-      .setMaxSpeed(slideSpeed)
-      .setAcceleration(150000)
-      .setPosition(slideFunc(0)); // set start position of counter
-
-  spindleController.rotateAsync(spindle); // let the spindle run with constant speed
-  slideController.rotateAsync(slide);
-  slideController.overrideSpeed(0); // start with stopped slide
-  tick();
-
-  // use a timer to periodically calculate new targets for the slide
-  tickTimer.priority(255); // lowest priority, potentially long caclulations need to be interruptable by TeensyStep
-  tickTimer.begin(tick, recalcPeriod);
-}
-
-void loop()
-{
-  digitalWriteFast(LED_BUILTIN, !digitalReadFast(LED_BUILTIN));
-
-  // print current values of spindle angle [rad] and slide position [steps]
-  float phi = spindle.getPosition() * (TWO_PI / spindleSPR);
-  int32_t r = slide.getPosition();
-
-  Serial.printf("%f\t%d\n", phi, r);
-
-  delay(20);
-}

+ 0 - 37
HTequi-firmware/lib/TeensyStep-2.0.0/examples/StepperArray/StepperArray.ino

@@ -1,37 +0,0 @@
-#include <TeensyStep.h>
-
-Stepper M1(0, 1), M2(2, 3), M3(4, 5), M4(6, 7), M5(8, 9), M6(10, 11); // create 6 motors
-StepControl controller;
-
-void setup() 
-{
-  pinMode(LED_BUILTIN,OUTPUT);
-  delay(100);
-  
-  Stepper* motorSet_A[] = {&M1, &M2, &M5, &M6  };  // define an array of pointers to motors 1,2,5 and 6
-  M1.setTargetAbs(200);                            // set targets for the motors
-  M2.setTargetAbs(-500);   
-  M5.setTargetAbs(-100);
-  M6.setTargetAbs(30);  
-  controller.move(motorSet_A);                     // move all motors in the array to their targets
-
-  delay(500);                                      // just to generate a nice output on the logic analyzer
- 
-  Stepper* motorSet_B[] = {&M1, &M3, &M4};         // another set of motors;
-  M1.setTargetAbs(-110);
-  M3.setTargetAbs(50);   
-  M4.setTargetAbs(230);
-  controller.move(motorSet_B);                     // move set B to target
-
-  delay(500);                                      // just to generate a nice output on the logic analyzer
- 
-  for (int i = 0; i < 4; i++) {                    // loop through all motors in motorSet_A...
-    motorSet_A[i]->setTargetAbs(0);                // ... set targets to 0...
-  }
-  controller.move(motorSet_A);                     // ... and move home
-}
-
-void loop(){
-  digitalWriteFast(LED_BUILTIN,!digitalReadFast(LED_BUILTIN));
-  delay(100);
-}

+ 0 - 3
HTequi-firmware/lib/TeensyStep-2.0.0/examples/StepperArray/readme.md

@@ -1,3 +0,0 @@
-This example shows the usage of more than 3 motors. Here a screenshot of the step pulses generated by the sketch.
-
-![Alt text](/media/stepperArray.png?raw=true "Sketch output")

+ 0 - 19
HTequi-firmware/lib/TeensyStep-2.0.0/keywords.txt

@@ -1,19 +0,0 @@
-########################################################
-# Syntax Coloring Map for SparkFun LSM6DS3 IMU Library #
-########################################################
-# Class
-###################################################################
-
-
-###################################################################
-# Methods and Functions
-###################################################################
-
-begin	KEYWORD2
-Trigger	KEYWORD2
-AddChannel	KEYWORD2
-
-###################################################################
-# Constants
-###################################################################
-

+ 0 - 21
HTequi-firmware/lib/TeensyStep-2.0.0/library.json

@@ -1,21 +0,0 @@
-{
-  "name": "TeensyStep",
-  "keywords": "teensy, stepper, motor, high-speed",
-  "description": "High speed stepper driver for teensy boards (T3.0 - T3.6)",
-  "repository":
-  {
-    "type": "git",
-    "url": "https://github.com/luni64/TeensyStep"
-  },
-  "authors":
-  {
-    "name": "Lutz Niggl",
-    "email": "lutz.niggl@lunoptics.com",
-    "url": "https://github.com/luni64",
-    "maintainer": true
-  },
-  "homepage": "https://luni64.github.io/TeensyStep",
-  "version": "2.0.0",
-  "frameworks": "arduino",
-  "platforms": "Teensy"
-}

+ 0 - 10
HTequi-firmware/lib/TeensyStep-2.0.0/library.properties

@@ -1,10 +0,0 @@
-name=TeensyStep
-version=2.0.0
-author=Lutz Niggl <lutz.niggl@lunoptics.com>
-maintainer=Lutz Niggl <lutz.niggl@lunoptics.com>
-sentence=High speed stepper driver for PJRC Teensy boards (T3.0 - T3.6)
-paragraph= Step rates up to 300000stp/sec. Accelerated and synchronized movement of up to 10 steppers. Due to the low processor load it can easily be used togehter with sensors, displays, serial communication ...
-category=Device Control
-url=https://luni64.github.io/TeensyStep/
-architectures=*
-includes=TeensyStep.h

BIN
HTequi-firmware/lib/TeensyStep-2.0.0/media/indMove.png


BIN
HTequi-firmware/lib/TeensyStep-2.0.0/media/load_calculation.PNG


BIN
HTequi-firmware/lib/TeensyStep-2.0.0/media/load_calculation.xlsx


BIN
HTequi-firmware/lib/TeensyStep-2.0.0/media/seqMove.png


BIN
HTequi-firmware/lib/TeensyStep-2.0.0/media/stepperArray.png


BIN
HTequi-firmware/lib/TeensyStep-2.0.0/media/sycMove.png


+ 0 - 148
HTequi-firmware/lib/TeensyStep-2.0.0/src/MotorControlBase.h

@@ -1,148 +0,0 @@
-#pragma once
-
-#include "timer/TF_Handler.h"
-#include "Stepper.h"
-
-constexpr int MaxMotors = 10;
-
-template <typename TimerField>
-class MotorControlBase : TF_Handler
-{
-public:
-  bool isRunning();
-  inline int getCurrentSpeed()
-  {
-    return timerField.getStepFrequency();
-  }
-
-  void emergencyStop() { timerField.stepTimerStop();}
-
-  virtual ~MotorControlBase();
-  bool isOk() const { return OK; }
-
-protected:
-  TimerField timerField;
-  MotorControlBase(unsigned pulseWidth, unsigned accUpdatePeriod);
-
-  template <size_t N>
-  void attachStepper(Stepper *(&motors)[N]);
-  template <typename... Steppers>
-  void attachStepper(Stepper &stepper, Steppers &... steppers);
-  void attachStepper(Stepper &stepper);
-
-  void stepTimerISR();
-  //void accTimerISR() { Serial.println("df"); }
-  void pulseTimerISR();
-
-  Stepper *motorList[MaxMotors + 1];
-  Stepper *leadMotor;
-
-  void (*callback)() = nullptr;
-
-  bool OK = false;
-
-  unsigned mCnt;
-
-  enum class Mode
-  {
-    target,
-    notarget
-  } mode = Mode::notarget;
-
-  uint32_t accUpdatePeriod;
-  uint32_t pulseWidth;
-
-  MotorControlBase(const MotorControlBase &) = delete;
-  MotorControlBase &operator=(const MotorControlBase &) = delete;
-};
-
-// Implementation ============================================================================
-
-template <typename t>
-bool MotorControlBase<t>::isRunning()
-{
-  return timerField.stepTimerIsRunning();
-}
-
-template <typename t>
-MotorControlBase<t>::MotorControlBase(unsigned pulseWidth, unsigned accUpdatePeriod)
-    : timerField(this), mCnt(0)
-{
-  OK = timerField.begin();
-  timerField.setPulseWidth(pulseWidth);
-  timerField.setAccUpdatePeriod(accUpdatePeriod);
-  this->accUpdatePeriod = accUpdatePeriod;
-  this->pulseWidth = pulseWidth;
-}
- 
-template <typename t>
-MotorControlBase<t>::~MotorControlBase()
-{
-  if(OK)  emergencyStop();  
-}
-
-template <typename t>
-void MotorControlBase<t>::stepTimerISR()
-{
-  leadMotor->doStep(); // move master motor
-
-  Stepper **slave = motorList;
-  while (*(++slave) != nullptr) // move slave motors if required (https://en.wikipedia.org/wiki/Bresenham)
-  {
-    if ((*slave)->B >= 0)
-    {
-      (*slave)->doStep();
-      (*slave)->B -= leadMotor->A;
-    }
-    (*slave)->B += (*slave)->A;
-  }
-  timerField.triggerDelay(); // start delay line to dactivate all step pins
-
-  if (mode == Mode::target && (leadMotor->current == leadMotor->target)) // stop timer and call callback if we reached target
-  {
-    timerField.stepTimerStop();
-    if (callback != nullptr)
-      callback();
-  }
-}
-
-template <typename t>
-void MotorControlBase<t>::pulseTimerISR()
-{
-  Stepper **motor = motorList;
-  while ((*motor) != nullptr)
-  {
-    (*motor++)->clearStepPin();
-  }
-}
-
-template <typename t>
-void MotorControlBase<t>::attachStepper(Stepper &stepper)
-{
-  motorList[mCnt++] = &stepper;
-  motorList[mCnt] = nullptr;
-  mCnt = 0;
-}
-
-template <typename t>
-template <typename... Steppers>
-void MotorControlBase<t>::attachStepper(Stepper &stepper, Steppers &... steppers)
-{
-  static_assert(sizeof...(steppers) < MaxMotors, "Too many motors used. Please increase MaxMotors in file MotorControlBase.h");
-
-  motorList[this->mCnt++] = &stepper;
-  attachStepper(steppers...);
-}
-
-template <typename t>
-template <size_t N>
-void MotorControlBase<t>::attachStepper(Stepper *(&motors)[N])
-{
-  static_assert(N <= MaxMotors, "Too many motors used. Please increase MaxMotors in file MotorControlBase.h");
-
-  for (size_t i = 0; i < N; i++)
-  {
-    this->motorList[i] = motors[i];
-  }
-  this->motorList[N] = nullptr;
-}

+ 0 - 152
HTequi-firmware/lib/TeensyStep-2.0.0/src/RotateControlBase.h

@@ -1,152 +0,0 @@
-#pragma once
-
-#include "MotorControlBase.h"
-#include <algorithm>
-#include "core_pins.h"
-
-template <typename Accelerator, typename TimerField>
-class RotateControlBase : public MotorControlBase<TimerField>
-{
-  public:
-    RotateControlBase(unsigned pulseWidth = 5, unsigned accUpdatePeriod = 5000);    
-
-    // Non-blocking movements ----------------
-    template <typename... Steppers>
-    void rotateAsync(Steppers &... steppers);
-   
-    template <size_t N>
-    void rotateAsync(Stepper *(&motors)[N]);
-
-    void stopAsync();
-
-     void emergencyStop() {
-         accelerator.eStop();
-         this->timerField.stepTimerStop();
-     }
-
-     // Blocking movements --------------------
-     void stop();
-
-     void overrideSpeed(float speedFac);
-     void overrideAcceleration(float accFac);
-
- protected:
-     void doRotate(int N, float speedFactor = 1.0);
-     void accTimerISR();
-
-     Accelerator accelerator;
-
-     RotateControlBase(const RotateControlBase &) = delete;
-     RotateControlBase &operator=(const RotateControlBase &) = delete;
-};
-
-// Implementation *************************************************************************************************
-
-template <typename a, typename t>
-RotateControlBase<a, t>::RotateControlBase(unsigned pulseWidth, unsigned accUpdatePeriod)
-    : MotorControlBase<t>(pulseWidth, accUpdatePeriod)
-{
-    this->mode = MotorControlBase<t>::Mode::notarget;
-}
-
-template <typename a, typename t>
-void RotateControlBase<a, t>::doRotate(int N, float speedFactor)
-{
-     //Calculate Bresenham parameters ----------------------------------------------------------------
-    std::sort(this->motorList, this->motorList + N, Stepper::cmpVmax);
-    this->leadMotor = this->motorList[0];
-
-    if (this->leadMotor->vMax == 0)
-        return;
-
-    this->leadMotor->currentSpeed = 0; 
-
-    this->leadMotor->A = std::abs(this->leadMotor->vMax);
-    for (int i = 1; i < N; i++)
-    {
-        this->motorList[i]->A = std::abs(this->motorList[i]->vMax);
-        this->motorList[i]->B = 2 * this->motorList[i]->A - this->leadMotor->A;
-    }
-    uint32_t acceleration = (*std::min_element(this->motorList, this->motorList + N, Stepper::cmpAcc))->a; // use the lowest acceleration for the move
-    
-    // Start moving---------------------------------------------------------------------------------------  
-    accelerator.prepareRotation(this->leadMotor->current, this->leadMotor->vMax, acceleration, this->accUpdatePeriod, speedFactor);
-    this->timerField.setStepFrequency(0);    
-    this->timerField.accTimerStart();    
-}
-
-// ISR -----------------------------------------------------------------------------------------------------------
-
-template <typename a, typename t>
-void RotateControlBase<a, t>::accTimerISR()
-{   
-    int32_t newSpeed = accelerator.updateSpeed(this->leadMotor->current); // get new speed for the leading motor
-     
-    //Serial.printf("rc,curSpeed: %i newspd:%i\n",this->leadMotor->currentSpeed,  newSpeed);
-
-    if (this->leadMotor->currentSpeed == newSpeed)
-    {         
-        return; // nothing changed, just keep running
-    }
-
-    int dir = newSpeed >= 0 ? 1 : -1; // direction changed? -> toggle direction of all motors
-    if (dir != this->leadMotor->dir)
-    {
-        Stepper **motor = this->motorList;
-        while ((*motor) != nullptr)
-        {
-            (*motor++)->toggleDir();
-        }
-        delayMicroseconds(this->pulseWidth);
-    }
-    
-    
-    this->timerField.setStepFrequency(std::abs(newSpeed)); // speed changed, update timer    
-    this->leadMotor->currentSpeed = newSpeed;   
-}
-
-// ROTATE Commands -------------------------------------------------------------------------------
-
-template <typename a, typename t>
-template <typename... Steppers>
-void RotateControlBase<a, t>::rotateAsync(Steppers &... steppers)
-{
-    this->attachStepper(steppers...);
-    doRotate(sizeof...(steppers));
-}
-
-template <typename a, typename t>
-template <size_t N>
-void RotateControlBase<a, t>::rotateAsync(Stepper *(&steppers)[N]) 
-{
-    this->attachStepper(steppers);
-    doRotate(N);
-}
-
-template <typename a, typename t>
-void RotateControlBase<a, t>::overrideSpeed(float factor)
-{
-    accelerator.overrideSpeed(factor);
-}
-
-template <typename a, typename t>
-void RotateControlBase<a, t>::overrideAcceleration(float factor)
-{
-    accelerator.overrideAcceleration(factor);
-}
-
-template <typename a, typename t>
-void RotateControlBase<a, t>::stopAsync()
-{
-    accelerator.initiateStopping(this->leadMotor->current);
-}
-
-template <typename a, typename t>
-void RotateControlBase<a, t>::stop()
-{
-    stopAsync();
-    while (this->isRunning())
-    {
-        delay(1);
-    }
-}

+ 0 - 143
HTequi-firmware/lib/TeensyStep-2.0.0/src/StepControlBase.h

@@ -1,143 +0,0 @@
-#pragma once
-
-#include "MotorControlBase.h"
-#include <algorithm>
-
-template <typename Accelerator, typename TimerField>
-class StepControlBase : public MotorControlBase<TimerField>
-{
-public:
-    StepControlBase(unsigned pulseWidth = 5, unsigned accUpdatePeriod = 5000);
-
-    // Non-blocking movements ----------------
-    template <typename... Steppers>
-    void moveAsync(Steppers &... steppers);
-
-    template <size_t N>
-    void moveAsync(Stepper *(&motors)[N]);
-    void stopAsync();
-
-    // Blocking movements --------------------
-    template <typename... Steppers>
-    void move(Steppers &... steppers);
-
-    template <size_t N>
-    void move(Stepper *(&motors)[N]);
-    void stop();
-
-    // Misc ----------------------------------
-    void setCallback(void (*_callback)()) { this->callback = _callback; }
-
-protected:
-    void accTimerISR();
-
-    void doMove(int N, bool mode = true);
-
-    Accelerator accelerator;
-
-    StepControlBase(const StepControlBase &) = delete;
-    StepControlBase &operator=(const StepControlBase &) = delete;
-};
-
-// Implementation *************************************************************************************************
-
-template <typename a, typename t>
-StepControlBase<a, t>::StepControlBase(unsigned pulseWidth, unsigned accUpdatePeriod)
-    : MotorControlBase<t>(pulseWidth, accUpdatePeriod)
-{
-    this->mode = MotorControlBase<t>::Mode::target;
-}
-
-template <typename a, typename t>
-void StepControlBase<a, t>::doMove(int N, bool move)
-{
-    //Calculate Bresenham parameters ----------------------------------------------------------------
-    std::sort(this->motorList, this->motorList + N, Stepper::cmpDelta); // The motor which does most steps leads the movement, move to top of list
-    this->leadMotor = this->motorList[0];
-
-    for (int i = 1; i < N; i++)
-    {
-        this->motorList[i]->B = 2 * this->motorList[i]->A - this->leadMotor->A;
-    }
-
-    // Calculate acceleration parameters --------------------------------------------------------------
-    uint32_t targetSpeed = std::abs((*std::min_element(this->motorList, this->motorList + N, Stepper::cmpVmin))->vMax); // use the lowest max frequency for the move, scale by relSpeed
-    uint32_t acceleration = (*std::min_element(this->motorList, this->motorList + N, Stepper::cmpAcc))->a;              // use the lowest acceleration for the move
-    if (this->leadMotor->A == 0 || targetSpeed == 0)
-        return;
-
-    // Start move---------------------------------------------------------------------------------------
-    this->timerField.setStepFrequency(accelerator.prepareMovement(this->leadMotor->current, this->leadMotor->target, targetSpeed, acceleration));
-    this->timerField.stepTimerStart();
-    this->timerField.accTimerStart();
-}
-
-// ISR -----------------------------------------------------------------------------------------------------------
-
-template <typename a, typename t>
-void StepControlBase<a, t>::accTimerISR()
-{
-    if (this->isRunning())
-    {
-        this->timerField.setStepFrequency(accelerator.updateSpeed(this->leadMotor->current));
-    }
-}
-
-// MOVE ASYNC Commands -------------------------------------------------------------------------------------------------
-
-template <typename a, typename t>
-template <typename... Steppers>
-void StepControlBase<a, t>::moveAsync(Steppers &... steppers)
-{
-    this->attachStepper(steppers...);
-    doMove(sizeof...(steppers));
-}
-
-template <typename a, typename t>
-template <size_t N>
-void StepControlBase<a, t>::moveAsync(Stepper *(&motors)[N]) //move up to maxMotors motors synchronously
-{
-    this->attachStepper(motors);
-    doMove(N);
-}
-
-// MOVE Commands -------------------------------------------------------------------------------------------------
-
-template <typename a, typename t>
-template <typename... Steppers>
-void StepControlBase<a, t>::move(Steppers &... steppers)
-{
-    moveAsync(steppers...);
-    while (this->timerField.stepTimerIsRunning())
-    {
-        delay(1);
-    }
-}
-
-template <typename a, typename t>
-template <size_t N>
-void StepControlBase<a, t>::move(Stepper *(&motors)[N])
-{
-    moveAsync(motors);
-    while (this->isRunning())
-    {
-        delay(1);
-    }
-}
-
-template <typename a, typename t>
-void StepControlBase<a, t>::stopAsync()
-{
-    uint32_t newTarget = accelerator.initiateStopping(this->leadMotor->current);
-    this->leadMotor->target = this->leadMotor->current + this->leadMotor->dir * newTarget;
-}
-
-template <typename a, typename t>
-void StepControlBase<a, t>::stop()
-{
-    stopAsync();
-    while (this->isRunning())
-    {
-        delay(1);
-    }
-}

+ 0 - 81
HTequi-firmware/lib/TeensyStep-2.0.0/src/Stepper.cpp

@@ -1,81 +0,0 @@
-#include "Stepper.h"
-#include "core_pins.h"
-
-Stepper::Stepper(const int _stepPin, const int _dirPin)
-    : current(0),  stepPin(_stepPin), dirPin(_dirPin)
-{
-    setStepPinPolarity(HIGH);
-    setInverseRotation(false);
-    setAcceleration(aDefault);
-    setMaxSpeed(vMaxDefault);
-
-    pinMode(stepPin, OUTPUT);
-    pinMode(dirPin, OUTPUT);
-}
-
-Stepper &Stepper::setStepPinPolarity(int polarity)
-{
-    // Calculate adresses of bitbanded pin-set and pin-clear registers
-    uint32_t pinRegAddr = (uint32_t)digital_pin_to_info_PGM[stepPin].reg; //GPIO_PDOR
-    uint32_t *pinSetReg = (uint32_t *)(pinRegAddr + 4 * 32);              //GPIO_PSOR = GPIO_PDOR + 4
-    uint32_t *pinClearReg = (uint32_t *)(pinRegAddr + 8 * 32);            //GPIO_PCOR = GPIO_PDOR + 8
-
-    // Assign registers according to step option
-    if (polarity == LOW)
-    {
-        stepPinActiveReg = pinClearReg;
-        stepPinInactiveReg = pinSetReg;
-    }
-    else
-    {
-        stepPinActiveReg = pinSetReg;
-        stepPinInactiveReg = pinClearReg;
-    }
-    clearStepPin(); // set step pin to inactive state
-    return *this;
-}
-
-Stepper &Stepper::setInverseRotation(bool reverse)
-{
-    // Calculate adresses of bitbanded pin-set and pin-clear registers
-    uint32_t pinRegAddr = (uint32_t)digital_pin_to_info_PGM[dirPin].reg; //GPIO_PDOR
-    uint32_t *pinSetReg = (uint32_t *)(pinRegAddr + 4 * 32);             //GPIO_PSOR = GPIO_PDOR + 4
-    uint32_t *pinClearReg = (uint32_t *)(pinRegAddr + 8 * 32);           //GPIO_PCOR = GPIO_PDOR + 8
-
-    if (reverse)
-    {
-        dirPinCwReg = pinClearReg;
-        dirPinCcwReg = pinSetReg;
-    }
-    else
-    {
-        dirPinCwReg = pinSetReg;
-        dirPinCcwReg = pinClearReg;
-    }
-    return *this;
-}
-
-Stepper &Stepper::setAcceleration(uint32_t a) // steps/s^2
-{
-    this->a = std::min(aMax, a);
-    return *this;
-}
-
-Stepper &Stepper::setMaxSpeed(int32_t speed)
-{
-    setDir(speed >= 0 ? 1 : -1);
-    vMax = std::min(vMaxMax, std::max(-vMaxMax, speed));
-    return *this;
-}
-
-void Stepper::setTargetAbs(int32_t target)
-{
-    setTargetRel(target - current);
-}
-
-void Stepper::setTargetRel(int32_t delta)
-{
-    setDir(delta < 0 ? -1 : 1);
-    target = current + delta;
-    A = std::abs(delta);
-}

+ 0 - 89
HTequi-firmware/lib/TeensyStep-2.0.0/src/Stepper.h

@@ -1,89 +0,0 @@
-#pragma once
-
-#include <cstdint>
-#include <algorithm>
-
-class Stepper
-{
-    static constexpr int32_t vMaxMax = 300000;   // largest speed possible (steps/s)
-    static constexpr uint32_t aMax = 500000;     // speed up to 500kHz within 1 s (steps/s^2)
-    static constexpr uint32_t vMaxDefault = 800; // should work with every motor (1 rev/sec in 1/4-step mode)
-    static constexpr uint32_t aDefault = 2500;   // reasonably low (~0.5s for reaching the default speed)
-
-  public:
-    Stepper(const int StepPin, const int DirPin);
-
-    Stepper &setMaxSpeed(int32_t speed);   // steps/s
-    Stepper &setAcceleration(uint32_t _a); // steps/s^2
-
-    Stepper &setStepPinPolarity(int p);  // HIGH -> positive pulses, LOW -> negative pulses
-    Stepper &setInverseRotation(bool b); // Change polarity of the dir pulse
-
-    void setTargetAbs(int32_t pos);   // Set target position absolute
-    void setTargetRel(int32_t delta); // Set target position relative to current position
-
-    inline int32_t getPosition() const { return current; }
-    inline void setPosition(int32_t pos) { current = pos; }
-    int32_t dir;
-
-  protected:
-    inline void doStep();
-    inline void clearStepPin() const;
-
-    inline void setDir(int d);
-    inline void toggleDir();
-
-    volatile int32_t current;
-    volatile int32_t currentSpeed; 
-    volatile int32_t target;
-
-    int32_t A, B; // Bresenham paramters
-    int32_t vMax;
-    uint32_t a;
-
-    // compare functions
-    static bool cmpDelta(const Stepper *a, const Stepper *b) { return a->A > b->A; }
-    static bool cmpAcc(const Stepper *a, const Stepper *b) { return a->a < b->a; }
-    static bool cmpVmin(const Stepper *a, const Stepper *b) { return std::abs(a->vMax) < std::abs(b->vMax); }
-    static bool cmpVmax(const Stepper *a, const Stepper *b) { return std::abs(a->vMax) > std::abs(b->vMax); }
-
-    // Pin & Dir registers
-    volatile uint32_t *stepPinActiveReg;
-    volatile uint32_t *stepPinInactiveReg;
-    volatile uint32_t *dirPinCwReg;
-    volatile uint32_t *dirPinCcwReg;
-    const int stepPin, dirPin;
-
-    // Friends
-    template <typename a, typename t>
-    friend class StepControlBase;
-
-    template <typename a, typename t>
-    friend class RotateControlBase;
-
-    template <typename t>
-    friend class MotorControlBase;
-};
-
-// Inline implementation -----------------------------------------
-
-void Stepper::doStep()
-{
-    *stepPinActiveReg = 1;
-    current += dir;
-}
-void Stepper::clearStepPin() const
-{
-    *stepPinInactiveReg = 1;
-}
-
-void Stepper::setDir(int d)
-{
-    dir = d;
-    dir == 1 ? *dirPinCwReg = 1 : *dirPinCcwReg = 1;
-}
-
-void Stepper::toggleDir()
-{
-    setDir(-dir);
-}

+ 0 - 59
HTequi-firmware/lib/TeensyStep-2.0.0/src/TeensyStep.h

@@ -1,59 +0,0 @@
-#pragma once
-
-#include "RotateControlBase.h"
-#include "StepControlBase.h"
-
-#include "accelerators/LinRotAccelerator.h"
-#include "accelerators/LinStepAccelerator.h"
-//#include "accelerators/SinRotAccelerator.h"
-
-#include "timer/generic/TimerField.h"
-
-
-// TEENSY 3.0 - Teensy 3.6 ==================================================================================
-
-#if defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
-#include "timer/teensy3/TimerField2.h"
-
-// TEENSY 4 ================================================================================================
-
-#elif defined(__IMXRT1052__)
-#include "timer/teensy4/TimerField.h"
-
-//STM32 ====================================================================================================
-
-#elif defined(__STM32_TBD__)
-#include "timers/STM32/TimerField.h"
-
-//Some other hardware ======================================================================================
-
-#elif defined(__someHardware_TBD__)
-#include "timers/someHardware/TimerField2.h"
-#endif
-
-// Linear acceleration -----------------------------------------------------------------------------------------
-
-
-using MotorControl = MotorControlBase<TimerField>;
-
-using RotateControl = RotateControlBase<LinRotAccelerator, TimerField>;
-using StepControl = StepControlBase<LinStepAccelerator, TimerField>;
-
-using StepControlTick = StepControlBase<LinStepAccelerator,TickTimerField>;
-using RotateControlTick = RotateControlBase<LinStepAccelerator,TickTimerField>;
-
-// Sine acceleration -------------------------------------------------------------------------------------------
-
-// template <unsigned stepPulseWidth = defPW, unsigned accUpdatePeriod = defAP>
-// using RotateControlSin = RotateControlBase<SinRotAccelerator, TimerField>;
-
-//template <unsigned p = defPW, unsigned a>
-//using StepControlSin = StepControlBase<SinStepAccelerator, p, a>;
-
-// Generic ==========================================================================================
-
-// template <unsigned stepPulseWidth = defPW, unsigned accUpdatePeriod = defAP>
-// using RotateControl_tick = RotateControlBase<LinRotAccelerator, stepPulseWidth, accUpdatePeriod>;
-
-// template <unsigned stepPulseWidth = defPW, unsigned a = defAP>
-// using StepControl_tick = StepControlBase<LinStepAccelerator, stepPulseWidth, a>;

+ 0 - 90
HTequi-firmware/lib/TeensyStep-2.0.0/src/accelerators/LinRotAccelerator.h

@@ -1,90 +0,0 @@
-#pragma once
-
-#include "wiring.h"
-
-#include <cmath>
-#include <cstdint>
-#include <algorithm>
-
-class LinRotAccelerator
-{
-public:
-    inline void prepareRotation(int32_t currentPosition, int32_t targetSpeed, uint32_t acceleration, uint32_t accUpdatePeriod, float speedFactor = 1.0);
-    inline int32_t updateSpeed(int32_t currentPosition);
-    inline int32_t initiateStopping(int32_t currentPosition);
-    inline void eStop();
-    inline void overrideSpeed(float factor);
-    inline void overrideAcceleration(float factor);
-
-    LinRotAccelerator() = default;
-
-protected:
-    LinRotAccelerator(const LinRotAccelerator &) = delete;
-    LinRotAccelerator &operator=(const LinRotAccelerator &) = delete;
-
-    // int32_t v_tgt, v_cur;
-    // int32_t v_tgt_orig, dv_orig, dv;
-
-    float v_tgt, v_cur;
-    float v_tgt_orig, dv_orig, dv_cur, dv;
-};
-
-// Inline Implementation =====================================================================================================
-
-void LinRotAccelerator::prepareRotation(int32_t currentPosition, int32_t targetSpeed, uint32_t a, uint32_t accUpdatePeriod, float speedFactor)
-{
-    v_tgt_orig = targetSpeed;
-    dv_orig = ((float)a * accUpdatePeriod) / 1E6;  
-    v_cur = 0;
-
-    overrideAcceleration(1.0f);
-    overrideSpeed(speedFactor);
-}
-
-void LinRotAccelerator::overrideSpeed(float factor)
-{
-    //Serial.printf("a:------ %d\n", a);
-
-    noInterrupts();
-    v_tgt = v_tgt_orig * factor;
-    dv = v_tgt > v_cur ? dv_cur : -dv_cur;
-    interrupts();
-}
-
-void LinRotAccelerator::overrideAcceleration(float factor)
-{
-    //Serial.printf("a:------ %d\n", a);
-    if (factor > 0)
-    {
-        noInterrupts();
-        dv_cur = dv_orig * factor;
-        dv *= factor;
-        interrupts();
-    }
-}
-
-int32_t LinRotAccelerator::updateSpeed(int32_t curPos)
-{
-    if (v_cur == v_tgt)
-        return (int32_t)v_tgt; // already at target, keep spinning with target frequency
-
-    v_cur += dv;
-    v_cur = dv > 0.0f ? std::min(v_tgt, v_cur) : std::max(v_tgt, v_cur);
-
-    return (int32_t)v_cur;
-}
-
-int32_t LinRotAccelerator::initiateStopping(int32_t curPos)
-{
-    overrideSpeed(0);
-    return 0;
-}
-
-void LinRotAccelerator::eStop()
-{
-    noInterrupts();
-    v_cur = 0.0f;
-    v_tgt = 0.0f;
-    interrupts();
-}
-   

+ 0 - 85
HTequi-firmware/lib/TeensyStep-2.0.0/src/accelerators/LinStepAccelerator.h

@@ -1,85 +0,0 @@
-#pragma once
-
-#include <cmath>
-#include <cstdint>
-#include <algorithm>
-
-class LinStepAccelerator
-{
-public:
-    inline int32_t prepareMovement(int32_t currentPos, int32_t targetPos, uint32_t targetSpeed, uint32_t a);
-    inline int32_t updateSpeed(int32_t currentPosition);
-    inline uint32_t initiateStopping(int32_t currentPosition);
-    inline void overrideSpeed(float fac, int32_t currentPosition);
-
-    LinStepAccelerator() = default;
-
-protected:
-    LinStepAccelerator(const LinStepAccelerator &) = delete;
-    LinStepAccelerator &operator=(const LinStepAccelerator &) = delete;
-
-    int32_t s_0;
-    uint32_t delta_tgt;
-    uint32_t accLength, decStart;
-    uint32_t two_a;
-    uint32_t v_tgt, v_min2;
-};
-
-// Inline Implementation =====================================================================================================
-
-int32_t LinStepAccelerator::prepareMovement(int32_t currentPos, int32_t targetPos, uint32_t targetSpeed, uint32_t a)
-{
-    s_0 = currentPos;
-    delta_tgt = std::abs(targetPos - currentPos);
-    v_tgt = targetSpeed;
-    two_a = 2 * a;
-    v_min2 = a;
-
-    uint32_t ae = (float)v_tgt * v_tgt / two_a - 0.5f; // length of acceleration phase (we use a float here to avoid overflow in v_tgt^2). Use (1) and vmin^2 = 2a
-    accLength = std::min(ae, delta_tgt / 2);           // limit acceleration phase to half of total steps
-    decStart = delta_tgt - accLength;
-
-    return accLength == 0 ? v_tgt : (int32_t)sqrtf(v_min2);
-}
-
-int32_t LinStepAccelerator::updateSpeed(int32_t curPos)
-{
-    uint32_t stepsDone = std::abs(s_0 - curPos);
-
-    // acceleration phase -------------------------------------
-    if (stepsDone < accLength)
-        return sqrtf(two_a * stepsDone + v_min2);
-
-    // constant speed phase ------------------------------------
-    if (stepsDone < decStart)
-        return v_tgt;
-
-    //deceleration phase --------------------------------------
-    if(stepsDone < delta_tgt)
-        return sqrtf(two_a * ((stepsDone < delta_tgt - 1) ? delta_tgt - stepsDone - 2 : 0) + v_min2);
-
-    //we are done, make sure to return 0 to stop the step timer
-    return 0; 
-}
-
-uint32_t LinStepAccelerator::initiateStopping(int32_t curPos)
-{
-    uint32_t stepsDone = std::abs(s_0 - curPos);
-    
-    if (stepsDone < accLength)              // still accelerating
-    {        
-        accLength = decStart = 0;           // start deceleration 
-        delta_tgt = 2 * stepsDone;          // we need the same way to decelerate as we traveled so far
-        return stepsDone;                   // return steps to go
-    }
-    else if (stepsDone < decStart)          // constant speed phase
-    {
-        decStart = 0;                       // start deceleration
-        delta_tgt = stepsDone + accLength;  // normal deceleration distance 
-        return accLength;                   // return steps to go
-    }
-    else                                    // already decelerating
-    {
-        return delta_tgt - stepsDone;       // return steps to go
-    }
-}

+ 0 - 81
HTequi-firmware/lib/TeensyStep-2.0.0/src/accelerators/SinRotAccelerator.h

@@ -1,81 +0,0 @@
-#pragma once
-
-#include "wiring.h"
-
-#include <cmath>
-#include <cstdint>
-#include <algorithm>
-
-class SinRotAccelerator
-{
-  public:
-    inline int32_t prepareRotation(int32_t currentPosition, int32_t targetSpeed, uint32_t acceleration, float speedFactor = 1.0);
-    inline int32_t updateSpeed(int32_t currentPosition);
-    inline int32_t initiateStopping(int32_t currentPosition);
-    inline void overrideSpeed(float fac, int32_t currentPosition);
-
-    SinRotAccelerator() = default;
-
-  protected:
-    SinRotAccelerator(const SinRotAccelerator &) = delete;
-    SinRotAccelerator &operator=(const SinRotAccelerator &) = delete;
-
-    int32_t dir;
-    int32_t a, two_a; 
-    int32_t vstp;
-    int32_t v_tgt, v_tgt_orig, vstp_tgt;
-    int32_t v_min, v_min_sqr;
-    int32_t s_0;
-
-    inline float signed_sqrt(int32_t x) // signed square root
-    {
-        return x > 0 ? sqrtf(x) : -sqrtf(-x);
-    }
-};
-
-// Implementation =====================================================================================================
-
-int32_t SinRotAccelerator::prepareRotation(int32_t currentPosition, int32_t targetSpeed, uint32_t acceleration, float speedFactor)
-{
-    v_tgt_orig = targetSpeed;
-    a = acceleration;
-    two_a = 2 * a;
-    v_min_sqr = a;
-    v_min = sqrtf(v_min_sqr);
-    vstp = 0;
-    overrideSpeed(speedFactor, currentPosition);
-
-    //Serial.printf("%vtgt:%i vstp_tgt:%i  \n", v_tgt, vstp_tgt);
-    return v_min;
-}
-
-int32_t SinRotAccelerator::updateSpeed(int32_t curPos)
-{
-    if (vstp == vstp_tgt) // already at target, keep spinning with target frequency
-    {
-        return v_tgt;
-    }
-
-    vstp += std::abs(curPos - s_0) * dir;
-    vstp = dir == 1 ? std::min(vstp_tgt, vstp) : std::max(vstp_tgt, vstp); // clamp vstp to target
-
-    //Serial.printf("dir: %i, vstp_tgt:%i, vstp:%i, deltaS:%i\n", dir, vstp_tgt, vstp, deltaS);
-    s_0 = curPos;
-    return signed_sqrt(two_a * vstp + v_min_sqr);
-}
-
-void SinRotAccelerator::overrideSpeed(float fac, int32_t curPos)
-{
-    noInterrupts();
-    s_0 = curPos;
-    v_tgt = std::round(v_tgt_orig * fac);
-    vstp_tgt = ((float)v_tgt * v_tgt) / two_a * (v_tgt > 0 ? 1.0f : -1.0f);
-    dir = vstp_tgt > vstp ? 1 : -1;
-    interrupts();
-}
-
-int32_t SinRotAccelerator::initiateStopping(int32_t curPos)
-{
-    overrideSpeed(0, curPos);
-    return 0;
-}

+ 0 - 8
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/TF_Handler.h

@@ -1,8 +0,0 @@
-#pragma once
-
-struct TF_Handler
-{
-  virtual void stepTimerISR() = 0;
-  virtual void accTimerISR() = 0;
-  virtual void pulseTimerISR() = 0;
-};

+ 0 - 22
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/TimerFieldBase.h

@@ -1,22 +0,0 @@
-#include "TF_Handler.h"
-
-class ITimerField
-{
-public:
-  ITimerField(TF_Handler *);
-
-  virtual bool begin()=0;
-  virtual void end()=0;
-
-  virtual void stepTimerStart()=0;
-  virtual void stepTimerStop()=0;
-  virtual bool stepTimerIsRunning() const =0;
-  virtual void setStepFrequency(unsigned f)=0;
-
-  virtual void accTimerStart()=0;
-  virtual void accTimerStop()=0;
-  virtual void setAccUpdatePeriod(unsigned period)=0;
-
-  virtual void setPulseWidth(unsigned delay)=0;
-  virtual void triggerDelay()=0;
-};

+ 0 - 9
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/generic/TickTimer.cpp

@@ -1,9 +0,0 @@
-#include "TickTimer.h"
-
-void std::__throw_bad_function_call()
-{
-    while(1);
-}
-
-TimerBase* TimerControl::firstTimer = nullptr;
-TimerBase* TimerControl::lastTimer = nullptr;

+ 0 - 159
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/generic/TickTimer.h

@@ -1,159 +0,0 @@
-#pragma once
-
-#include "Arduino.h"
-#include <functional>
-#include <limits>
-
-class TimerControl;
-
-//using callback_t = void (*)();
-using callback_t = std::function<void(void)>;
-
-class TimerBase
-{
-  public:
-    TimerBase(callback_t cb, bool _isPeriodic)
-    {
-        callback = cb;
-        deltaCnt = 0;
-        run = false;
-        isPeriodic = _isPeriodic;
-        prev = next = nullptr;
-    };
-
-    inline void start() { startCnt = ARM_DWT_CYCCNT; run = true; }
-    inline void stop() { run = false; }
-    inline bool isRunning() const {return run;}
-
-  protected:
-    uint32_t deltaCnt, startCnt;
-    bool isPeriodic;
-    bool run;
-    callback_t callback;
-
-    TimerBase *prev, *next;
-
-    friend TimerControl;
-};
-
-class PeriodicTimer : public TimerBase
-{
-  public:
-    PeriodicTimer(callback_t cb) : TimerBase(cb, true) 
-    {
-        
-    }
-
-    inline void setFrequency(float hz)
-    {
-        //Serial.println(hz);
-        deltaCnt = hz > minFrequency ? F_CPU / hz : std::numeric_limits<uint32_t>::max();
-        //Serial.println(deltaCnt);
-    }
-
-    inline void setPeriod(uint32_t microSeconds)
-    {
-        deltaCnt = F_CPU / 1'000'000 * microSeconds;
-    }
-
-    static constexpr float minFrequency = (float)F_CPU / std::numeric_limits<uint32_t>::max();
-};
-
-class OneShotTimer : public TimerBase
-{
-  public:
-    OneShotTimer(callback_t cb, unsigned delay = 0) : TimerBase(cb, false) 
-    {
-        setDelay(delay);
-    }
-
-    void setDelay(unsigned microSeconds)
-    {
-        deltaCnt = F_CPU / 1'000'000 * microSeconds;
-    }
-};
-
-class TimerControl
-{
-  public:
-    static void begin()
-    {
-        ARM_DEMCR |= ARM_DEMCR_TRCENA;
-        ARM_DWT_CTRL |= ARM_DWT_CTRL_CYCCNTENA;
-    }
-
-    static void attachTimer(TimerBase *timer)
-    {
-        if (timer == nullptr)
-            return;
-
-        if (firstTimer == nullptr) // empty timer list
-        {
-            firstTimer = lastTimer = timer;
-            timer->prev = nullptr;
-            timer->next = nullptr;
-        }
-        else // append timer at end of the list
-        {
-            timer->next = nullptr;
-            lastTimer->next = timer;
-            lastTimer = timer;
-        }
-    }
-
-    static void detachTimer(TimerBase *timer)
-    {
-        if (firstTimer == nullptr || timer == nullptr)
-            return;
-
-        TimerBase *t = firstTimer;
-        while (t != timer)
-        {
-            t = t->next;
-            if (t == nullptr)
-                return;
-        }
-
-        if (t == firstTimer)
-        {
-            firstTimer = t->next;
-        }
-        else if (t == lastTimer)
-        {
-            lastTimer = t->prev;
-        }
-        else
-        {
-            t->prev->next = t->next;
-        }
-    }
-
-    static inline void tick()
-    {       
-        digitalWriteFast(2,HIGH) ;
-        TimerBase *timer = firstTimer;
-        
-        while (timer != nullptr)
-        {
-            //Serial.printf("cnt: %d\n", ARM_DWT_CYCCNT );
-
-            if (timer->run && (ARM_DWT_CYCCNT - timer->startCnt >= timer->deltaCnt))
-
-            {
-                if (timer->isPeriodic)
-                    timer->startCnt = ARM_DWT_CYCCNT;
-                else
-                    timer->run = false;
-
-                timer->callback();
-            }
-            timer = timer->next;
-        }
-
-        digitalWriteFast(2,LOW) ;
-    }
-
-  protected:
-    static TimerBase *firstTimer;
-    static TimerBase *lastTimer;
-};

+ 0 - 67
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/generic/TimerField.h

@@ -1,67 +0,0 @@
-#pragma once
-
-#include "wiring.h"
-// //#include "imxrt.h"
-
-#include "TickTimer.h"
-#include "../TF_Handler.h"
-
-// //=========================
-// // Teensy 4
-// //=========================
-
-class TickTimerField
-{
-  public:
-    inline TickTimerField(TF_Handler *);
-
-    inline bool begin();
-    inline void end();
-
-    inline void stepTimerStart() { stepTimer.start(); }
-    inline void stepTimerStop() { stepTimer.stop(); }
-    inline bool stepTimerIsRunning() const { return stepTimer.isRunning(); }
-    inline void setStepFrequency(unsigned f) {stepTimer.setFrequency(f); }
-    inline unsigned getStepFrequency() { return 0; }
-
-    inline void accTimerStart() { accTimer.start(); }
-    inline void accTimerStop() { accTimer.stop(); }
-    inline void setAccUpdatePeriod(unsigned period) { accTimer.setPeriod(period); }
-
-    inline void setPulseWidth(unsigned delay) { delayTimer.setDelay(delay); }
-    inline void triggerDelay() { delayTimer.start(); }
-
-  protected:
-    TF_Handler *handler;
-
-    PeriodicTimer stepTimer, accTimer;
-    OneShotTimer delayTimer;
-};
-
-// IMPLEMENTATION ====================================================================
-
-TickTimerField::TickTimerField(TF_Handler *_handler)
-    : handler(_handler),
-      stepTimer([this] { handler->stepTimerISR(); }),
-      //stepTimer(test),
-      accTimer([_handler] { _handler->accTimerISR(); }),
-      delayTimer([this] { handler->pulseTimerISR(); })
-{
-    TimerControl::attachTimer(&stepTimer);
-    TimerControl::attachTimer(&accTimer);
-    TimerControl::attachTimer(&delayTimer);
-}
-
-
-
-bool TickTimerField::begin()
-{
-    Serial.println("begin");
-    TimerControl::begin();
-    return true;
-}
-
-void TickTimerField::end()
-{
-    //TimerControl::end();    
-}

+ 0 - 61
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy3/PIT.cpp

@@ -1,61 +0,0 @@
-#include "PIT.h"
- 
- #include "../TF_Handler.h"
-
-namespace
-{
-    TF_Handler* Handler[4];
-
-    template<int n>
-    void dispatchFunc()
-    {      
-        Handler[n]->stepTimerISR();     
-    }
-
-    constexpr void(*dispatcher[])(void) =
-    {
-        dispatchFunc<0>,
-        dispatchFunc<1>,
-        dispatchFunc<2>,
-        dispatchFunc<3>
-    };
-
-    void dummyISR(void) {}
-}
-
-bool PIT::begin(TF_Handler* handler)
-{
-    if (!timer.begin(dummyISR, 1E6)) return false;  // try to reserve a timer
-
-    setupChannel();                                 // find pit channel of reserved timer
-    const int channelNr = channel - KINETISK_PIT_CHANNELS;
-    Handler[channelNr] = handler;                // store handler
-	timer.priority(32);
-    timer.begin(dispatcher[channelNr], 1E6);     // attach an ISR which will call the stored handler													
-    stop();        		                            // stop doesn't clear TEN, we want to keep the IntervalTimer reserved
-
-    return true;
-}
-
-void PIT::setupChannel()
-{
-    IRQ_NUMBER_t number = (IRQ_NUMBER_t)timer;
-    switch (number)
-    {
-    case IRQ_PIT_CH0:
-        channel = KINETISK_PIT_CHANNELS + 0;
-        break;
-    case IRQ_PIT_CH1:
-        channel = KINETISK_PIT_CHANNELS + 1;
-        break;
-    case IRQ_PIT_CH2:
-        channel = KINETISK_PIT_CHANNELS + 2;
-        break;
-    case IRQ_PIT_CH3:
-        channel = KINETISK_PIT_CHANNELS + 3;
-        break;
-    default:
-        channel = nullptr;
-        break;
-    }
-}

+ 0 - 36
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy3/PIT.h

@@ -1,36 +0,0 @@
-#pragma once
-
-#include "IntervalTimer.h"
-
-class IPitHandler
-{
-public:
-	virtual void pitISR() = 0;
-};
-
-class TF_Handler;
-
-class PIT
-{
-public:	
-	bool begin(TF_Handler*);
-
-	inline void end() { timer.end(); }
-	inline void start() const { channel->TFLG = 1; channel->TCTRL = 0; channel->TCTRL = 3; }
-	inline void stop() const { channel->TCTRL &= ~PIT_TCTRL_TIE; }	
-	inline void enableInterupt() const { channel->TFLG = 1; channel->TCTRL |= PIT_TCTRL_TIE; }
-	inline void setFrequency(uint32_t val) const {  channel->LDVAL = F_BUS/val;}
-	inline void setThisReload(uint32_t ldval) const { channel->TCTRL = 0, channel->TFLG = 1;channel->LDVAL = ldval, channel->TCTRL = 3;}
-	inline void setNextReload(uint32_t ldval) const { channel->LDVAL = ldval; }
-	inline uint32_t getLDVAL() const { return channel->LDVAL; }
-	inline uint32_t getCVAL() const { return channel->CVAL; }
-	inline void clearTIF()const { channel->TFLG = 1; }
-	inline bool isRunning() const { return channel->TCTRL & PIT_TCTRL_TIE; }
-	
-	KINETISK_PIT_CHANNEL_t* channel = nullptr;
-
-  protected:	
-	IntervalTimer timer;
-	void setupChannel();
-
-};

+ 0 - 114
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy3/TeensyStepFTM.cpp

@@ -1,114 +0,0 @@
-#if defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
-
-#include "TeensyStepFTM.h"
-#include "config.h"
-
-namespace TeensyStepFTM
-{
-
-namespace // private
-{
-	bool isConfigured = false;
-	IDelayHandler *callbacks[maxChannel];
-} 
-
-void begin()
-{
-	if (!isConfigured)
-	{
-		if (USE_TIMER == TIMER_TPM1)
-		{ 										// enable clocks for tpm timers (ftm clocks are enabled by teensyduino)
-			SIM_SCGC2 |= SIM_SCGC2_TPM1;
-			SIM_SOPT2 |= SIM_SOPT2_TPMSRC(2);
-		}
-		else if (USE_TIMER == TIMER_TPM2)
-		{
-			SIM_SCGC2 |= SIM_SCGC2_TPM2;
-			SIM_SOPT2 |= SIM_SOPT2_TPMSRC(2);
-		}
-													// Default Mode for  FTM is (nearly) TPM compatibile
-		timer->SC = FTM_SC_CLKS(0b00); 				// Disable clock
-		timer->MOD = 0xFFFF;		   				// Set full counter range
-
-		for (unsigned i = 0; i < maxChannel; i++)
-		{ 											// turn off all channels which were enabled by teensyduino for PWM generation
-			if (isFTM)
-			{									 	// compiletime constant, compiler optimizes conditional and not valid branch completely away
-				timer->CH[i].SC &= ~FTM_CSC_CHF; 	// FTM requires to clear flag by setting bit to 0
-			}
-			else
-			{
-				timer->CH[i].SC |= FTM_CSC_CHF; 	// TPM requires to clear flag by setting bit to 1
-			}
-			timer->CH[i].SC &= ~FTM_CSC_CHIE; 		// Disable channel interupt
-			timer->CH[i].SC = FTM_CSC_MSA;
-			//timer->CH[i].SC = 0;                   // disable channel
-		}
-		timer->SC = FTM_SC_CLKS(0b01) | FTM_SC_PS(prescale); // Start clock
-		NVIC_ENABLE_IRQ(irq);						 // Enable interrupt request for selected timer
-
-		isConfigured = true;
-	}
-}
-
-unsigned addDelayChannel(IDelayHandler *handler)
-{
-	for (unsigned ch = 0; ch < maxChannel; ch++)
-	{
-		if (callbacks[ch] == 0)
-		{
-			callbacks[ch] = handler; //Just store the callback function, the rest is done in Trigger function
-			return ch;
-		}
-	}
-	return maxChannel;
-}
-
-void removeDelayChannel(unsigned chNr)
-{
-	if (chNr < maxChannel)
-	{
-		noInterrupts();
-		timer->CH[chNr].SC &= ~FTM_CSC_CHIE; // disable channel
-		callbacks[chNr] = nullptr;
-		interrupts(); 
-	}
-}
-} // namespace TeensyDelay2
-
-//-------------------------------------------------------------------------------------------
-// Interupt service routine of the timer selected in config.h.
-// The code doesn't touch the other FTM/TPM ISRs so they can still be used for other purposes
-//
-// Unfortunately we can not inline the ISR because inlinig will generate a "weak" function?.
-// Since the original ISR (dummy_isr) is also defined weak the linker
-// is allowed to choose any of them. In this case it desided to use dummy_isr :-(
-// Using a "strong" (not inlined) function overrides the week dummy_isr
-//--------------------------------------------------------------------------------------------
-
-using namespace TeensyStepFTM;
-
-#if USE_TIMER == TIMER_FTM0
-void ftm0_isr(void)
-#elif USE_TIMER == TIMER_FTM1
-void ftm1_isr(void)
-#elif USE_TIMER == TIMER_FTM2
-void ftm2_isr(void)
-#elif USE_TIMER == TIMER_FTM3
-void ftm3_isr(void)
-#elif USE_TIMER == TIMER_TPM1
-void tpm1_isr(void)
-#elif USE_TIMER == TIMER_TPM2
-void tpm2_isr(void)
-#endif
-{
-	for (unsigned i = 0; i < maxChannel; i++)
-	{
-		if ((timer->CH[i].SC & (FTM_CSC_CHIE | FTM_CSC_CHF)) == (FTM_CSC_CHIE | FTM_CSC_CHF)) // only handle if channel is active (CHIE set) and overflowed (CHF set)
-		{
-			timer->CH[i].SC &= ~FTM_CSC_CHIE; 	// We want one shot only. (Make sure to reset the CHF flag before re-activating interrupt in trigger function)
-			callbacks[i]->delayISR(i);			// invoke callback function for the channel
-		}
-	}
-}
-#endif

+ 0 - 35
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy3/TeensyStepFTM.h

@@ -1,35 +0,0 @@
-#pragma once
-#include "config.h"
-
-#include "Arduino.h"
-
-class IDelayHandler
-{
-public:
-	virtual void delayISR(unsigned channel) = 0;
-};
-
-namespace TeensyStepFTM
-{
-	extern void begin(void);
-
-	extern unsigned addDelayChannel(IDelayHandler* h);
-	extern void removeDelayChannel(unsigned channel);
-	
-	inline void trigger(unsigned delay, unsigned channel)
-	{
-		//Serial.printf("chn: %d, tdt: %d\n", channel, microsToReload(delay));
-
-		timer->SC = 0;                                       // Remove clock to immediately write new channel value
-		timer->CH[channel].CV = timer->CNT + delay;    		 // Update channel value
-		timer->SC = FTM_SC_CLKS(0b01) | FTM_SC_PS(prescale); // Reattach clock       
-
-		if (isFTM) {                                         // important to clear channel flag (in case we had a channel event since last trigger)
-			timer->CH[channel].SC &= ~FTM_CSC_CHF;           // enable channel interrupt. Can not combine both commands since clearing 		 
-		}
-		else {                                               // the channel flag requires a read modify write cycle            
-			timer->CH[channel].SC |= FTM_CSC_CHF;            // FTM and TPM timers differ in resetting the interrupt flag
-		}                                                    // isFTM is a compile time constant -> compiler completely optimizes the not valid case away
-		timer->CH[channel].SC = FTM_CSC_MSA | FTM_CSC_CHIE;
-	}
-}

+ 0 - 184
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy3/TimerField2.h

@@ -1,184 +0,0 @@
-#pragma once
-
-#include "wiring.h"
-#include "PIT.h"
-#include "TeensyStepFTM.h"
-
-#include "../TF_Handler.h"
-//#include "../TimerFieldBase.h"
-
-//=========================
-// Teensy3
-//=========================
-
-class TimerField : public IDelayHandler
-{
-public:
-  inline TimerField(TF_Handler *);
-  inline ~TimerField();
-
-  inline bool begin();
-  inline void end();
-
-  inline void stepTimerStart();
-  inline void stepTimerStop();
-  inline bool stepTimerIsRunning() const;
-  inline void setStepFrequency(unsigned f);
-  inline unsigned getStepFrequency();
-
-  inline void accTimerStart();
-  inline void accTimerStop();
-  inline void setAccUpdatePeriod(unsigned period);
-
-  inline void setPulseWidth(unsigned delay);
-  inline void triggerDelay();
-  inline void delayISR(unsigned channel);
-
-  //protected:
-  PIT stepTimer;
-  TF_Handler *handler;
-
-  unsigned delayWidth;
-  unsigned accUpdatePeriod;
-
-  const unsigned accLoopDelayChannel;
-  const unsigned pinResetDelayChannel;
-};
-
-// IMPLEMENTATION ====================================================================
-
-TimerField::TimerField(TF_Handler *_handler)
-    : handler(_handler),
-      accLoopDelayChannel(TeensyStepFTM::addDelayChannel(this)),
-      pinResetDelayChannel(TeensyStepFTM::addDelayChannel(this))
-{
-  //Serial.println(accLoopDelayChannel);
-}
-
-TimerField::~TimerField()
-{  
-  end(); 
-}
-
-bool TimerField::begin()
-{
-  TeensyStepFTM::begin();
-  return stepTimer.begin(handler);
-}
-
-void TimerField::end()
-{  
-  stepTimer.end();
-  TeensyStepFTM::removeDelayChannel(accLoopDelayChannel);
-  TeensyStepFTM::removeDelayChannel(pinResetDelayChannel);
-}
-
-// Step Timer ------------------------------------------------------
-
-void TimerField::stepTimerStart()
-{
-  stepTimer.start();
-}
-
-void TimerField::stepTimerStop()
-{
-  stepTimer.stop();
-}
-
-unsigned TimerField::getStepFrequency()
-{
-  return F_BUS / stepTimer.getLDVAL();
-}
-
-void TimerField::setStepFrequency(unsigned f)
-{  
-  if (f != 0)
-  {
-    if (stepTimer.isRunning())
-    {
-      uint32_t ldval = stepTimer.getLDVAL();
-
-      if (ldval < F_BUS / 250 ) // normal step freqency (> 250 Hz) -> set new period for following periods
-      {       
-        stepTimer.setNextReload(F_BUS / f);
-        return;
-      }
-      
-      uint32_t newReload = F_BUS / f;
-      uint32_t cyclesSinceLastStep = ldval - stepTimer.channel->CVAL;
-      if (cyclesSinceLastStep <= newReload) // time between last pulse and now less than required new period -> wait
-      {       
-        stepTimer.setThisReload(newReload - cyclesSinceLastStep);
-        stepTimer.setNextReload(newReload);
-      }
-      else
-      {       
-        stepTimer.setThisReload(newReload);
-        handler->stepTimerISR();
-      }
-    }
-    else // not running
-    {
-      handler->stepTimerISR();
-      stepTimer.setThisReload(F_BUS / f);  // restarts implicitly
-    }
-  }
-  else //f==0
-  {    
-    stepTimer.stop();       
-  }
-}
-
-bool TimerField::stepTimerIsRunning() const
-{
-  return stepTimer.isRunning();
-}
-
-// Acceleration Timer ------------------------------------------------------
-
-void TimerField::accTimerStart()
-{
-  delayISR(accLoopDelayChannel);
-}
-
-void TimerField::setAccUpdatePeriod(unsigned p)
-{
-  accUpdatePeriod = TeensyStepFTM::microsToReload(p);
-}
-
-void TimerField::accTimerStop()
-{
-  accUpdatePeriod = 0;
-}
-
-// Delay Timer ------------------------------------------------------
-
-void TimerField::setPulseWidth(unsigned delay)
-{
-  delayWidth = TeensyStepFTM::microsToReload(delay);
-}
-
-void TimerField::triggerDelay()
-{
-  TeensyStepFTM::trigger(delayWidth, pinResetDelayChannel);
-}
-
-void TimerField::delayISR(unsigned channel)
-{
-  if (channel == pinResetDelayChannel)
-  {
-    handler->pulseTimerISR();
-  }
-
-  else if (channel == accLoopDelayChannel)
-  {
-    if (accUpdatePeriod == 0)
-      return;
-
-    noInterrupts();
-    TeensyStepFTM::trigger(accUpdatePeriod, accLoopDelayChannel);
-    interrupts();
-
-    handler->accTimerISR();
-  }
-}

+ 0 - 172
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy3/config.h

@@ -1,172 +0,0 @@
-#pragma once
-
-#include <kinetis.h>
-#include <core_pins.h>
-
-namespace TeensyStepFTM
-{
-
-
-//========================================================================== 
-// Available timer modules for the Teensy XX boards. Please note that those 
-// timers are also used by the core libraries for PWM and AnalogWrite. 
-// Therefore, choose a timer which isn't attached to the pins you need for 
-// PWM or AnalogWrite. (TEENSY LC not yet supported)
-//
-// D: Default, X: available
-//
-//      TIMER           | Channels|        Timer is available for           |
-//                      |         | T-LC | T3.0 |  T3.1 | T3.2 | T3.5 | T3.6|
-//----------------------|---------|------|------|-------|------|------|-----|
-#define TIMER_FTM0 1  //|   8     |      |  D   |   D   |  D   |  D   |  D  |
-#define TIMER_FTM1 2  //|   2     |      |  X   |   X   |  X   |  X   |  X  |
-#define TIMER_FTM2 3  //|   2     |      |      |   X   |  X   |  X   |  X  |
-#define TIMER_FTM3 4  //|   8     |      |      |       |      |  X   |  X  |
-#define TIMER_TPM0 5  //|   6     |      |      |       |      |      |     |
-#define TIMER_TPM1 6  //|   2     |      |      |       |      |      |  X  |
-#define TIMER_TPM2 7  //|   2     |      |      |       |      |      |  X  |
-#define TIMER_DEFAULT -1
-
-// If you need a special timer, please replace "TIMER_DEFAULT" by a timer from the list above
-#define USE_TIMER TIMER_DEFAULT
-
-
-//==========================================================================
-// Nothing to be changed below here 
-//==========================================================================
-
-
-
-#if USE_TIMER == TIMER_DEFAULT
-#undef USE_TIMER
-#if defined __MKL26Z64__    
-#define USE_TIMER TIMER_TPM0
-#else
-#define USE_TIMER TIMER_FTM0
-#endif
-#endif
-
-    constexpr unsigned selTimer = USE_TIMER - 1;
-    constexpr bool isFTM = selTimer <= 3;
-
-    //================================================
-    // Which board do we use
-
-    enum class _boards
-    {
-        T_LC, T_30, T31_2, T_35, T_36
-    };
-
-#if defined __MKL26Z64__      
-    constexpr _boards board = _boards::T_LC;
-#elif defined __MK20DX128__    
-    constexpr _boards board = _boards::T_30;
-#elif defined __MK20DX256__     
-    constexpr _boards board = _boards::T31_2;
-#elif defined __MK64FX512__    
-    constexpr _boards board = _boards::T_35;
-#elif defined __MK66FX1M0__    
-    constexpr _boards board = _boards::T_36;
-#endif
-
-
-    //====================================================================
-    // Memory layout of register banks for FTM and TPM timers
-
-    typedef struct      // FTM & TPM Channels
-    {
-        uint32_t SC;
-        uint32_t CV;
-    } FTM_CH_t;
-
-    typedef struct       // FTM register block (this layout is compatible to a TPM register block)
-    {
-        uint32_t SC;
-        uint32_t CNT;
-        uint32_t MOD;
-        FTM_CH_t CH[8];
-        uint32_t CNTIN;
-        uint32_t STATUS;
-        uint32_t MODE;
-        uint32_t SYNC;
-        uint32_t OUTINIT;
-        uint32_t OUTMASK;
-        uint32_t COMBINE;
-        uint32_t DEADTIME;
-        uint32_t EXTTRIG;
-        uint32_t POL;
-        uint32_t FMS;
-        uint32_t FILTER;
-        uint32_t FLTCTRL;
-        uint32_t QDCTRL;
-        uint32_t CONF;
-        uint32_t FLTPOL;
-        uint32_t SYNCONF;
-        uint32_t INVCTRL;
-        uint32_t SWOCTRL;
-        uint32_t PWMLOAD;
-    }FTM_t;
-
-    //-----------------------------------------------------------------------------------
-    // Definition of base address for register block, number of channels and IRQ number
-    //
-
-    constexpr uintptr_t TimerBaseAddr[][7] =
-    { //    FTM0         FTM1        FTM2        FTM3        TPM0        TMP1        TMP2
-        { 0,          0,          0,          0,          0,          0,          0          },  // Teensy LC not yet supported
-        { 0x40038000, 0x40039000, 0,          0,          0,          0,          0,         },  // Teensy 3.0
-        { 0x40038000, 0x40039000, 0x400B8000, 0,          0,          0,          0,         },  // Teensy 3.1/3.2
-        { 0x40038000, 0x40039000, 0x400B8000, 0x400B9000, 0,          0,          0,         },  // Teensy 3.5
-        { 0x40038000, 0x40039000, 0x400B8000, 0x400B9000, 0,          0x400C9000, 0x400CA000 },  // Teensy 3.6
-    };
-
-    constexpr int IRQ_Number[][7]
-    {
-        //  FTM0  FTM1  FTM2  FTM3  TPM0  TPM1  TPM2
-          {  0,    0,   0,     0,    0,    0,    0 },  // Teensy LC
-          { 25,   26,   0,     0,    0,    0,    0 },  // Teensy 3.0
-          { 62,   63,   64,    0,    0,    0,    0 },  // Teensy 3.1/3.2
-          { 42,   43,   44,   71,    0,    0,    0 },  // Teensy 3.5
-          { 42,   43,   44,   71,    0,   88,   89 },  // Teensy 3.6
-    };
-
-    constexpr int _nrOfChannels[]
-    {
-        8,  // FTM0
-        2,  // FTM1
-        2,  // FTM2
-        8,  // FTM3
-        6,  // TPM0
-        2,  // TPM1
-        2,  // TPM2 
-    };
-
-    constexpr uintptr_t timerAddr = TimerBaseAddr[(int)board][selTimer];
-    constexpr volatile FTM_t* timer = __builtin_constant_p((FTM_t*)timerAddr) ? (FTM_t*)timerAddr : (FTM_t*)timerAddr; // base address for register block of selected timer
-    constexpr unsigned irq = IRQ_Number[(int)board][selTimer];                     // IRQ number of selected timer
-    constexpr unsigned maxChannel = _nrOfChannels[selTimer];                        // Number of channels for selected timer
-
-    static_assert(timer != nullptr && irq != 0, "Board does not support choosen timer");  //Generate compiler error in case the board does not support the selected timer
-
-    //-----------------------------------------------------------------------------------
-    //Frequency dependent settings 
-
-    constexpr unsigned _timer_frequency = isFTM ? F_BUS : 16000000;  // FTM timers are clocked with F_BUS, the TPM timers are clocked with OSCERCLK (16MHz for all teensies)
-
-    // Choose prescaler such that one timer cycle corresponds to about 1µs
-    constexpr unsigned prescale = 
-        _timer_frequency > 120000000 ? 0b111 :
-        _timer_frequency > 60000000 ? 0b110 :
-        _timer_frequency > 30000000 ? 0b101 : 
-        _timer_frequency > 15000000 ? 0b100 :
-        _timer_frequency > 8000000 ? 0b011 :
-        _timer_frequency > 4000000 ? 0b010 :
-        _timer_frequency > 2000000 ? 0b001 : 0b000;
-
-    // Calculates required reload value to get a delay of mu microseconds. 
-    // this will be completely evaluated by the compiler as long as mu is known at compile time 
-    constexpr int microsToReload(const float mu)
-    {
-        return  mu * 1E-6 * _timer_frequency / (1 << prescale) + 0.5;
-    }
-}

+ 0 - 62
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy4/PIT.cppc

@@ -1,62 +0,0 @@
-
-#include "PIT.h"
- 
- #include "../TF_Handler.h"
-
-namespace
-{
-    TF_Handler* Handler[4];
-
-    template<int n>
-    void dispatchFunc()
-    {      
-        Handler[n]->stepTimerISR();     
-    }
-
-    constexpr void(*dispatcher[])(void) =
-    {
-        dispatchFunc<0>,
-        dispatchFunc<1>,
-        dispatchFunc<2>,
-        dispatchFunc<3>
-    };
-
-    void dummyISR(void) {}
-}
-
-bool PIT::begin(TF_Handler* handler)
-{
-    if (!timer.begin(dummyISR, 1E6)) return false;  // try to reserve a timer
-
-    setupChannel();                                 // find pit channel of reserved timer
-    const int channelNr = channel - KINETISK_PIT_CHANNELS;
-    Handler[channelNr] = handler;                // store handler
-	timer.priority(32);
-    timer.begin(dispatcher[channelNr], 1E6);     // attach an ISR which will call the stored handler													
-    stop();        		                            // stop doesn't clear TEN, we want to keep the IntervalTimer reserved
-
-    return true;
-}
-
-void PIT::setupChannel()
-{
-    IRQ_NUMBER_t number = (IRQ_NUMBER_t)timer;
-    switch (number)
-    {
-    case IRQ_PIT_CH0:
-        channel = IMXRT_PIT_CHANNELS + 0;
-        break;
-    case IRQ_PIT_CH1:
-        channel = IMXRT_PIT_CHANNELS + 1;
-        break;
-    case IRQ_PIT_CH2:
-        channel = IMXRT_PIT_CHANNELS + 2;
-        break;
-    case IRQ_PIT_CH3:
-        channel = IMXRT_PIT_CHANNELS + 3;
-        break;
-    default:
-        channel = nullptr;
-        break;
-    }
-}

+ 0 - 32
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy4/PIT.hc

@@ -1,32 +0,0 @@
-#pragma once
-
-#include "IntervalTimer.h"
-
-class IPitHandler
-{
-public:
-	virtual void pitISR() = 0;
-};
-
-class TF_Handler;
-
-class PIT
-{
-public:	
-	bool begin(TF_Handler*);
-
-	inline void end() const { channel->TCTRL = 0; }
-	inline void start() const { channel->TFLG = 1; channel->TCTRL = 0; channel->TCTRL = 3; }
-	inline void stop() const { channel->TCTRL &= ~PIT_TCTRL_TIE; }	
-	inline void enableInterupt() const { channel->TFLG = 1; channel->TCTRL |= PIT_TCTRL_TIE; }
-	inline void setFrequency(uint32_t val) const {  channel->LDVAL = 24000000/val;}  // also starts timer!
-	inline void clearTIF()const { channel->TFLG = 1; }
-	inline bool isRunning() const { return channel->TCTRL & PIT_TCTRL_TIE; }
-
-protected:
-public:
-	IntervalTimer timer;
-	void setupChannel();
-
-	IMXRT_PIT_CHANNEL_t* channel = nullptr;
-};

+ 0 - 109
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy4/TeensyStepFTM.cppbak

@@ -1,109 +0,0 @@
-#if defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
-
-#include "TeensyStepFTM.h"
-#include "config.h"
-
-namespace TeensyStepFTM
-{
-
-namespace // private
-{
-	bool isConfigured = false;
-	IDelayHandler *callbacks[maxChannel];
-} 
-
-void begin()
-{
-	if (!isConfigured)
-	{
-		if (USE_TIMER == TIMER_TPM1)
-		{ 										// enable clocks for tpm timers (ftm clocks are enabled by teensyduino)
-			SIM_SCGC2 |= SIM_SCGC2_TPM1;
-			SIM_SOPT2 |= SIM_SOPT2_TPMSRC(2);
-		}
-		else if (USE_TIMER == TIMER_TPM2)
-		{
-			SIM_SCGC2 |= SIM_SCGC2_TPM2;
-			SIM_SOPT2 |= SIM_SOPT2_TPMSRC(2);
-		}
-													// Default Mode for  FTM is (nearly) TPM compatibile
-		timer->SC = FTM_SC_CLKS(0b00); 				// Disable clock
-		timer->MOD = 0xFFFF;		   				// Set full counter range
-
-		for (unsigned i = 0; i < maxChannel; i++)
-		{ 											// turn off all channels which were enabled by teensyduino for PWM generation
-			if (isFTM)
-			{									 	// compiletime constant, compiler optimizes conditional and not valid branch completely away
-				timer->CH[i].SC &= ~FTM_CSC_CHF; 	// FTM requires to clear flag by setting bit to 0
-			}
-			else
-			{
-				timer->CH[i].SC |= FTM_CSC_CHF; 	// TPM requires to clear flag by setting bit to 1
-			}
-			timer->CH[i].SC &= ~FTM_CSC_CHIE; 		// Disable channel interupt
-			timer->CH[i].SC = FTM_CSC_MSA;
-			//timer->CH[i].SC = 0;                   // disable channel
-		}
-		timer->SC = FTM_SC_CLKS(0b01) | FTM_SC_PS(prescale); // Start clock
-		NVIC_ENABLE_IRQ(irq);						 // Enable interrupt request for selected timer
-
-		isConfigured = true;
-	}
-}
-
-unsigned addDelayChannel(IDelayHandler *handler)
-{
-	for (unsigned ch = 0; ch < maxChannel; ch++)
-	{
-		if (callbacks[ch] == 0)
-		{
-			callbacks[ch] = handler; //Just store the callback function, the rest is done in Trigger function
-			return ch;
-		}
-	}
-	return maxChannel;
-}
-
-void removeDelayChannel(unsigned chNr)
-{
-	if (chNr < maxChannel)
-		callbacks[chNr] = nullptr;
-}
-} // namespace TeensyDelay2
-
-//-------------------------------------------------------------------------------------------
-// Interupt service routine of the timer selected in config.h.
-// The code doesn't touch the other FTM/TPM ISRs so they can still be used for other purposes
-//
-// Unfortunately we can not inline the ISR because inlinig will generate a "weak" function?.
-// Since the original ISR (dummy_isr) is also defined weak the linker
-// is allowed to choose any of them. In this case it desided to use dummy_isr :-(
-// Using a "strong" (not inlined) function overrides the week dummy_isr
-//--------------------------------------------------------------------------------------------
-
-using namespace TeensyStepFTM;
-
-#if USE_TIMER == TIMER_FTM0
-void ftm0_isr(void)
-#elif USE_TIMER == TIMER_FTM1
-void ftm1_isr(void)
-#elif USE_TIMER == TIMER_FTM2
-void ftm2_isr(void)
-#elif USE_TIMER == TIMER_FTM3
-void ftm3_isr(void)
-#elif USE_TIMER == TIMER_TPM1
-void tpm1_isr(void)
-#elif USE_TIMER == TIMER_TPM2
-void tpm2_isr(void)
-#endif
-{
-	for (unsigned i = 0; i < maxChannel; i++)
-	{
-		if ((timer->CH[i].SC & (FTM_CSC_CHIE | FTM_CSC_CHF)) == (FTM_CSC_CHIE | FTM_CSC_CHF)) // only handle if channel is active (CHIE set) and overflowed (CHF set)
-		{
-			timer->CH[i].SC &= ~FTM_CSC_CHIE; // We want one shot only. (Make sure to reset the CHF flag before re-activating interrupt in trigger function)
-			callbacks[i]->delayISR(i);		  // invoke callback function for the channel
-		}
-	}
-}
-#endif

+ 0 - 35
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy4/TeensyStepFTM.hh

@@ -1,35 +0,0 @@
-#pragma once
-#include "config.h"
-
-#include "Arduino.h"
-
-class IDelayHandler
-{
-public:
-	virtual void delayISR(unsigned channel) = 0;
-};
-
-namespace TeensyStepFTM
-{
-	extern void begin(void);
-
-	extern unsigned addDelayChannel(IDelayHandler* h);
-	extern void removeDelayChannel(unsigned channel);
-	
-	inline void trigger(unsigned delay, unsigned channel)
-	{
-		//Serial.printf("chn: %d, tdt: %d\n", channel, microsToReload(delay));
-
-		timer->SC = 0;                                       // Remove clock to immediately write new channel value
-		timer->CH[channel].CV = timer->CNT + delay;    		 // Update channel value
-		timer->SC = FTM_SC_CLKS(0b01) | FTM_SC_PS(prescale); // Reattach clock       
-
-		if (isFTM) {                                         // important to clear channel flag (in case we had a channel event since last trigger)
-			timer->CH[channel].SC &= ~FTM_CSC_CHF;           // enable channel interrupt. Can not combine both commands since clearing 		 
-		}
-		else {                                               // the channel flag requires a read modify write cycle            
-			timer->CH[channel].SC |= FTM_CSC_CHF;            // FTM and TPM timers differ in resetting the interrupt flag
-		}                                                    // isFTM is a compile time constant -> compiler completely optimizes the not valid case away
-		timer->CH[channel].SC = FTM_CSC_MSA | FTM_CSC_CHIE;
-	}
-}

+ 0 - 158
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy4/TimerField.h

@@ -1,158 +0,0 @@
-#pragma once
-
-#include "wiring.h"
-#include "imxrt.h"
-
- #include "ticktimer.h"
-// #include "TeensyStepFTM.h"
-
-#include "../TF_Handler.h"
-//#include "../TimerFieldBase.h"
-
-#include "IntervalTimer.h"
-
-//=========================
-// Teensy 4
-//=========================
-
-class TimerField 
-{
-public:
-  inline TimerField(TF_Handler *);
-
-  inline bool begin();
-  inline void end();
-
-  inline void stepTimerStart();
-  inline void stepTimerStop();
-  inline bool stepTimerIsRunning() const;
-  inline void setStepFrequency(unsigned f);
-   inline unsigned getStepFrequency() {
-     return 0;
-
-   }
-
-
-   inline void accTimerStart();
-   inline void accTimerStop();
-   inline void setAccUpdatePeriod(unsigned period);
-
-   inline void setPulseWidth(unsigned delay);
-   inline void triggerDelay();
-   inline void delayISR(unsigned channel);
-
-   static inline void tick() { tickTimer::tick(); }
-
- protected:
-   //PIT stepTimer;
-
-   tickTimer timer;
-
-   TF_Handler *handler;
-
-   unsigned delayWidth;
-   unsigned accUpdatePeriod;
-
-   unsigned accLoopDelayChannel;
-   unsigned pinResetDelayChannel;
-
-   unsigned stepFrequency;
-};
-
-// IMPLEMENTATION ====================================================================
-
-TimerField::TimerField(TF_Handler *_handler)
-    : handler(_handler)
-      // accLoopDelayChannel(TeensyStepFTM::addDelayChannel(this)),
-      // pinResetDelayChannel(TeensyStepFTM::addDelayChannel(this))
-{
-//  Serial.println("tf");
-accLoopDelayChannel = timer.attachPeriodicTimer(handler->accTimerISR);
-}
-
-bool TimerField::begin()
-{
-  // TeensyStepFTM::begin();
-  // return stepTimer.begin(handler);
-  return false;
-}
-
-void TimerField::end()
-{
-  // stepTimer.end();
-  // TeensyStepFTM::removeDelayChannel(accLoopDelayChannel);
-  // TeensyStepFTM::removeDelayChannel(pinResetDelayChannel);
-}
-
-// Step Timer ------------------------------------------------------
-
-void TimerField::stepTimerStart()
-{
- // stepTimer.start();
-}
-
-void TimerField::stepTimerStop()
-{
-  //stepTimer.stop();
-}
-
-void TimerField::setStepFrequency(unsigned f)
-{
-  // stepFrequency = f;
-  // stepTimer.setFrequency(stepFrequency);
-}
-
-bool TimerField::stepTimerIsRunning() const
-{
-  //return stepTimer.isRunning();
-  return false;
-}
-
-
-// Acceleration Timer ------------------------------------------------------
-
-void TimerField::accTimerStart()
-{
-  //delayISR(accLoopDelayChannel);
-}
-
-void TimerField::setAccUpdatePeriod(unsigned p) 
-{
-  accUpdatePeriod = p;
-}
-
-void TimerField::accTimerStop()
-{
-  accUpdatePeriod = 0;
-}
-
-// Delay Timer ------------------------------------------------------
-
-void TimerField::setPulseWidth(unsigned delay)
-{
- // delayWidth = TeensyStepFTM::microsToReload(delay);
-}
-
-void TimerField::triggerDelay()
-{
-   // TeensyStepFTM::trigger(delayWidth, pinResetDelayChannel);
-}
-
-void TimerField::delayISR(unsigned channel)
-{
-  // if (channel == pinResetDelayChannel)
-  // {
-  //   handler->pulseTimerISR();
-  // }
-
-  // else if (channel == accLoopDelayChannel)
-  // {
-  //   if (accUpdatePeriod == 0) return;
-
-  //   noInterrupts();
-  // //  TeensyStepFTM::trigger(accUpdatePeriod, accLoopDelayChannel);
-  //   interrupts();
-
-  //   handler->accTimerISR();
-//  }
-}

+ 0 - 172
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy4/config.h

@@ -1,172 +0,0 @@
-#pragma once
-
-#include <arduino.h>
-#include <core_pins.h>
-
-namespace TeensyStepFTM
-{
-
-
-//========================================================================== 
-// Available timer modules for the Teensy XX boards. Please note that those 
-// timers are also used by the core libraries for PWM and AnalogWrite. 
-// Therefore, choose a timer which isn't attached to the pins you need for 
-// PWM or AnalogWrite. (TEENSY LC not yet supported)
-//
-// D: Default, X: available
-//
-//      TIMER           | Channels|        Timer is available for           |
-//                      |         | T-LC | T3.0 |  T3.1 | T3.2 | T3.5 | T3.6|
-//----------------------|---------|------|------|-------|------|------|-----|
-#define TIMER_FTM0 1  //|   8     |      |  D   |   D   |  D   |  D   |  D  |
-#define TIMER_FTM1 2  //|   2     |      |  X   |   X   |  X   |  X   |  X  |
-#define TIMER_FTM2 3  //|   2     |      |      |   X   |  X   |  X   |  X  |
-#define TIMER_FTM3 4  //|   8     |      |      |       |      |  X   |  X  |
-#define TIMER_TPM0 5  //|   6     |      |      |       |      |      |     |
-#define TIMER_TPM1 6  //|   2     |      |      |       |      |      |  X  |
-#define TIMER_TPM2 7  //|   2     |      |      |       |      |      |  X  |
-#define TIMER_DEFAULT -1
-
-// If you need a special timer, please replace "TIMER_DEFAULT" by a timer from the list above
-#define USE_TIMER TIMER_DEFAULT
-
-
-//==========================================================================
-// Nothing to be changed below here 
-//==========================================================================
-
-
-
-#if USE_TIMER == TIMER_DEFAULT
-#undef USE_TIMER
-#if defined __MKL26Z64__    
-#define USE_TIMER TIMER_TPM0
-#else
-#define USE_TIMER TIMER_FTM0
-#endif
-#endif
-
-    constexpr unsigned selTimer = USE_TIMER - 1;
-    constexpr bool isFTM = selTimer <= 3;
-
-    //================================================
-    // Which board do we use
-
-    enum class _boards
-    {
-        T_LC, T_30, T31_2, T_35, T_36
-    };
-
-#if defined __MKL26Z64__      
-    constexpr _boards board = _boards::T_LC;
-#elif defined __MK20DX128__    
-    constexpr _boards board = _boards::T_30;
-#elif defined __MK20DX256__     
-    constexpr _boards board = _boards::T31_2;
-#elif defined __MK64FX512__    
-    constexpr _boards board = _boards::T_35;
-#elif defined __MK66FX1M0__    
-    constexpr _boards board = _boards::T_36;
-#endif
-
-
-    //====================================================================
-    // Memory layout of register banks for FTM and TPM timers
-
-    typedef struct      // FTM & TPM Channels
-    {
-        uint32_t SC;
-        uint32_t CV;
-    } FTM_CH_t;
-
-    typedef struct       // FTM register block (this layout is compatible to a TPM register block)
-    {
-        uint32_t SC;
-        uint32_t CNT;
-        uint32_t MOD;
-        FTM_CH_t CH[8];
-        uint32_t CNTIN;
-        uint32_t STATUS;
-        uint32_t MODE;
-        uint32_t SYNC;
-        uint32_t OUTINIT;
-        uint32_t OUTMASK;
-        uint32_t COMBINE;
-        uint32_t DEADTIME;
-        uint32_t EXTTRIG;
-        uint32_t POL;
-        uint32_t FMS;
-        uint32_t FILTER;
-        uint32_t FLTCTRL;
-        uint32_t QDCTRL;
-        uint32_t CONF;
-        uint32_t FLTPOL;
-        uint32_t SYNCONF;
-        uint32_t INVCTRL;
-        uint32_t SWOCTRL;
-        uint32_t PWMLOAD;
-    }FTM_t;
-
-    //-----------------------------------------------------------------------------------
-    // Definition of base address for register block, number of channels and IRQ number
-    //
-
-    constexpr uintptr_t TimerBaseAddr[][7] =
-    { //    FTM0         FTM1        FTM2        FTM3        TPM0        TMP1        TMP2
-        { 0,          0,          0,          0,          0,          0,          0          },  // Teensy LC not yet supported
-        { 0x40038000, 0x40039000, 0,          0,          0,          0,          0,         },  // Teensy 3.0
-        { 0x40038000, 0x40039000, 0x400B8000, 0,          0,          0,          0,         },  // Teensy 3.1/3.2
-        { 0x40038000, 0x40039000, 0x400B8000, 0x400B9000, 0,          0,          0,         },  // Teensy 3.5
-        { 0x40038000, 0x40039000, 0x400B8000, 0x400B9000, 0,          0x400C9000, 0x400CA000 },  // Teensy 3.6
-    };
-
-    constexpr int IRQ_Number[][7]
-    {
-        //  FTM0  FTM1  FTM2  FTM3  TPM0  TPM1  TPM2
-          {  0,    0,   0,     0,    0,    0,    0 },  // Teensy LC
-          { 25,   26,   0,     0,    0,    0,    0 },  // Teensy 3.0
-          { 62,   63,   64,    0,    0,    0,    0 },  // Teensy 3.1/3.2
-          { 42,   43,   44,   71,    0,    0,    0 },  // Teensy 3.5
-          { 42,   43,   44,   71,    0,   88,   89 },  // Teensy 3.6
-    };
-
-    constexpr int _nrOfChannels[]
-    {
-        8,  // FTM0
-        2,  // FTM1
-        2,  // FTM2
-        8,  // FTM3
-        6,  // TPM0
-        2,  // TPM1
-        2,  // TPM2 
-    };
-
-    constexpr uintptr_t timerAddr = TimerBaseAddr[(int)board][selTimer];
-    constexpr volatile FTM_t* timer = __builtin_constant_p((FTM_t*)timerAddr) ? (FTM_t*)timerAddr : (FTM_t*)timerAddr; // base address for register block of selected timer
-    constexpr unsigned irq = IRQ_Number[(int)board][selTimer];                     // IRQ number of selected timer
-    constexpr unsigned maxChannel = _nrOfChannels[selTimer];                        // Number of channels for selected timer
-
-    static_assert(timer != nullptr && irq != 0, "Board does not support choosen timer");  //Generate compiler error in case the board does not support the selected timer
-
-    //-----------------------------------------------------------------------------------
-    //Frequency dependent settings 
-
-    constexpr unsigned _timer_frequency = isFTM ? F_BUS : 16000000;  // FTM timers are clocked with F_BUS, the TPM timers are clocked with OSCERCLK (16MHz for all teensies)
-
-    // Choose prescaler such that one timer cycle corresponds to about 1µs
-    constexpr unsigned prescale = 
-        _timer_frequency > 120000000 ? 0b111 :
-        _timer_frequency > 60000000 ? 0b110 :
-        _timer_frequency > 30000000 ? 0b101 : 
-        _timer_frequency > 15000000 ? 0b100 :
-        _timer_frequency > 8000000 ? 0b011 :
-        _timer_frequency > 4000000 ? 0b010 :
-        _timer_frequency > 2000000 ? 0b001 : 0b000;
-
-    // Calculates required reload value to get a delay of mu microseconds. 
-    // this will be completely evaluated by the compiler as long as mu is known at compile time 
-    constexpr int microsToReload(const float mu)
-    {
-        return  mu * 1E-6 * _timer_frequency / (1 << prescale) + 0.5;
-    }
-}

+ 0 - 98
HTequi-firmware/lib/TeensyStep-2.0.0/src/timer/teensy4/ticktimer.h

@@ -1,98 +0,0 @@
-#include "Arduino.h"
-#include <functional>
-//#include <vector>
-
-using callback_t = void (*)();
-//using callback_t = std::function<void(void)>;
-
-struct channelInfo
-{
-    channelInfo()
-    {
-        callback = nullptr;
-        delta = 0;
-        run = false;
-    };
-
-    unsigned delta;
-    unsigned start;
-    bool isPeriodic;
-    bool run;
-    callback_t callback;
-};
-
-class tickTimer
-{
-    static constexpr unsigned maxTimers = 40;
-
-  public:
-    tickTimer();
-
-    int attachPeriodicTimer(callback_t callback, unsigned period) { return addTimer(callback, period, true); }
-    int attachOneShotTimer(callback_t callback, unsigned delay) { return addTimer(callback, delay, false); }
-
-    inline void setFrequency(unsigned f);
-    inline void trigger(unsigned i)
-    {
-        channels[i].start = ARM_DWT_CYCCNT;
-        channels[i].run = true;
-    }
-
-    static inline void tick();
-
-  protected:
-    int addTimer(callback_t callback, unsigned t, bool periodic);
-
-    static channelInfo *channels;
-};
-
-void tickTimer::tick()
-{
-    digitalWriteFast(4, HIGH);
-    for (unsigned i = 0; i < maxTimers; i++)
-    {
-        channelInfo *channel = channels + i;
-
-        if (channel->run && (ARM_DWT_CYCCNT - channel->start >= channel->delta))
-        {
-            if (channel->isPeriodic)
-                channel->start = ARM_DWT_CYCCNT;
-            else            
-                channel->run = false;            
-
-            channel->callback();
-        }
-    }
-    digitalWriteFast(4, LOW);
-}
-
-int tickTimer::addTimer(callback_t cb, unsigned delay, bool isPeriodic)
-{
-    for (unsigned i = 0; i < maxTimers; i++)
-    {
-        channelInfo *channel = channels + i;
-        if (channel->callback == nullptr)
-        {
-            channel->start = ARM_DWT_CYCCNT;
-            channel->isPeriodic = isPeriodic;
-            channel->callback = cb;
-            channel->delta = delay;
-            channel->run = true;
-
-            return i;
-        }
-    }
-    return -1;
-}
-
-tickTimer::tickTimer()
-{
-    ARM_DEMCR |= ARM_DEMCR_TRCENA;
-    ARM_DWT_CTRL |= ARM_DWT_CTRL_CYCCNTENA;
-}
-
-void tickTimer::setFrequency(unsigned f)
-{
-}
-
-channelInfo *tickTimer::channels = new channelInfo[tickTimer::maxTimers + 1];

+ 24 - 12
HTequi-firmware/src/blobcnc_low/main.cpp

@@ -188,33 +188,45 @@ void loop() {
 
      if(!msgIn.hasError()){
        //Serial.println("got OSC");
-       msgIn.dispatch("/A_low/move", [](OSCMessage &msg){A_low_step.move(msg.getInt(0), msg.getInt(1), msg.getInt(2));});
-       msgIn.dispatch("/A_low/moveTo", [](OSCMessage &msg){A_low_step.moveTo(msg.getInt(0), msg.getInt(1), msg.getInt(2));});
+       msgIn.dispatch("/A_low/move", [](OSCMessage &msg){A_low_step.move(msg.getInt(0));});
+       msgIn.dispatch("/A_low/moveTo", [](OSCMessage &msg){A_low_step.moveTo(msg.getInt(0));});
        msgIn.dispatch("/A_low/rotate", [](OSCMessage &msg){A_low_step.rotate(msg.getInt(0));});
        msgIn.dispatch("/A_low/stop", [](OSCMessage &msg){A_low_step.stop();});
        msgIn.dispatch("/A_low/emergency_stop", [](OSCMessage &msg){A_low_step.emergency_stop();});
-       msgIn.dispatch("/A_low/homing", [](OSCMessage &msg){A_low_step.homing(msg.getInt(0), msg.getInt(1));});
+       msgIn.dispatch("/A_low/homing", [](OSCMessage &msg){A_low_step.homing(msg.getInt(0));});
+       msgIn.dispatch("/A_low/setMaxSpeed", [](OSCMessage &msg){A_low_step.setMaxSpeed(msg.getInt(0));});
+       msgIn.dispatch("/A_low/setHomingSpeed", [](OSCMessage &msg){A_low_step.setHomingSpeed(msg.getInt(0));});
+       msgIn.dispatch("/A_low/setAcceleration", [](OSCMessage &msg){A_low_step.setAcceleration(msg.getInt(0));});
 
-       msgIn.dispatch("/B_low/move", [](OSCMessage &msg){B_low_step.move(msg.getInt(0), msg.getInt(1), msg.getInt(2));});
-       msgIn.dispatch("/B_low/moveTo", [](OSCMessage &msg){B_low_step.moveTo(msg.getInt(0), msg.getInt(1), msg.getInt(2));});
+       msgIn.dispatch("/B_low/move", [](OSCMessage &msg){B_low_step.move(msg.getInt(0));});
+       msgIn.dispatch("/B_low/moveTo", [](OSCMessage &msg){B_low_step.moveTo(msg.getInt(0));});
        msgIn.dispatch("/B_low/rotate", [](OSCMessage &msg){B_low_step.rotate(msg.getInt(0));});
        msgIn.dispatch("/B_low/stop", [](OSCMessage &msg){B_low_step.stop();});
        msgIn.dispatch("/B_low/emergency_stop", [](OSCMessage &msg){B_low_step.emergency_stop();});
-       msgIn.dispatch("/B_low/homing", [](OSCMessage &msg){B_low_step.homing(msg.getInt(0), msg.getInt(1));});
+       msgIn.dispatch("/B_low/homing", [](OSCMessage &msg){B_low_step.homing(msg.getInt(0));});
+       msgIn.dispatch("/B_low/setMaxSpeed", [](OSCMessage &msg){B_low_step.setMaxSpeed(msg.getInt(0));});
+       msgIn.dispatch("/B_low/setHomingSpeed", [](OSCMessage &msg){B_low_step.setHomingSpeed(msg.getInt(0));});
+       msgIn.dispatch("/B_low/setAcceleration", [](OSCMessage &msg){B_low_step.setAcceleration(msg.getInt(0));});
 
-       msgIn.dispatch("/TrBr_low/move", [](OSCMessage &msg){TrBr_low_step.move(msg.getInt(0), msg.getInt(1), msg.getInt(2));});
-       msgIn.dispatch("/TrBr_low/moveTo", [](OSCMessage &msg){TrBr_low_step.moveTo(msg.getInt(0), msg.getInt(1), msg.getInt(2));});
+       msgIn.dispatch("/TrBr_low/move", [](OSCMessage &msg){TrBr_low_step.move(msg.getInt(0));});
+       msgIn.dispatch("/TrBr_low/moveTo", [](OSCMessage &msg){TrBr_low_step.moveTo(msg.getInt(0));});
        msgIn.dispatch("/TrBr_low/rotate", [](OSCMessage &msg){TrBr_low_step.rotate(msg.getInt(0));});
        msgIn.dispatch("/TrBr_low/stop", [](OSCMessage &msg){TrBr_low_step.stop();});
        msgIn.dispatch("/TrBr_low/emergency_stop", [](OSCMessage &msg){TrBr_low_step.emergency_stop();});
-       msgIn.dispatch("/TrBr_low/homing", [](OSCMessage &msg){TrBr_low_step.homing(msg.getInt(0), msg.getInt(1));});
+       msgIn.dispatch("/TrBr_low/homing", [](OSCMessage &msg){TrBr_low_step.homing(msg.getInt(0));});
+       msgIn.dispatch("/A_low/setMaxSpeed", [](OSCMessage &msg){TrBr_low_step.setMaxSpeed(msg.getInt(0));});
+       msgIn.dispatch("/A_low/setHomingSpeed", [](OSCMessage &msg){TrBr_low_step.setHomingSpeed(msg.getInt(0));});
+       msgIn.dispatch("/A_low/setAcceleration", [](OSCMessage &msg){TrBr_low_step.setAcceleration(msg.getInt(0));});
 
-       msgIn.dispatch("/LevBr_low/move", [](OSCMessage &msg){LevBr_low_step.move(msg.getInt(0), msg.getInt(1), msg.getInt(2));});
-       msgIn.dispatch("/LevBr_low/moveTo", [](OSCMessage &msg){LevBr_low_step.moveTo(msg.getInt(0), msg.getInt(1), msg.getInt(2));});
+       msgIn.dispatch("/LevBr_low/move", [](OSCMessage &msg){LevBr_low_step.move(msg.getInt(0));});
+       msgIn.dispatch("/LevBr_low/moveTo", [](OSCMessage &msg){LevBr_low_step.moveTo(msg.getInt(0));});
        msgIn.dispatch("/LevBr_low/rotate", [](OSCMessage &msg){LevBr_low_step.rotate(msg.getInt(0));});
        msgIn.dispatch("/LevBr_low/stop", [](OSCMessage &msg){LevBr_low_step.stop();});
        msgIn.dispatch("/LevBr_low/emergency_stop", [](OSCMessage &msg){LevBr_low_step.emergency_stop();});
-       msgIn.dispatch("/LevBr_low/homing", [](OSCMessage &msg){LevBr_low_step.homing(msg.getInt(0), msg.getInt(1));});
+       msgIn.dispatch("/LevBr_low/homing", [](OSCMessage &msg){LevBr_low_step.homing(msg.getInt(0));});
+       msgIn.dispatch("/LevBr_low/setMaxSpeed", [](OSCMessage &msg){LevBr_low_step.setMaxSpeed(msg.getInt(0));});
+       msgIn.dispatch("/LevBr_low/setHomingSpeed", [](OSCMessage &msg){LevBr_low_step.setHomingSpeed(msg.getInt(0));});
+       msgIn.dispatch("/LevBr_low/setAcceleration", [](OSCMessage &msg){LevBr_low_step.setAcceleration(msg.getInt(0));});
        // B_low_OSC.onOSC(msgIn);
        // TrBr_low_OSC.onOSC(msgIn);
        // LevBr_low_OSC.onOSC(msgIn);

+ 23 - 15
HTequi-firmware/src/blobcnc_top/main.cpp

@@ -128,7 +128,7 @@ void feeder2_callback( int idx, int v, int up ) {
       Serial.println("got answer");
       return;
     case CMD_PILL_MOVE2:
-      bndl.add("/feeder1/pill/move").add(feeder2.arg( 1 ));
+      bndl.add("/feeder2/pill/move").add(feeder2.arg( 1 ));
       Serial.println("got answer");
       return;
   }
@@ -138,8 +138,8 @@ void feederOSC(OSCMessage &msg){
 
   msg.dispatch("/feeder1/barrel_home", [](OSCMessage &msg){Serial1.println("barrel_home ");Serial.println("barrel1");});
   msg.dispatch("/feeder1/pill", [](OSCMessage &msg){Serial1.println("pill ");Serial.println("pill1");});
-  msg.dispatch("/feeder1/barrel_move", [](OSCMessage &msg){Serial1.print("barrel_move ");Serial1.println(msg.getInt(0));Serial2.println(" ");Serial.println("pill1");});
-  msg.dispatch("/feeder1/pill_move", [](OSCMessage &msg){Serial1.print("pill_move ");Serial1.println(msg.getInt(0));Serial2.println(" ");Serial.println("pill1");});
+  msg.dispatch("/feeder1/barrel_move", [](OSCMessage &msg){Serial1.print("barrel_move ");Serial1.println(msg.getInt(0));Serial1.println(" ");Serial.println("pill1");});
+  msg.dispatch("/feeder1/pill_move", [](OSCMessage &msg){Serial1.print("pill_move ");Serial1.println(msg.getInt(0));Serial1.println(" ");Serial.println("pill1");});
   msg.dispatch("/feeder2/barrel_home", [](OSCMessage &msg){Serial2.println("barrel_home ");Serial.println("barrel2");});
   msg.dispatch("/feeder2/pill", [](OSCMessage &msg){Serial2.println("pill ");Serial.println("pill2");});
   msg.dispatch("/feeder2/barrel_move", [](OSCMessage &msg){Serial2.print("barrel_move ");Serial2.println(msg.getInt(0));Serial2.println(" ");Serial.println("pill2");});
@@ -161,10 +161,10 @@ void setup() {
   Udp.beginMulticast(ipMulti, portMulti); // for modified Teensy Ethernet library
   // Udp.begin(localPort);
 
-
+  delay(2000);
   //  SERIAL
   Serial.begin(115200); // higher Baud rate for faster refresh, CHANGE IN SERIAL MONITOR
-  delay(2000);
+
   Serial.println("Started Top");
 
   //  LED
@@ -233,14 +233,16 @@ void setup() {
 
   // FEEDERS
   Serial1.begin(9600);
+  delay(100);
   feeder1.begin( Serial1, feeder1_buffer, sizeof( feeder1_buffer ) )
-    //.trace(Serial)
+    .trace(Serial)
     .list( feeder1list )
     .onCommand( feeder1_callback );
 
   Serial2.begin(9600);
+  delay(100);
   feeder2.begin( Serial2, feeder2_buffer, sizeof( feeder2_buffer ) )
-    //.trace(Serial)
+    .trace(Serial)
     .list( feeder2list )
     .onCommand( feeder2_callback );
 
@@ -276,21 +278,27 @@ void loop() {
      if(!msgIn.hasError()){
        // Serial.println("got OSC");
        // msgIn.route("/blink", test);
-       msgIn.dispatch("/X_top/move", [](OSCMessage &msg){X_top_step.move(msg.getInt(0), msg.getInt(1), msg.getInt(2));});
-       msgIn.dispatch("/X_top/moveTo", [](OSCMessage &msg){X_top_step.moveTo(msg.getInt(0), msg.getInt(1), msg.getInt(2));});
+       feederOSC(msgIn);
+       msgIn.dispatch("/X_top/move", [](OSCMessage &msg){X_top_step.move(msg.getInt(0));});
+       msgIn.dispatch("/X_top/moveTo", [](OSCMessage &msg){X_top_step.moveTo(msg.getInt(0));});
        msgIn.dispatch("/X_top/rotate", [](OSCMessage &msg){X_top_step.rotate(msg.getInt(0));});
        msgIn.dispatch("/X_top/stop", [](OSCMessage &msg){X_top_step.stop();});
        msgIn.dispatch("/X_top/emergency_stop", [](OSCMessage &msg){X_top_step.emergency_stop();});
-       msgIn.dispatch("/X_top/homing", [](OSCMessage &msg){X_top_step.homing(msg.getInt(0), msg.getInt(1));});
+       msgIn.dispatch("/X_top/homing", [](OSCMessage &msg){X_top_step.homing(msg.getInt(0));});
+       msgIn.dispatch("/X_top/setMaxSpeed", [](OSCMessage &msg){X_top_step.setMaxSpeed(msg.getInt(0));});
+       msgIn.dispatch("/X_top/setHomingSpeed", [](OSCMessage &msg){X_top_step.setHomingSpeed(msg.getInt(0));});
+       msgIn.dispatch("/X_top/setAcceleration", [](OSCMessage &msg){X_top_step.setAcceleration(msg.getInt(0));});
 
-       msgIn.dispatch("/Y_top/move", [](OSCMessage &msg){Y_top_step.move(msg.getInt(0), msg.getInt(1), msg.getInt(2));});
-       msgIn.dispatch("/Y_top/moveTo", [](OSCMessage &msg){Y_top_step.moveTo(msg.getInt(0), msg.getInt(1), msg.getInt(2));});
+       msgIn.dispatch("/Y_top/move", [](OSCMessage &msg){Y_top_step.move(msg.getInt(0));});
+       msgIn.dispatch("/Y_top/moveTo", [](OSCMessage &msg){Y_top_step.moveTo(msg.getInt(0));});
        msgIn.dispatch("/Y_top/rotate", [](OSCMessage &msg){Y_top_step.rotate(msg.getInt(0));});
        msgIn.dispatch("/Y_top/stop", [](OSCMessage &msg){Y_top_step.stop();});
        msgIn.dispatch("/Y_top/emergency_stop", [](OSCMessage &msg){Y_top_step.emergency_stop();});
-       msgIn.dispatch("/Y_top/homing", [](OSCMessage &msg){Y_top_step.homing(msg.getInt(0), msg.getInt(1));});
-
-       feederOSC(msgIn);
+       msgIn.dispatch("/Y_top/homing", [](OSCMessage &msg){Y_top_step.homing(msg.getInt(0));});
+       msgIn.dispatch("/Y_top/setMaxSpeed", [](OSCMessage &msg){Y_top_step.setMaxSpeed(msg.getInt(0));});
+       msgIn.dispatch("/Y_top/setHomingSpeed", [](OSCMessage &msg){Y_top_step.setHomingSpeed(msg.getInt(0));});
+       msgIn.dispatch("/Y_top/setAcceleration", [](OSCMessage &msg){Y_top_step.setAcceleration(msg.getInt(0));});
+       // feederOSC(msgIn);
        motorsOSC(msgIn);
        // Y_top_step.onOSC(msgIn);
        // peristaltic.onOSC(msgIn);

File diff suppressed because it is too large
+ 3536 - 591
blob-CN/HTEQUI.noisette


File diff suppressed because it is too large
+ 3536 - 591
blob-CN/HTEQUI_autosave/HTEQUI_autosave_0.noisette


File diff suppressed because it is too large
+ 3790 - 547
blob-CN/HTEQUI_autosave/HTEQUI_autosave_1.noisette


File diff suppressed because it is too large
+ 3687 - 581
blob-CN/HTEQUI_autosave/HTEQUI_autosave_2.noisette


File diff suppressed because it is too large
+ 3568 - 581
blob-CN/HTEQUI_autosave/HTEQUI_autosave_3.noisette


File diff suppressed because it is too large
+ 3570 - 595
blob-CN/HTEQUI_autosave/HTEQUI_autosave_4.noisette


File diff suppressed because it is too large
+ 3945 - 561
blob-CN/HTEQUI_autosave/HTEQUI_autosave_5.noisette


File diff suppressed because it is too large
+ 3884 - 536
blob-CN/HTEQUI_autosave/HTEQUI_autosave_6.noisette


File diff suppressed because it is too large
+ 3917 - 533
blob-CN/HTEQUI_autosave/HTEQUI_autosave_7.noisette


File diff suppressed because it is too large
+ 3876 - 539
blob-CN/HTEQUI_autosave/HTEQUI_autosave_8.noisette


File diff suppressed because it is too large
+ 3876 - 539
blob-CN/HTEQUI_autosave/HTEQUI_autosave_9.noisette


File diff suppressed because it is too large
+ 6311 - 0
blob-CN/HTEQUI_backup.noisette