Browse Source

TMC2660.h comment tweaks

Scott Lahteine 5 years ago
parent
commit
9a6b90f47d
1 changed files with 63 additions and 68 deletions
  1. 63
    68
      Marlin/src/HAL/HAL_STM32F7/TMC2660.h

+ 63
- 68
Marlin/src/HAL/HAL_STM32F7/TMC2660.h View File

@@ -76,81 +76,79 @@
76 76
  * \class TMC26XStepper
77 77
  * \brief Class representing a TMC26X stepper driver
78 78
  *
79
- * In order to use one fo those drivers in your Arduino code you have to create an object of that class:
79
+ * To use one of these drivers in your code create an object of its class:
80 80
  * \code
81
- * TMC26XStepper stepper = TMC26XStepper(200,1,2,3,500);
81
+ * TMC26XStepper tmc_stepper = TMC26XStepper(200,1,2,3,500);
82 82
  * \endcode
83 83
  * see TMC26XStepper(int16_t number_of_steps, int16_t cs_pin, int16_t dir_pin, int16_t step_pin, uint16_t rms_current)
84 84
  *
85
- * Keep in mind that you need to start the driver with start() in order to get the TMC26X configured.
85
+ * Keep in mind that you need to start the driver with start() in order to configure the TMC26X.
86 86
  *
87
- * The most important function is the move(). It checks if the motor has to do a step or not.
88
- * It is important that you call move() as often as possible in your Arduino loop() routine. I suggest
89
- * to use a very fast loop routine and always call it at the beginning or the end.
87
+ * The most important function is move(). It checks if the motor requires a step. It's important to call move() as
88
+ * often as possible in loop(). I suggest using a very fast loop routine and always call move() at the beginning or end.
90 89
  *
91
- * In order to move you have to provide a movement speed with setSpeed(). The speed is a positive value setting
92
- * the rotations per minute.
90
+ * To move you must set a movement speed with setSpeed(). The speed is a positive value, setting the RPM.
93 91
  *
94 92
  * To really move the motor you have to call step() to tell the driver to move the motor the given number
95
- * of steps in the given direction. Positive values move the motor in one direction, negative values in the other direction.
93
+ * of steps in the given direction. Positive values move the motor in one direction, negative values in the other.
96 94
  *
97
- * You can check with isMoving() if the mototr is still moving or stop it  apruptely with stop().
95
+ * You can check with isMoving() if the motor is still moving or stop it abruptly with stop().
98 96
  */
