Clean up trailing whitespace

This commit is contained in:
Scott Lahteine 2018-01-21 17:13:56 -06:00
parent b46932f0c0
commit 382a5e3318
8 changed files with 112 additions and 112 deletions

View file

@ -48,7 +48,7 @@
* @{ * @{
*/ */
#ifdef STM32F7 #ifdef STM32F7
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include "eeprom_emul.h" #include "eeprom_emul.h"

View file

@ -1,17 +1,17 @@
# This HAL is for the STM32F765 board "The Borg" used with STM32Generic Arduino core by danieleff. # This HAL is for the STM32F765 board "The Borg" used with STM32Generic Arduino core by danieleff.
# Original core is located at: # Original core is located at:
https://github.com/danieleff/STM32GENERIC https://github.com/danieleff/STM32GENERIC
but i have not committed the changes needed for the Borg there yet, so please use: but i have not committed the changes needed for the Borg there yet, so please use:
https://github.com/Spawn32/STM32GENERIC https://github.com/Spawn32/STM32GENERIC
Unzip it into [Arduino]/hardware folder Unzip it into [Arduino]/hardware folder
Download the latest GNU ARM Embedded Toolchain: Download the latest GNU ARM Embedded Toolchain:
https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads

View file

@ -1,20 +1,20 @@
/** /**
* TMC26XStepper.cpp - - TMC26X Stepper library for Wiring/Arduino * TMC26XStepper.cpp - - TMC26X Stepper library for Wiring/Arduino
* *
* based on the stepper library by Tom Igoe, et. al. * based on the stepper library by Tom Igoe, et. al.
* *
* Copyright (c) 2011, Interactive Matter, Marcus Nowotny * Copyright (c) 2011, Interactive Matter, Marcus Nowotny
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights * in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is * copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: * furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -831,7 +831,7 @@ void TMC26XStepper::debugLastStatus() {
SERIAL_ECHOLNPGM("\n WARNING: Overtemperature Prewarning!"); SERIAL_ECHOLNPGM("\n WARNING: Overtemperature Prewarning!");
else if (this->getOverTemperature()&TMC26X_OVERTEMPERATURE_SHUTDOWN) else if (this->getOverTemperature()&TMC26X_OVERTEMPERATURE_SHUTDOWN)
SERIAL_ECHOLNPGM("\n ERROR: Overtemperature Shutdown!"); SERIAL_ECHOLNPGM("\n ERROR: Overtemperature Shutdown!");
if (this->isShortToGroundA()) if (this->isShortToGroundA())
SERIAL_ECHOLNPGM("\n ERROR: SHORT to ground on channel A!"); SERIAL_ECHOLNPGM("\n ERROR: SHORT to ground on channel A!");

View file

@ -1,20 +1,20 @@
/** /**
* TMC26XStepper.h - - TMC26X Stepper library for Wiring/Arduino * TMC26XStepper.h - - TMC26X Stepper library for Wiring/Arduino
* *
* based on the stepper library by Tom Igoe, et. al. * based on the stepper library by Tom Igoe, et. al.
* *
* Copyright (c) 2011, Interactive Matter, Marcus Nowotny * Copyright (c) 2011, Interactive Matter, Marcus Nowotny
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights * in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is * copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: * furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -33,16 +33,16 @@
//! return value for TMC26XStepper.getOverTemperature() if there is a overtemperature situation in the TMC chip //! return value for TMC26XStepper.getOverTemperature() if there is a overtemperature situation in the TMC chip
/*! /*!
* This warning indicates that the TCM chip is too warm. * This warning indicates that the TCM chip is too warm.
* It is still working but some parameters may be inferior. * It is still working but some parameters may be inferior.
* You should do something against it. * You should do something against it.
*/ */
#define TMC26X_OVERTEMPERATURE_PREWARING 1 #define TMC26X_OVERTEMPERATURE_PREWARING 1
//! return value for TMC26XStepper.getOverTemperature() if there is a overtemperature shutdown in the TMC chip //! return value for TMC26XStepper.getOverTemperature() if there is a overtemperature shutdown in the TMC chip
/*! /*!
* This warning indicates that the TCM chip is too warm to operate and has shut down to prevent damage. * This warning indicates that the TCM chip is too warm to operate and has shut down to prevent damage.
* It will stop working until it cools down again. * It will stop working until it cools down again.
* If you encouter this situation you must do something against it. Like reducing the current or improving the PCB layout * If you encouter this situation you must do something against it. Like reducing the current or improving the PCB layout
* and/or heat management. * and/or heat management.
*/ */
#define TMC26X_OVERTEMPERATURE_SHUTDOWN 2 #define TMC26X_OVERTEMPERATURE_SHUTDOWN 2
@ -78,7 +78,7 @@
/*! /*!
* \class TMC26XStepper * \class TMC26XStepper
* \brief Class representing a TMC26X stepper driver * \brief Class representing a TMC26X stepper driver
* *
* In order to use one fo those drivers in your Arduino code you have to create an object of that class: * In order to use one fo those drivers in your Arduino code you have to create an object of that class:
* \code * \code
* TMC26XStepper stepper = TMC26XStepper(200,1,2,3,500); * TMC26XStepper stepper = TMC26XStepper(200,1,2,3,500);
@ -86,7 +86,7 @@
* see TMC26XStepper(int number_of_steps, int cs_pin, int dir_pin, int step_pin, unsigned int rms_current) * see TMC26XStepper(int number_of_steps, int cs_pin, int dir_pin, int step_pin, unsigned int rms_current)
* *
* Keep in mind that you need to start the driver with start() in order to get the TMC26X configured. * Keep in mind that you need to start the driver with start() in order to get the TMC26X configured.
* *
* The most important function is the move(). It checks if the motor has to do a step or not. * The most important function is the move(). It checks if the motor has to do a step or not.
* It is important that you call move() as often as possible in your Arduino loop() routine. I suggest * It is important that you call move() as often as possible in your Arduino loop() routine. I suggest
* to use a very fast loop routine and always call it at the beginning or the end. * to use a very fast loop routine and always call it at the beginning or the end.
@ -94,7 +94,7 @@
* In order to move you have to provide a movement speed with setSpeed(). The speed is a positive value setting * In order to move you have to provide a movement speed with setSpeed(). The speed is a positive value setting
* the rotations per minute. * the rotations per minute.
* *
* To really move the motor you have to call step() to tell the driver to move the motor the given number * To really move the motor you have to call step() to tell the driver to move the motor the given number
* of steps in the given direction. Positive values move the motor in one direction, negative values in the other direction. * of steps in the given direction. Positive values move the motor in one direction, negative values in the other direction.
* *
* You can check with isMoving() if the mototr is still moving or stop it apruptely with stop(). * You can check with isMoving() if the mototr is still moving or stop it apruptely with stop().
@ -115,7 +115,7 @@ class TMC26XStepper {
* *
* Keep in mind that you must also call TMC26XStepper.start() in order to configure the stepper driver for use. * Keep in mind that you must also call TMC26XStepper.start() in order to configure the stepper driver for use.
* *
* By default the Constant Off Time chopper is used, see TCM262Stepper.setConstantOffTimeChopper() for details. * By default the Constant Off Time chopper is used, see TCM262Stepper.setConstantOffTimeChopper() for details.
* This should work on most motors (YMMV). You may want to configure and use the Spread Cycle Chopper, see setSpreadCycleChopper(). * This should work on most motors (YMMV). You may want to configure and use the Spread Cycle Chopper, see setSpreadCycleChopper().
* *
* By default a microstepping of 1/32th is used to provide a smooth motor run, while still giving a good progression per step. * By default a microstepping of 1/32th is used to provide a smooth motor run, while still giving a good progression per step.
@ -123,20 +123,20 @@ class TMC26XStepper {
* \sa start(), setMicrosteps() * \sa start(), setMicrosteps()
*/ */
TMC26XStepper(int number_of_steps, int cs_pin, int dir_pin, int step_pin, unsigned int current, unsigned int resistor=100); //resistor=150 TMC26XStepper(int number_of_steps, int cs_pin, int dir_pin, int step_pin, unsigned int current, unsigned int resistor=100); //resistor=150
/*! /*!
* \brief configures and starts the TMC26X stepper driver. Before you called this function the stepper driver is in nonfunctional mode. * \brief configures and starts the TMC26X stepper driver. Before you called this function the stepper driver is in nonfunctional mode.
* *
* This routine configures the TMC26X stepper driver for the given values via SPI. * This routine configures the TMC26X stepper driver for the given values via SPI.
* Most member functions are non functional if the driver has not been started. * Most member functions are non functional if the driver has not been started.
* Therefore it is best to call this in your Arduino setup() function. * Therefore it is best to call this in your Arduino setup() function.
*/ */
void start(); void start();
/*! /*!
* \brief resets the stepper in unconfigured mode. * \brief resets the stepper in unconfigured mode.
* *
* This routine enables you to call start again. It does not change anything * This routine enables you to call start again. It does not change anything
* in the internal stepper configuration or the desired configuration. * in the internal stepper configuration or the desired configuration.
* It just marks the stepper as not yet startet. You do not have to reconfigure * It just marks the stepper as not yet startet. You do not have to reconfigure
* the stepper to start it again, but it is not reset to any factory settings * the stepper to start it again, but it is not reset to any factory settings
@ -151,7 +151,7 @@ class TMC26XStepper {
* \param whatSpeed the desired speed in rotations per minute. * \param whatSpeed the desired speed in rotations per minute.
*/ */
void setSpeed(unsigned int whatSpeed); void setSpeed(unsigned int whatSpeed);
/*! /*!
* \brief reads out the currently selected speed in revolutions per minute. * \brief reads out the currently selected speed in revolutions per minute.
* \sa setSpeed() * \sa setSpeed()
@ -164,14 +164,14 @@ class TMC26XStepper {
* This method set's the number of microsteps per step in 2^i interval. * This method set's the number of microsteps per step in 2^i interval.
* This means you can select 1, 2, 4, 16, 32, 64, 128 or 256 as valid microsteps. * This means you can select 1, 2, 4, 16, 32, 64, 128 or 256 as valid microsteps.
* If you give any other value it will be rounded to the next smaller number (3 would give a microstepping of 2). * If you give any other value it will be rounded to the next smaller number (3 would give a microstepping of 2).
* You can always check the current microstepping with getMicrosteps(). * You can always check the current microstepping with getMicrosteps().
*/ */
void setMicrosteps(int number_of_steps); void setMicrosteps(int number_of_steps);
/*! /*!
* \brief returns the effective current number of microsteps selected. * \brief returns the effective current number of microsteps selected.
* *
* This function always returns the effective number of microsteps. * This function always returns the effective number of microsteps.
* This can be a bit different than the micro steps set in setMicrosteps() since it is rounded to 2^i. * This can be a bit different than the micro steps set in setMicrosteps() since it is rounded to 2^i.
* *
* \sa setMicrosteps() * \sa setMicrosteps()
@ -187,18 +187,18 @@ class TMC26XStepper {
* If the previous movement is not finished yet the function will return -1 and not change the steps to move the motor. * If the previous movement is not finished yet the function will return -1 and not change the steps to move the motor.
* If the motor does not move it return 0 * If the motor does not move it return 0
* *
* The direction of the movement is indicated by the sign of the steps parameter. It is not determinable if positive values are right * The direction of the movement is indicated by the sign of the steps parameter. It is not determinable if positive values are right
* or left This depends on the internal construction of the motor and how you connected it to the stepper driver. * or left This depends on the internal construction of the motor and how you connected it to the stepper driver.
* *
* You can always verify with isMoving() or even use stop() to stop the motor before giving it new step directions. * You can always verify with isMoving() or even use stop() to stop the motor before giving it new step directions.
* \sa isMoving(), getStepsLeft(), stop() * \sa isMoving(), getStepsLeft(), stop()
*/ */
char step(int number_of_steps); char step(int number_of_steps);
/*! /*!
* \brief Central movement method, must be called as often as possible in the lopp function and is very fast. * \brief Central movement method, must be called as often as possible in the lopp function and is very fast.
* *
* 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 * 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
* and manages the number of steps yet to move to fulfill the current move command. * and manages the number of steps yet to move to fulfill the current move command.
* *
* This function is implemented to be as fast as possible to call it as often as possible in your loop routine. * This function is implemented to be as fast as possible to call it as often as possible in your loop routine.
@ -206,9 +206,9 @@ class TMC26XStepper {
* possible is not a bad idea and if you even manage that the intervals you call this function are not too irregular helps too. * possible is not a bad idea and if you even manage that the intervals you call this function are not too irregular helps too.
* *
* You can call this routine even if you know that the motor is not miving. It introduces just a very small penalty in your code. * You can call this routine even if you know that the motor is not miving. It introduces just a very small penalty in your code.
* You must not call isMoving() to determine if you need to call this function, since taht is done internally already and only * You must not call isMoving() to determine if you need to call this function, since taht is done internally already and only
* slows down you code. * slows down you code.
* *
* How often you call this function directly influences your top miving speed for the motor. It may be a good idea to call this * How often you call this function directly influences your top miving speed for the motor. It may be a good idea to call this
* from an timer overflow interrupt to ensure proper calling. * from an timer overflow interrupt to ensure proper calling.
* \sa step() * \sa step()
@ -223,13 +223,13 @@ class TMC26XStepper {
*\sa step(), move() *\sa step(), move()
*/ */
char isMoving(void); char isMoving(void);
/*! /*!
* \brief Get the number of steps left in the current movement. * \brief Get the number of steps left in the current movement.
* \return The number of steps left in the movement. This number is always positive. * \return The number of steps left in the movement. This number is always positive.
*/ */
unsigned int getStepsLeft(void); unsigned int getStepsLeft(void);
/*! /*!
* \brief Stops the motor regardless if it moves or not. * \brief Stops the motor regardless if it moves or not.
* \return -1 if the motor was moving and is really stoped or 0 if it was not moving at all. * \return -1 if the motor was moving and is really stoped or 0 if it was not moving at all.
@ -237,7 +237,7 @@ class TMC26XStepper {
* This method directly and apruptely stops the motor and may be used as an emergency stop. * This method directly and apruptely stops the motor and may be used as an emergency stop.
*/ */
char stop(void); char stop(void);
/*! /*!
* \brief Sets and configure the classical Constant Off Timer Chopper * \brief Sets and configure the classical Constant Off Timer Chopper
* \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) * \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)
@ -246,16 +246,16 @@ class TMC26XStepper {
* \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,112: positive offset * \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,112: positive offset
* \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). * \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).
* *
* The classic constant off time chopper uses a fixed portion of fast decay following each on phase. * The classic constant off time chopper uses a fixed portion of fast decay following each on phase.
* While the duration of the on time is determined by the chopper comparator, the fast decay time needs * While the duration of the on time is determined by the chopper comparator, the fast decay time needs
* to be set by the user in a way, that the current decay is enough for the driver to be able to follow * to be set by the user in a way, that the current decay is enough for the driver to be able to follow
* the falling slope of the sine wave, and on the other hand it should not be too long, in order to minimize * the falling slope of the sine wave, and on the other hand it should not be too long, in order to minimize
* motor current ripple and power dissipation. This best can be tuned using an oscilloscope or * motor current ripple and power dissipation. This best can be tuned using an oscilloscope or
* trying out motor smoothness at different velocities. A good starting value is a fast decay time setting * trying out motor smoothness at different velocities. A good starting value is a fast decay time setting
* similar to the slow decay time setting. * similar to the slow decay time setting.
* After tuning of the fast decay time, the offset should be determined, in order to have a smooth zero transition. * After tuning of the fast decay time, the offset should be determined, in order to have a smooth zero transition.
* This is necessary, because the fast decay phase leads to the absolute value of the motor current being lower * This is necessary, because the fast decay phase leads to the absolute value of the motor current being lower
* than the target current (see figure 17). If the zero offset is too low, the motor stands still for a short * than the target current (see figure 17). If the zero offset is too low, the motor stands still for a short
* moment during current zero crossing, if it is set too high, it makes a larger microstep. * moment during current zero crossing, if it is set too high, it makes a larger microstep.
* Typically, a positive offset setting is required for optimum operation. * Typically, a positive offset setting is required for optimum operation.
* *
@ -263,7 +263,7 @@ class TMC26XStepper {
* \sa setRandomOffTime() for spreading the noise over a wider spectrum * \sa setRandomOffTime() for spreading the noise over a wider spectrum
*/ */
void setConstantOffTimeChopper(char constant_off_time, char blank_time, char fast_decay_time_setting, char sine_wave_offset, unsigned char use_current_comparator); void setConstantOffTimeChopper(char constant_off_time, char blank_time, char fast_decay_time_setting, char sine_wave_offset, unsigned char use_current_comparator);
/*! /*!
* \brief Sets and configures with spread cycle chopper. * \brief Sets and configures with spread cycle chopper.
* \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) * \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)
@ -272,16 +272,16 @@ class TMC26XStepper {
* \param hysteresis_end Hysteresis end setting. Sets the hysteresis end value after a number of decrements. Decrement interval time is controlled by hysteresis_decrement. The sum hysteresis_start + hysteresis_end must be <16. At a current setting CS of max. 30 (amplitude reduced to 240), the sum is not limited. * \param hysteresis_end Hysteresis end setting. Sets the hysteresis end value after a number of decrements. Decrement interval time is controlled by hysteresis_decrement. The sum hysteresis_start + hysteresis_end must be <16. At a current setting CS of max. 30 (amplitude reduced to 240), the sum is not limited.
* \param hysteresis_decrement Hysteresis decrement setting. This setting determines the slope of the hysteresis during on time and during fast decay time. 0 (fast decrement) 3 (slow decrement). * \param hysteresis_decrement Hysteresis decrement setting. This setting determines the slope of the hysteresis during on time and during fast decay time. 0 (fast decrement) 3 (slow decrement).
* *
* The spreadCycle chopper scheme (pat.fil.) is a precise and simple to use chopper principle, which automatically determines * The spreadCycle chopper scheme (pat.fil.) is a precise and simple to use chopper principle, which automatically determines
* the optimum fast decay portion for the motor. Anyhow, a number of settings can be made in order to optimally fit the driver * the optimum fast decay portion for the motor. Anyhow, a number of settings can be made in order to optimally fit the driver
* to the motor. * to the motor.
* Each chopper cycle is comprised of an on-phase, a slow decay phase, a fast decay phase and a second slow decay phase. * Each chopper cycle is comprised of an on-phase, a slow decay phase, a fast decay phase and a second slow decay phase.
* The slow decay phases limit the maximum chopper frequency and are important for low motor and driver power dissipation. * The slow decay phases limit the maximum chopper frequency and are important for low motor and driver power dissipation.
* The hysteresis start setting limits the chopper frequency by forcing the driver to introduce a minimum amount of * The hysteresis start setting limits the chopper frequency by forcing the driver to introduce a minimum amount of
* current ripple into the motor coils. The motor inductivity determines the ability to follow a changing motor current. * current ripple into the motor coils. The motor inductivity determines the ability to follow a changing motor current.
* The duration of the on- and fast decay phase needs to cover at least the blank time, because the current comparator is * The duration of the on- and fast decay phase needs to cover at least the blank time, because the current comparator is
* disabled during this time. * disabled during this time.
* *
* \sa setRandomOffTime() for spreading the noise over a wider spectrum * \sa setRandomOffTime() for spreading the noise over a wider spectrum
*/ */
void setSpreadCycleChopper(char constant_off_time, char blank_time, char hysteresis_start, char hysteresis_end, char hysteresis_decrement); void setSpreadCycleChopper(char constant_off_time, char blank_time, char hysteresis_start, char hysteresis_end, char hysteresis_decrement);
@ -290,19 +290,19 @@ class TMC26XStepper {
* \brief Use random off time for noise reduction (0 for off, -1 for on). * \brief Use random off time for noise reduction (0 for off, -1 for on).
* \param value 0 for off, -1 for on * \param value 0 for off, -1 for on
* *
* In a constant off time chopper scheme both coil choppers run freely, i.e. are not synchronized. * In a constant off time chopper scheme both coil choppers run freely, i.e. are not synchronized.
* The frequency of each chopper mainly depends on the coil current and the position dependant motor coil inductivity, * The frequency of each chopper mainly depends on the coil current and the position dependant motor coil inductivity,
* thus it depends on the microstep position. With some motors a slightly audible beat can occur between the chopper * thus it depends on the microstep position. With some motors a slightly audible beat can occur between the chopper
* frequencies, especially when they are near to each other. This typically occurs at a few microstep positions within * frequencies, especially when they are near to each other. This typically occurs at a few microstep positions within
* each quarter wave. * each quarter wave.
* This effect normally is not audible when compared to mechanical noise generated by ball bearings, * This effect normally is not audible when compared to mechanical noise generated by ball bearings,
* etc. Further factors which can cause a similar effect are a poor layout of sense resistor GND connection. * etc. Further factors which can cause a similar effect are a poor layout of sense resistor GND connection.
* In order to minimize the effect of a beat between both chopper frequencies, an internal random generator is provided. * In order to minimize the effect of a beat between both chopper frequencies, an internal random generator is provided.
* It modulates the slow decay time setting when switched on. The random off time feature further spreads the chopper spectrum, * It modulates the slow decay time setting when switched on. The random off time feature further spreads the chopper spectrum,
* reducing electromagnetic emission on single frequencies. * reducing electromagnetic emission on single frequencies.
*/ */
void setRandomOffTime(char value); void setRandomOffTime(char value);
/*! /*!
* \brief set the maximum motor current in mA (1000 is 1 Amp) * \brief set the maximum motor current in mA (1000 is 1 Amp)
* Keep in mind this is the maximum peak Current. The RMS current will be 1/sqrt(2) smaller. The actual current can also be smaller * Keep in mind this is the maximum peak Current. The RMS current will be 1/sqrt(2) smaller. The actual current can also be smaller
@ -311,7 +311,7 @@ class TMC26XStepper {
* \sa getCurrent(), getCurrentCurrent() * \sa getCurrent(), getCurrentCurrent()
*/ */
void setCurrent(unsigned int current); void setCurrent(unsigned int current);
/*! /*!
* \brief readout the motor maximum current in mA (1000 is an Amp) * \brief readout the motor maximum current in mA (1000 is an Amp)
* This is the maximum current. to get the current current - which may be affected by CoolStep us getCurrentCurrent() * This is the maximum current. to get the current current - which may be affected by CoolStep us getCurrentCurrent()
@ -319,7 +319,7 @@ class TMC26XStepper {
* \sa getCurrentCurrent() * \sa getCurrentCurrent()
*/ */
unsigned int getCurrent(void); unsigned int getCurrent(void);
/*! /*!
* \brief set the StallGuard threshold in order to get sensible StallGuard readings. * \brief set the StallGuard threshold in order to get sensible StallGuard readings.
* \param stall_guard_threshold -64 63 the StallGuard threshold * \param stall_guard_threshold -64 63 the StallGuard threshold
@ -332,23 +332,23 @@ class TMC26XStepper {
* *
* If you switch on the filter the StallGuard reading is only updated each 4th full step to reduce the noise in the * If you switch on the filter the StallGuard reading is only updated each 4th full step to reduce the noise in the
* reading. * reading.
* *
* \sa getCurrentStallGuardReading() to read out the current value. * \sa getCurrentStallGuardReading() to read out the current value.
*/ */
void setStallGuardThreshold(char stall_guard_threshold, char stall_guard_filter_enabled); void setStallGuardThreshold(char stall_guard_threshold, char stall_guard_filter_enabled);
/*! /*!
* \brief reads out the StallGuard threshold * \brief reads out the StallGuard threshold
* \return a number between -64 and 63. * \return a number between -64 and 63.
*/ */
char getStallGuardThreshold(void); char getStallGuardThreshold(void);
/*! /*!
* \brief returns the current setting of the StallGuard filter * \brief returns the current setting of the StallGuard filter
* \return 0 if not set, -1 if set * \return 0 if not set, -1 if set
*/ */
char getStallGuardFilter(void); char getStallGuardFilter(void);
/*! /*!
* \brief This method configures the CoolStep smart energy operation. You must have a proper StallGuard configuration for the motor situation (current, voltage, speed) in rder to use this feature. * \brief This method configures the CoolStep smart energy operation. You must have a proper StallGuard configuration for the motor situation (current, voltage, speed) in rder to use this feature.
* \param lower_SG_threshold Sets the lower threshold for stallGuard2TM reading. Below this value, the motor current becomes increased. Allowed values are 0...480 * \param lower_SG_threshold Sets the lower threshold for stallGuard2TM reading. Below this value, the motor current becomes increased. Allowed values are 0...480
@ -358,7 +358,7 @@ class TMC26XStepper {
* \param lower_current_limit Sets the lower motor current limit for coolStepTM operation by scaling the CS value. Values can be COOL_STEP_HALF_CS_LIMIT, COOL_STEP_QUARTER_CS_LIMIT * \param lower_current_limit Sets the lower motor current limit for coolStepTM operation by scaling the CS value. Values can be COOL_STEP_HALF_CS_LIMIT, COOL_STEP_QUARTER_CS_LIMIT
* The CoolStep smart energy operation automatically adjust the current sent into the motor according to the current load, * The CoolStep smart energy operation automatically adjust the current sent into the motor according to the current load,
* read out by the StallGuard in order to provide the optimum torque with the minimal current consumption. * read out by the StallGuard in order to provide the optimum torque with the minimal current consumption.
* You configure the CoolStep current regulator by defining upper and lower bounds of StallGuard readouts. If the readout is above the * You configure the CoolStep current regulator by defining upper and lower bounds of StallGuard readouts. If the readout is above the
* limit the current gets increased, below the limit the current gets decreased. * limit the current gets increased, below the limit the current gets decreased.
* You can specify the upper an lower threshold of the StallGuard readout in order to adjust the current. You can also set the number of * You can specify the upper an lower threshold of the StallGuard readout in order to adjust the current. You can also set the number of
* StallGuard readings neccessary above or below the limit to get a more stable current adjustement. * StallGuard readings neccessary above or below the limit to get a more stable current adjustement.
@ -368,15 +368,15 @@ class TMC26XStepper {
*/ */
void setCoolStepConfiguration(unsigned int lower_SG_threshold, unsigned int SG_hysteresis, unsigned char current_decrement_step_size, void setCoolStepConfiguration(unsigned int lower_SG_threshold, unsigned int SG_hysteresis, unsigned char current_decrement_step_size,
unsigned char current_increment_step_size, unsigned char lower_current_limit); unsigned char current_increment_step_size, unsigned char lower_current_limit);
/*! /*!
* \brief enables or disables the CoolStep smart energy operation feature. It must be configured before enabling it. * \brief enables or disables the CoolStep smart energy operation feature. It must be configured before enabling it.
* \param enabled true if CoolStep should be enabled, false if not. * \param enabled true if CoolStep should be enabled, false if not.
* \sa setCoolStepConfiguration() * \sa setCoolStepConfiguration()
*/ */
void setCoolStepEnabled(boolean enabled); void setCoolStepEnabled(boolean enabled);
/*! /*!
* \brief check if the CoolStep feature is enabled * \brief check if the CoolStep feature is enabled
* \sa setCoolStepEnabled() * \sa setCoolStepEnabled()
@ -388,40 +388,40 @@ class TMC26XStepper {
* \sa setCoolStepConfiguration() * \sa setCoolStepConfiguration()
*/ */
unsigned int getCoolStepLowerSgThreshold(); unsigned int getCoolStepLowerSgThreshold();
/*! /*!
* \brief returns the upper StallGuard threshold for the CoolStep operation * \brief returns the upper StallGuard threshold for the CoolStep operation
* \sa setCoolStepConfiguration() * \sa setCoolStepConfiguration()
*/ */
unsigned int getCoolStepUpperSgThreshold(); unsigned int getCoolStepUpperSgThreshold();
/*! /*!
* \brief returns the number of StallGuard readings befor CoolStep adjusts the motor current. * \brief returns the number of StallGuard readings befor CoolStep adjusts the motor current.
* \sa setCoolStepConfiguration() * \sa setCoolStepConfiguration()
*/ */
unsigned char getCoolStepNumberOfSGReadings(); unsigned char getCoolStepNumberOfSGReadings();
/*! /*!
* \brief returns the increment steps for the current for the CoolStep operation * \brief returns the increment steps for the current for the CoolStep operation
* \sa setCoolStepConfiguration() * \sa setCoolStepConfiguration()
*/ */
unsigned char getCoolStepCurrentIncrementSize(); unsigned char getCoolStepCurrentIncrementSize();
/*! /*!
* \brief returns the absolut minium current for the CoolStep operation * \brief returns the absolut minium current for the CoolStep operation
* \sa setCoolStepConfiguration() * \sa setCoolStepConfiguration()
* \sa COOL_STEP_HALF_CS_LIMIT, COOL_STEP_QUARTER_CS_LIMIT * \sa COOL_STEP_HALF_CS_LIMIT, COOL_STEP_QUARTER_CS_LIMIT
*/ */
unsigned char getCoolStepLowerCurrentLimit(); unsigned char getCoolStepLowerCurrentLimit();
/*! /*!
* \brief Get the current microstep position for phase A * \brief Get the current microstep position for phase A
* \return The current microstep position for phase A 0255 * \return The current microstep position for phase A 0255
* *
* Keep in mind that this routine reads and writes a value via SPI - so this may take a bit time. * Keep in mind that this routine reads and writes a value via SPI - so this may take a bit time.
*/ */
int getMotorPosition(void); int getMotorPosition(void);
/*! /*!
* \brief Reads the current StallGuard value. * \brief Reads the current StallGuard value.
* \return The current StallGuard value, lesser values indicate higher load, 0 means stall detected. * \return The current StallGuard value, lesser values indicate higher load, 0 means stall detected.
@ -429,15 +429,15 @@ class TMC26XStepper {
* \sa setStallGuardThreshold() for tuning the readout to sensible ranges. * \sa setStallGuardThreshold() for tuning the readout to sensible ranges.
*/ */
int getCurrentStallGuardReading(void); int getCurrentStallGuardReading(void);
/*! /*!
* \brief Reads the current current setting value as fraction of the maximum current * \brief Reads the current current setting value as fraction of the maximum current
* Returns values between 0 and 31, representing 1/32 to 32/32 (=1) * Returns values between 0 and 31, representing 1/32 to 32/32 (=1)
* \sa setCoolStepConfiguration() * \sa setCoolStepConfiguration()
*/ */
unsigned char getCurrentCSReading(void); unsigned char getCurrentCSReading(void);
/*! /*!
*\brief a convenience method to determine if the current scaling uses 0.31V or 0.165V as reference. *\brief a convenience method to determine if the current scaling uses 0.31V or 0.165V as reference.
*\return false if 0.13V is the reference voltage, true if 0.165V is used. *\return false if 0.13V is the reference voltage, true if 0.165V is used.
@ -447,12 +447,12 @@ class TMC26XStepper {
/*! /*!
* \brief Reads the current current setting value and recalculates the absolute current in mA (1A would be 1000). * \brief Reads the current current setting value and recalculates the absolute current in mA (1A would be 1000).
* This method calculates the currently used current setting (either by setting or by CoolStep) and reconstructs * This method calculates the currently used current setting (either by setting or by CoolStep) and reconstructs
* the current in mA by usinge the VSENSE and resistor value. This method uses floating point math - so it * the current in mA by usinge the VSENSE and resistor value. This method uses floating point math - so it
* may not be the fastest. * may not be the fastest.
* \sa getCurrentCSReading(), getResistor(), isCurrentScalingHalfed(), getCurrent() * \sa getCurrentCSReading(), getResistor(), isCurrentScalingHalfed(), getCurrent()
*/ */
unsigned int getCurrentCurrent(void); unsigned int getCurrentCurrent(void);
/*! /*!
* \brief checks if there is a StallGuard warning in the last status * \brief checks if there is a StallGuard warning in the last status
* \return 0 if there was no warning, -1 if there was some warning. * \return 0 if there was no warning, -1 if there was some warning.
@ -462,7 +462,7 @@ class TMC26XStepper {
* \sa setStallGuardThreshold() for tuning the readout to sensible ranges. * \sa setStallGuardThreshold() for tuning the readout to sensible ranges.
*/ */
boolean isStallGuardOverThreshold(void); boolean isStallGuardOverThreshold(void);
/*! /*!
* \brief Return over temperature status of the last status readout * \brief Return over temperature status of the last status readout
* return 0 is everything is OK, TMC26X_OVERTEMPERATURE_PREWARING if status is reached, TMC26X_OVERTEMPERATURE_SHUTDOWN is the chip is shutdown, -1 if the status is unknown. * return 0 is everything is OK, TMC26X_OVERTEMPERATURE_PREWARING if status is reached, TMC26X_OVERTEMPERATURE_SHUTDOWN is the chip is shutdown, -1 if the status is unknown.
@ -470,14 +470,14 @@ class TMC26XStepper {
* You may want to use getMotorPosition() or getCurrentStallGuardReading() to enforce an updated status readout. * You may want to use getMotorPosition() or getCurrentStallGuardReading() to enforce an updated status readout.
*/ */
char getOverTemperature(void); char getOverTemperature(void);
/*! /*!
* \brief Is motor channel A shorted to ground detected in the last status readout. * \brief Is motor channel A shorted to ground detected in the last status readout.
* \return true is yes, false if not. * \return true is yes, false if not.
* Keep in mind that this method does not enforce a readout but uses the value of the last status readout. * Keep in mind that this method does not enforce a readout but uses the value of the last status readout.
* You may want to use getMotorPosition() or getCurrentStallGuardReading() to enforce an updated status readout. * You may want to use getMotorPosition() or getCurrentStallGuardReading() to enforce an updated status readout.
*/ */
boolean isShortToGroundA(void); boolean isShortToGroundA(void);
/*! /*!
@ -502,7 +502,7 @@ class TMC26XStepper {
* You may want to use getMotorPosition() or getCurrentStallGuardReading() to enforce an updated status readout. * You may want to use getMotorPosition() or getCurrentStallGuardReading() to enforce an updated status readout.
*/ */
boolean isOpenLoadB(void); boolean isOpenLoadB(void);
/*! /*!
* \brief Is chopper inactive since 2^20 clock cycles - defaults to ~0,08s * \brief Is chopper inactive since 2^20 clock cycles - defaults to ~0,08s
* \return true is yes, false if not. * \return true is yes, false if not.
@ -523,13 +523,13 @@ class TMC26XStepper {
* \sa setStallGuardThreshold() for tuning the readout to sensible ranges. * \sa setStallGuardThreshold() for tuning the readout to sensible ranges.
*/ */
boolean isStallGuardReached(void); boolean isStallGuardReached(void);
/*! /*!
*\brief enables or disables the motor driver bridges. If disabled the motor can run freely. If enabled not. *\brief enables or disables the motor driver bridges. If disabled the motor can run freely. If enabled not.
*\param enabled a boolean value true if the motor should be enabled, false otherwise. *\param enabled a boolean value true if the motor should be enabled, false otherwise.
*/ */
void setEnabled(boolean enabled); void setEnabled(boolean enabled);
/*! /*!
*\brief checks if the output bridges are enabled. If the bridges are not enabled the motor can run freely *\brief checks if the output bridges are enabled. If the bridges are not enabled the motor can run freely
*\return true if the bridges and by that the motor driver are enabled, false if not. *\return true if the bridges and by that the motor driver are enabled, false if not.
@ -541,13 +541,13 @@ class TMC26XStepper {
* \brief Manually read out the status register * \brief Manually read out the status register
* This function sends a byte to the motor driver in order to get the current readout. The parameter read_value * This function sends a byte to the motor driver in order to get the current readout. The parameter read_value
* seletcs which value will get returned. If the read_vlaue changes in respect to the previous readout this method * seletcs which value will get returned. If the read_vlaue changes in respect to the previous readout this method
* automatically send two bytes to the motor: one to set the redout and one to get the actual readout. So this method * automatically send two bytes to the motor: one to set the redout and one to get the actual readout. So this method
* may take time to send and read one or two bits - depending on the previous readout. * may take time to send and read one or two bits - depending on the previous readout.
* \param read_value selects which value to read out (0..3). You can use the defines TMC26X_READOUT_POSITION, TMC_262_READOUT_STALLGUARD, or TMC_262_READOUT_CURRENT * \param read_value selects which value to read out (0..3). You can use the defines TMC26X_READOUT_POSITION, TMC_262_READOUT_STALLGUARD, or TMC_262_READOUT_CURRENT
* \sa TMC26X_READOUT_POSITION, TMC_262_READOUT_STALLGUARD, TMC_262_READOUT_CURRENT * \sa TMC26X_READOUT_POSITION, TMC_262_READOUT_STALLGUARD, TMC_262_READOUT_CURRENT
*/ */
void readStatus(char read_value); void readStatus(char read_value);
/*! /*!
* \brief Returns the current sense resistor value in milliohm. * \brief Returns the current sense resistor value in milliohm.
* The default value of ,15 Ohm will return 150. * The default value of ,15 Ohm will return 150.
@ -555,7 +555,7 @@ class TMC26XStepper {
int getResistor(); int getResistor();
/*! /*!
* \brief Prints out all the information that can be found in the last status read out - it does not force a status readout. * \brief Prints out all the information that can be found in the last status read out - it does not force a status readout.
* The result is printed via Serial * The result is printed via Serial
*/ */
void debugLastStatus(void); void debugLastStatus(void);
@ -565,17 +565,17 @@ class TMC26XStepper {
*/ */
int version(void); int version(void);
private: private:
unsigned int steps_left; // The steps the motor has to do to complete the movement unsigned int steps_left; // The steps the motor has to do to complete the movement
int direction; // Direction of rotation int direction; // Direction of rotation
unsigned long step_delay; // Delay between steps, in ms, based on speed unsigned long step_delay; // Delay between steps, in ms, based on speed
int number_of_steps; // Total number of steps this motor can take int number_of_steps; // Total number of steps this motor can take
unsigned int speed; // Store the current speed in order to change the speed after changing microstepping unsigned int speed; // Store the current speed in order to change the speed after changing microstepping
unsigned int resistor; // Current sense resitor value in milliohm unsigned int resistor; // Current sense resitor value in milliohm
unsigned long last_step_time; // Time stamp in ms of when the last step was taken unsigned long last_step_time; // Time stamp in ms of when the last step was taken
unsigned long next_step_time; // Time stamp in ms of when the last step was taken unsigned long next_step_time; // Time stamp in ms of when the last step was taken
// Driver control register copies to easily set & modify the registers // Driver control register copies to easily set & modify the registers
unsigned long driver_control_register_value; unsigned long driver_control_register_value;
unsigned long chopper_config_register; unsigned long chopper_config_register;
@ -584,22 +584,22 @@ class TMC26XStepper {
unsigned long driver_configuration_register_value; unsigned long driver_configuration_register_value;
// The driver status result // The driver status result
unsigned long driver_status_result; unsigned long driver_status_result;
// Helper routione to get the top 10 bit of the readout // Helper routione to get the top 10 bit of the readout
inline int getReadoutValue(); inline int getReadoutValue();
// The pins for the stepper driver // The pins for the stepper driver
unsigned char cs_pin; unsigned char cs_pin;
unsigned char step_pin; unsigned char step_pin;
unsigned char dir_pin; unsigned char dir_pin;
// Status values // Status values
boolean started; // If the stepper has been started yet boolean started; // If the stepper has been started yet
int microsteps; // The current number of micro steps int microsteps; // The current number of micro steps
char constant_off_time; // We need to remember this value in order to enable and disable the motor char constant_off_time; // We need to remember this value in order to enable and disable the motor
unsigned char cool_step_lower_threshold; // we need to remember the threshold to enable and disable the CoolStep feature unsigned char cool_step_lower_threshold; // we need to remember the threshold to enable and disable the CoolStep feature
boolean cool_step_enabled; // We need to remember this to configure the coolstep if it si enabled boolean cool_step_enabled; // We need to remember this to configure the coolstep if it si enabled
// SPI sender // SPI sender
inline void send262(unsigned long datagram); inline void send262(unsigned long datagram);
}; };

View file

@ -41,7 +41,7 @@
#if ENABLED(HAVE_TMCDRIVER) #if ENABLED(HAVE_TMCDRIVER)
#include <SPI.h> #include <SPI.h>
#ifdef STM32F7 #ifdef STM32F7
#include "../HAL/HAL_STM32F7/TMC2660.h" #include "../HAL/HAL_STM32F7/TMC2660.h"
#else #else

View file

@ -56,9 +56,9 @@
#define X_MAX_PIN _STM32_PIN(PORTE, 10) #define X_MAX_PIN _STM32_PIN(PORTE, 10)
#define Y_MIN_PIN _STM32_PIN(PORTE, 7) #define Y_MIN_PIN _STM32_PIN(PORTE, 7)
#define Y_MAX_PIN _STM32_PIN(PORTE, 8) #define Y_MAX_PIN _STM32_PIN(PORTE, 8)
#define Z_MIN_PIN _STM32_PIN(PORTF, 15) #define Z_MIN_PIN _STM32_PIN(PORTF, 15)
#define Z_MAX_PIN _STM32_PIN(PORTG, 0) #define Z_MAX_PIN _STM32_PIN(PORTG, 0)
#define E_MIN_PIN _STM32_PIN(PORTE, 2) #define E_MIN_PIN _STM32_PIN(PORTE, 2)
#define E_MAX_PIN _STM32_PIN(PORTE, 3) #define E_MAX_PIN _STM32_PIN(PORTE, 3)
// //
// Z Probe (when not Z_MIN_PIN) // Z Probe (when not Z_MIN_PIN)
@ -165,15 +165,15 @@
// Prusa i3 MK2 Multi Material Multiplexer Support // Prusa i3 MK2 Multi Material Multiplexer Support
// //
#define E_MUX0_PIN _STM32_PIN(PORTG, 3) #define E_MUX0_PIN _STM32_PIN(PORTG, 3)
#define E_MUX1_PIN _STM32_PIN(PORTG, 4) #define E_MUX1_PIN _STM32_PIN(PORTG, 4)
// //
// Servos // Servos
// //
#define SERVO0_PIN _STM32_PIN(PORTE, 13) #define SERVO0_PIN _STM32_PIN(PORTE, 13)
#define SERVO1_PIN _STM32_PIN(PORTE, 14) #define SERVO1_PIN _STM32_PIN(PORTE, 14)
#define SDSS _STM32_PIN(PORTA, 8) #define SDSS _STM32_PIN(PORTA, 8)
@ -191,7 +191,7 @@
#define MAX7219_LOAD_PIN _STM32_PIN(PORTD, 1) //EXP1-5 #define MAX7219_LOAD_PIN _STM32_PIN(PORTD, 1) //EXP1-5
//#define NEOPIXEL_PIN 4 //#define NEOPIXEL_PIN 4
// //
// LCD / Controller // LCD / Controller
// //

View file

@ -180,7 +180,7 @@ void CardReader::ls(
) { ) {
lsAction = LS_SerialPrint; lsAction = LS_SerialPrint;
root.rewind(); root.rewind();
lsDive("", root lsDive("", root
#if NUM_SERIAL > 1 #if NUM_SERIAL > 1
, NULL, port , NULL, port
#endif #endif

View file

@ -174,7 +174,7 @@ private:
LsAction lsAction; //stored for recursion. LsAction lsAction; //stored for recursion.
uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory. uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory.
char* diveDirName; char* diveDirName;
void lsDive(const char *prepend, SdFile parent, const char * const match=NULL void lsDive(const char *prepend, SdFile parent, const char * const match=NULL
#if NUM_SERIAL > 1 #if NUM_SERIAL > 1
, const int8_t port = -1 , const int8_t port = -1
#endif #endif