99 97
 class TMC26XStepper {
100 98
   public:
101 99
     /*!
102
-     * \brief creates a new represenatation of a stepper motor connected to a TMC26X stepper driver
100
+     * \brief Create a new representation of a stepper motor connected to a TMC26X stepper driver
103 101
      *
104
-     * This is the main constructor. If in doubt use this. You must provide all parameters as described below.
102
+     * Main constructor. If in doubt use this. All parameters must be provided as described below.
105 103
      *
106
-     * \param number_of_steps the number of steps the motor has per rotation.
107
-     * \param cs_pin The Arduino pin you have connected the Cient Select Pin (!CS) of the TMC26X for SPI
108
-     * \param dir_pin the number of the Arduino pin the Direction input of the TMC26X is connected
109
-     * \param step_pin the number of the Arduino pin the step pin of the TMC26X driver is connected.
110
-     * \param rms_current the maximum current to privide to the motor in mA (!). A value of 200 would send up to 200mA to the motor
111
-     * \param resistor the current sense resistor in milli Ohm, defaults to ,15 Ohm ( or 150 milli Ohm) as in the TMC260 Arduino Shield
104
+     * \param number_of_steps Number of steps the motor has per rotation.
105
+     * \param cs_pin          Arduino pin connected to the Client Select Pin (!CS) of the TMC26X for SPI.
106
+     * \param dir_pin         Arduino pin connected to the DIR input of the TMC26X.
107
+     * \param step_pin        Arduino pin connected to the STEP pin of the TMC26X.
108
+     * \param rms_current     Maximum current to provide to the motor in mA (!). A value of 200 will send up to 200mA to the motor.
109
+     * \param resistor        Current sense resistor in milli-Ohm, defaults to 0.15 Ohm (or 150 milli-Ohm) as in the TMC260 Arduino Shield.
112 110
      *
113
-     * Keep in mind that you must also call TMC26XStepper.start() in order to configure the stepper driver for use.
111
+     * You must also call TMC26XStepper.start() to configure the stepper driver for use.
114 112
      *
115
-     * By default the Constant Off Time chopper is used, see TMC26XStepper.setConstantOffTimeChopper() for details.
116
-     * This should work on most motors (YMMV). You may want to configure and use the Spread Cycle Chopper, see  setSpreadCycleChopper().
113
+     * By default the Constant Off Time chopper is used. See TMC26XStepper.setConstantOffTimeChopper() for details.
114
+     * This should work on most motors (YMMV). You may want to configure and use the Spread Cycle Chopper. See setSpreadCycleChopper().
117 115
      *
118
-     * By default a microstepping of 1/32th is used to provide a smooth motor run, while still giving a good progression per step.
119
-     * You can select a different stepping with setMicrosteps() to aa different value.
116
+     * By default a microstepping of 1/32 is used to provide a smooth motor run while still giving a good progression per step.
117
+     * Change stepping by sending setMicrosteps() a different value.
120 118
      * \sa start(), setMicrosteps()
121 119
      */
122 120
     TMC26XStepper(const int16_t in_steps, int16_t cs_pin, int16_t dir_pin, int16_t step_pin, uint16_t current, uint16_t resistor=100); //resistor=150
123 121
 
124 122
     /*!
125
-     * \brief configures and starts the TMC26X stepper driver. Before you called this function the stepper driver is in nonfunctional mode.
123
+     * \brief Configure and start the TMC26X stepper driver. Before this is called the stepper driver is nonfunctional.
126 124
      *
127
-     * This routine configures the TMC26X stepper driver for the given values via SPI.
128
-     * Most member functions are non functional if the driver has not been started.
129
-     * Therefore it is best to call this in your Arduino setup() function.
125
+     * Configure the TMC26X stepper driver for the given values via SPI.
126
+     * Most member functions are non-functional if the driver has not been started,
127
+     * therefore it is best to call this in setup().
130 128
      */
131 129
     void start();
132 130
 
133 131
     /*!
134
-     * \brief resets the stepper in unconfigured mode.
132
+     * \brief Reset the stepper in unconfigured mode.
135 133
      *
136
-     * This routine enables you to call start again. It does not change anything
137
-     * in the internal stepper configuration or the desired configuration.
138
-     * It just marks the stepper as not yet startet. You do not have to reconfigure
139
-     * the stepper to start it again, but it is not reset to any factory settings
140
-     * this has to be configured back by yourself.
134
+     * Allows start to be called again. It doesn't change the internal stepper
135
+     * configuration or the desired configuration. It just marks the stepper as
136
+     * not-yet-started. The stepper doesn't need to be reconfigured before
137
+     * starting again, and is not reset to any factory settings.
138
+     * It must be reset intentionally.
141 139
      * (Hint: Normally you do not need this function)
142 140
      */
143 141
     void un_start();
144 142
 
145 143
 
146 144
     /*!
147
-     * \brief Sets the rotation speed in revolutions per minute.
148
-     * \param whatSpeed the desired speed in rotations per minute.
145
+     * \brief Set the rotation speed in RPM.
146
+     * \param whatSpeed the desired speed in RPM.
149 147
      */
150 148
     void setSpeed(uint16_t whatSpeed);
151 149
 
152 150
     /*!
153
-     * \brief reads out the currently selected speed in revolutions per minute.
151
+     * \brief Report the currently selected speed in RPM.
154 152
      * \sa setSpeed()
155 153
      */
156 154
     uint16_t getSpeed(void);
@@ -158,89 +156,86 @@ class TMC26XStepper {
158 156
     /*!
159 157
      * \brief Set the number of microsteps in 2^i values (rounded) up to 256
160 158
      *
161
-     * This method set's the number of microsteps per step in 2^i interval.
162
-     * This means you can select 1, 2, 4, 16, 32, 64, 128 or 256 as valid microsteps.
163
-     * If you give any other value it will be rounded to the next smaller number (3 would give a microstepping of 2).
159
+     * This method sets the number of microsteps per step in 2^i interval.
160
+     * It accepts 1, 2, 4, 16, 32, 64, 128 or 256 as valid microsteps.
161
+     * Other values will be rounded down to the next smaller value (e.g., 3 gives a microstepping of 2).
164 162
      * You can always check the current microstepping with getMicrosteps().
165 163
      */
166 164
     void setMicrosteps(const int16_t in_steps);
167 165
 
168 166
     /*!
169
-     * \brief returns the effective current number of microsteps selected.
167
+     * \brief Return the effective current number of microsteps selected.
170 168
      *
171
-     * This function always returns the effective number of microsteps.
172
-     * This can be a bit different than the micro steps set in setMicrosteps() since it is rounded to 2^i.
169
+     * Always returns the effective number of microsteps.
170
+     * This may be different from the micro-steps set in setMicrosteps() since it is rounded to 2^i.
173 171
      *
174 172
      * \sa setMicrosteps()
175 173
      */
176 174
     int16_t getMicrosteps(void);
177 175
 
178 176
     /*!
179
-     * \brief Initiate a movement for the given number of steps. Positive numbers move in one, negative numbers in the other direction.
177
+     * \brief Initiate a movement with the given number of steps. Positive values move in one direction, negative in the other.
180 178
      *
181 179
      * \param number_of_steps The number of steps to move the motor.
182 180
      * \return 0 if the motor was not moving and moves now. -1 if the motor is moving and the new steps could not be set.
183 181
      *
184
-     * If the previous movement is not finished yet the function will return -1 and not change the steps to move the motor.
185
-     * If the motor does not move it return 0
182
+     * If the previous movement is incomplete the function returns -1 and doesn't change the steps to move the motor.
183
+     * If the motor does not move it returns 0.
186 184
      *
187
-     * The direction of the movement is indicated by the sign of the steps parameter. It is not determinable if positive values are right
188
-     * or left This depends on the internal construction of the motor and how you connected it to the stepper driver.
185
+     * The movement direction is determined by the sign of the steps parameter. The motor direction in machine space
186
+     * cannot be determined, as it depends on the construction of the motor and how it functions in the drive system.
189 187
      *
190
-     * You can always verify with isMoving() or even use stop() to stop the motor before giving it new step directions.
188
+     * For safety, verify with isMoving() or even use stop() to stop the motor before giving it new step directions.
191 189
      * \sa isMoving(), getStepsLeft(), stop()
192 190
      */
193 191
     char step(int16_t number_of_steps);
194 192
 
195 193
     /*!
196
-     * \brief Central movement method, must be called as often as possible in the lopp function and is very fast.
194
+     * \brief Central movement method. Must be called as often as possible in the loop function and is very fast.
197 195
      *
198
-     * This routine checks if the motor still has to move, if the waiting delay has passed to send a new step command to the motor
199
-     * and manages the number of steps yet to move to fulfill the current move command.
196
+     * Check if the motor still has to move and whether the wait-to-step interval has expired, and manages the
197
+     * number of steps remaining to fulfill the current move command.
200 198
      *
201
-     * This function is implemented to be as fast as possible to call it as often as possible in your loop routine.
202
-     * The more regurlarly you call this function the better. In both senses of 'regularly': Calling it as often as
203
-     * possible is not a bad idea and if you even manage that the intervals you call this function are not too irregular helps too.
199
+     * This function is implemented to be as fast as possible, so call it as often as possible in your loop.
200
+     * It should be invoked with as frequently and with as much regularity as possible.
204 201
      *
205
-     * You can call this routine even if you know that the motor is not moving. It introduces just a very small penalty in your code.
206
-     * You must not call isMoving() to determine if you need to call this function, since taht is done internally already and only
207
-     * slows down you code.
202
+     * This can be called even when the motor is known not to be moving. It will simply return.
208 203
      *
209
-     * How often you call this function directly influences your top moving speed for the motor. It may be a good idea to call this
210
-     * from a timer overflow interrupt to ensure proper calling.
204
+     * The frequency with which this function is called determines the top stepping speed of the motor.
205
+     * It is recommended to call this using a hardware timer to ensure regular invocation.
211 206
      * \sa step()
212 207
      */
213 208
     char move(void);
214 209
 
215 210
     /*!
216
-     * \brief checks if the motor still has to move to fulfill the last movement command.
211
+     * \brief Check whether the last movement command is done.
217 212
      * \return 0 if the motor stops, -1 if the motor is moving.
218 213
      *
219
-     * This method can be used to determine if the motor is ready for new movements.
214
+     * Used to determine if the motor is ready for new movements.
220 215
      *\sa step(), move()
221 216
      */
222 217
     char isMoving(void);
223 218
 
224 219
     /*!
225 220
      * \brief Get the number of steps left in the current movement.
226
-     * \return The number of steps left in the movement. This number is always positive.
221
+     * \return The number of steps left in the movement. Always positive.
227 222
      */
228 223
     uint16_t getStepsLeft(void);
229 224
 
230 225
     /*!
231
-     * \brief Stops the motor regardless if it moves or not.
226
+     * \brief Stop the motor immediately.
232 227
      * \return -1 if the motor was moving and is really stoped or 0 if it was not moving at all.
233 228
      *
234
-     * This method directly and apruptely stops the motor and may be used as an emergency stop.
229
+     * This method directly and abruptly stops the motor and may be used as an emergency stop.
235 230
      */
236 231
     char stop(void);
237 232
 
238 233
     /*!
239
-     * \brief Sets and configure the classical Constant Off Timer Chopper
240
-     * \param constant_off_time The off time setting controls the minimum chopper frequency. For most applications an off time within the range of 5μs to 20μs will fit. Setting this parameter to zero completely disables all driver transistors and the motor can free-wheel. 0: chopper off, 1:15: off time setting (1 will work with minimum blank time of 24 clocks)
241
-     * \param blank_time Selects the comparator blank time. This time needs to safely cover the switching event and the duration of the ringing on the sense resistor. For most low current drivers, a setting of 1 or 2 is good. For high current applications with large MOSFETs, a setting of 2 or 3 will be required. 0 (min setting) … (3) amx setting
234
+     * \brief Set and configure the classical Constant Off Timer Chopper
235
+     * \param constant_off_time       The off time setting controls the minimum chopper frequency. For most applications an off time within the range of 5μs to 20μs will fit. Setting this parameter to zero completely disables all driver transistors and the motor can free-wheel. 0: chopper off, 1:15: off time setting (1 will work with minimum blank time of 24 clocks)
236
+     * \param blank_time              Comparator blank time. This duration needs to safely cover the duration of the switching event and the ringing on the sense resistor. For most low current drivers, a setting of 1 or 2 is good. For high current applications with large MOSFETs, a setting of 2 or 3 will be required. 0 (min setting) … (3) amx setting
242 237
      * \param fast_decay_time_setting Fast decay time setting. Controls the portion of fast decay for each chopper cycle. 0: slow decay only, 1…15: duration of fast decay phase
243
-     * \param sine_wave_offset Sine wave offset. Controls the sine wave offset. A positive offset corrects for zero crossing error. -3…-1: negative offset, 0: no offset,1…12: positive offset
238
+     * \param sine_wave_offset        Sine wave offset. Controls the sine wave offset. A positive offset corrects for zero crossing error. -3…-1: negative offset, 0: no offset,1…12: positive offset
244 239
      * \param use_curreent_comparator Selects usage of the current comparator for termination of the fast decay cycle. If current comparator is enabled, it terminates the fast decay cycle in case the current reaches a higher negative value than the actual positive value. (0 disable, -1 enable).
245 240
      *
246 241
      * The classic constant off time chopper uses a fixed portion of fast decay following each on phase.

Loading…
Cancel
Save