From 600848ae0f0f6371c7c72e4f5abd32e1ed386913 Mon Sep 17 00:00:00 2001 From: Denis Voltmann Date: Mon, 31 Oct 2022 21:45:42 +0100 Subject: [PATCH] Formatting Readme --- DendoStepper.cpp | 92 ++++++++++++++------------ README.md | 102 ++++++++++++++++++++-------- example/main/main.cpp | 18 +++-- include/DendoStepper.h | 147 ++++++++++++++++++++++------------------- 4 files changed, 212 insertions(+), 147 deletions(-) diff --git a/DendoStepper.cpp b/DendoStepper.cpp index 3db0c6b..6443845 100644 --- a/DendoStepper.cpp +++ b/DendoStepper.cpp @@ -73,13 +73,13 @@ void DendoStepper::init() .intr_type = TIMER_INTR_LEVEL, // interrupt .counter_dir = TIMER_COUNT_UP, // count up duh .auto_reload = TIMER_AUTORELOAD_EN, // reload pls - .divider = 80000000ULL/TIMER_F, // ns resolution + .divider = 80000000ULL / TIMER_F, // ns resolution }; - //calculate stepsPerRot - ctrl.stepsPerRot = (360.0/conf.stepAngle)*conf.miStep; + // calculate stepsPerRot + ctrl.stepsPerRot = (360.0 / conf.stepAngle) * conf.miStep; - STEP_LOGI("DendoStepper","Steps per one rotation:%d",ctrl.stepsPerRot); + STEP_LOGI("DendoStepper", "Steps per one rotation:%d", ctrl.stepsPerRot); if (conf.timer_group != TIMER_GROUP_MAX && conf.timer_idx != TIMER_MAX) { @@ -127,20 +127,22 @@ esp_err_t DendoStepper::runPos(int32_t relative) if (ctrl.status == DISABLED) // if motor is disabled, enable it enableMotor(); ctrl.status = ACC; - setDir(relative < 0); // set CCW if <0, else set CW + setDir(relative < 0); // set CCW if <0, else set CW currentPos += relative; - calc(abs(relative)); // calculate velocity profile + calc(abs(relative)); // calculate velocity profile ESP_ERROR_CHECK(timer_set_alarm_value(conf.timer_group, conf.timer_idx, ctrl.stepInterval)); // set HW timer alarm to stepinterval ESP_ERROR_CHECK(timer_start(conf.timer_group, conf.timer_idx)); // start the timer return ESP_OK; } -esp_err_t DendoStepper::runPosMm(int32_t relative){ - if(ctrl.stepsPerMm == 0){ - STEP_LOGE("DendoStepper","Steps per millimeter not set, cannot move!"); +esp_err_t DendoStepper::runPosMm(int32_t relative) +{ + if (ctrl.stepsPerMm == 0) + { + STEP_LOGE("DendoStepper", "Steps per millimeter not set, cannot move!"); } - return runPos(relative*ctrl.stepsPerMm); + return runPos(relative * ctrl.stepsPerMm); } esp_err_t DendoStepper::runAbs(uint32_t position) @@ -156,19 +158,20 @@ esp_err_t DendoStepper::runAbs(uint32_t position) if (position == currentPos) // we cant go anywhere return 0; - int32_t relativeSteps = 0; relativeSteps = (int32_t)position - currentPos; - ESP_LOGI("DendoStepper","Cur: %llu move %d", currentPos, relativeSteps); + ESP_LOGI("DendoStepper", "Cur: %llu move %d", currentPos, relativeSteps); return runPos(relativeSteps); // run to new position } -esp_err_t DendoStepper::runAbsMm(uint32_t position){ - if(ctrl.stepsPerMm == 0){ - STEP_LOGE("DendoStepper","Steps per millimeter not set, cannot move!"); +esp_err_t DendoStepper::runAbsMm(uint32_t position) +{ + if (ctrl.stepsPerMm == 0) + { + STEP_LOGE("DendoStepper", "Steps per millimeter not set, cannot move!"); } - return runAbs(position*ctrl.stepsPerMm); + return runAbs(position * ctrl.stepsPerMm); } void DendoStepper::setSpeed(uint32_t speed, uint16_t accT, uint16_t decT) @@ -181,21 +184,24 @@ void DendoStepper::setSpeed(uint32_t speed, uint16_t accT, uint16_t decT) void DendoStepper::setSpeedMm(uint32_t speed, uint16_t accT, uint16_t decT) { - if(ctrl.stepsPerMm == 0){ - STEP_LOGE("DendoStepper","Steps per millimeter not set, cannot set the speed!"); + if (ctrl.stepsPerMm == 0) + { + STEP_LOGE("DendoStepper", "Steps per millimeter not set, cannot set the speed!"); } - ctrl.speed = speed*ctrl.stepsPerMm; + ctrl.speed = speed * ctrl.stepsPerMm; ctrl.acc = ctrl.speed / (accT / 4000.0); ctrl.dec = ctrl.speed / (decT / 4000.0); STEP_LOGI("DendoStepper", "Speed set: v=%d mm/s t+=%d s t-=%d s", speed, accT, decT); } -void DendoStepper::setStepsPerMm(uint16_t steps){ +void DendoStepper::setStepsPerMm(uint16_t steps) +{ ctrl.stepsPerMm = steps; } -uint16_t DendoStepper::getStepsPerMm(){ +uint16_t DendoStepper::getStepsPerMm() +{ return ctrl.stepsPerMm; } @@ -209,8 +215,9 @@ uint64_t DendoStepper::getPosition() return currentPos; } -uint64_t DendoStepper::getPositionMm(){ - return getPosition()/ctrl.stepsPerMm; +uint64_t DendoStepper::getPositionMm() +{ + return getPosition() / ctrl.stepsPerMm; } void DendoStepper::resetAbsolute() @@ -220,18 +227,20 @@ void DendoStepper::resetAbsolute() void DendoStepper::runInf(bool direction) { - if(ctrl.status > IDLE){ - STEP_LOGE("DendoStepper","Motor is moving, this command will be ignored"); + if (ctrl.status > IDLE) + { + STEP_LOGE("DendoStepper", "Motor is moving, this command will be ignored"); return; } - if(ctrl.status == DISABLED){ + if (ctrl.status == DISABLED) + { enableMotor(); } ctrl.runInfinite = true; setDir(direction); calc(UINT32_MAX); ESP_ERROR_CHECK(timer_set_alarm_value(conf.timer_group, conf.timer_idx, ctrl.stepInterval)); // set HW timer alarm to stepinterval - ESP_ERROR_CHECK(timer_start(conf.timer_group, conf.timer_idx)); // start the timer + ESP_ERROR_CHECK(timer_start(conf.timer_group, conf.timer_idx)); // start the timer } uint16_t DendoStepper::getSpeed() @@ -239,14 +248,15 @@ uint16_t DendoStepper::getSpeed() return ctrl.speed; } -uint16_t DendoStepper::getAcc() +float DendoStepper::getAcc() { return ctrl.acc; } void DendoStepper::stop() { - if(ctrl.status <= IDLE){ + if (ctrl.status <= IDLE) + { return; } ctrl.runInfinite = false; @@ -275,7 +285,6 @@ bool DendoStepper::xISR() GPIO.out_w1ts = (1ULL << conf.stepPin); // add and substract one step - ctrl.stepCnt++; // we are done @@ -303,7 +312,7 @@ bool DendoStepper::xISR() ctrl.status = COAST; // we are coasting } - ctrl.stepInterval = TIMER_F/ctrl.currentSpeed; + ctrl.stepInterval = TIMER_F / ctrl.currentSpeed; // set alarm to calculated interval and disable pin GPIO.out_w1tc = (1ULL << conf.stepPin); timer_set_alarm_value(conf.timer_group, conf.timer_idx, ctrl.stepInterval); @@ -312,32 +321,31 @@ bool DendoStepper::xISR() void DendoStepper::calc(uint32_t targetSteps) { - - ctrl.accSteps = 0.5*ctrl.acc*(ctrl.speed/ctrl.acc)*(ctrl.speed/ctrl.acc); - ctrl.decSteps = 0.5*ctrl.dec*(ctrl.speed/ctrl.dec)*(ctrl.speed/ctrl.dec); + ctrl.accSteps = 0.5 * ctrl.acc * (ctrl.speed / ctrl.acc) * (ctrl.speed / ctrl.acc); + + ctrl.decSteps = 0.5 * ctrl.dec * (ctrl.speed / ctrl.dec) * (ctrl.speed / ctrl.dec); if (targetSteps < (ctrl.decSteps + ctrl.accSteps)) { - ESP_LOGI("Dendostepper","Computing new speed"); + ESP_LOGI("Dendostepper", "Computing new speed"); - ctrl.speed = sqrt(2*targetSteps*((ctrl.dec*ctrl.acc)/(ctrl.dec+ctrl.acc))); - ctrl.accSteps = 0.5*ctrl.acc*(ctrl.speed/ctrl.acc)*(ctrl.speed/ctrl.acc); - ctrl.decSteps = 0.5*ctrl.dec*(ctrl.speed/ctrl.dec)*(ctrl.speed/ctrl.dec); + ctrl.speed = sqrt(2 * targetSteps * ((ctrl.dec * ctrl.acc) / (ctrl.dec + ctrl.acc))); + ctrl.accSteps = 0.5 * ctrl.acc * (ctrl.speed / ctrl.acc) * (ctrl.speed / ctrl.acc); + ctrl.decSteps = 0.5 * ctrl.dec * (ctrl.speed / ctrl.dec) * (ctrl.speed / ctrl.dec); } ctrl.accEnd = ctrl.accSteps; ctrl.coastEnd = targetSteps - ctrl.decSteps; ctrl.targetSpeed = ctrl.speed; - ctrl.accInc = ctrl.targetSpeed/(double)ctrl.accSteps; - ctrl.decInc = ctrl.targetSpeed/(double)ctrl.decSteps; + ctrl.accInc = ctrl.targetSpeed / (double)ctrl.accSteps; + ctrl.decInc = ctrl.targetSpeed / (double)ctrl.decSteps; ctrl.currentSpeed = ctrl.accInc; - ctrl.stepInterval = TIMER_F/ctrl.currentSpeed; + ctrl.stepInterval = TIMER_F / ctrl.currentSpeed; ctrl.stepsToGo = targetSteps; STEP_LOGI("calc", "acc end:%u coastend:%u stepstogo:%u speed:%f acc:%f int: %u", ctrl.accEnd, ctrl.coastEnd, ctrl.stepsToGo, ctrl.speed, ctrl.acc, ctrl.stepInterval); - } diff --git a/README.md b/README.md index 42b96bb..2c7a3ff 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,99 @@ # DendoStepper -#### This docs are outdated, new ones will be ready soon - -Work in progress, maybe unstable. +Work in progress, maybe unstable. Opening issues is more than welcome. This library takes care of pulse generating for stepper motor drivers with STEP/DIR interface. Pulse generating utilizes general purpose timers to achieve some usable accuracy and smoothness. -Currently supports only linear acceleration and deceleration, exponential profile is TBD. +Currently supports only linear acceleration and deceleration. ### Known limitations - maximum number of controlled stepper motors is 4, this is limited by number of general purpose timers +- If the motor is moving, it is not possible to move it to another direction. ## Usage ```c++ typedef struct { - uint8_t step_p; //step signal gpio - uint8_t dir_p; //dir signal gpio - uint8_t en_p; //enable signal gpio - timer_group_t timer_group; //timer group, useful if we are controlling more than 2 steppers - timer_idx_t timer_idx; //timer index, useful if we are controlling 2steppers + uint8_t stepPin; /** step signal pin */ + uint8_t dirPin; /** dir signal pin */ + uint8_t enPin; /** enable signal pin */ + timer_group_t timer_group; /** timer group, useful if we are controlling more than 2 steppers */ + timer_idx_t timer_idx; /** timer index, useful if we are controlling 2steppers */ + microStepping_t miStep; /** microstepping configured on driver - used in distance calculation */ + float stepAngle; /** one step angle in degrees (usually 1.8deg), used in steps per rotation calculation */ } DendoStepper_config_t; -DendoStepper(DendoStepper_config_t*); +enum microStepping_t +{ + MICROSTEP_1 = 0x1, + MICROSTEP_2, + MICROSTEP_4 = 0x4, + MICROSTEP_8 = 0x8, + MICROSTEP_16 = 0x10, + MICROSTEP_32 = 0x20, + MICROSTEP_64 = 0x40, + MICROSTEP_128 = 0x80, + MICROSTEP_256 = 0x100, +}; + ``` -Constructor - accepts DendoStepper_config_t struct as parameter. This struct needs to be initialized before calling constructor. -timer_group and timer_idx are used to assign different timers to different instances. +Configuration struct, can be allocated on stack or heap. ```c++ void init(); ``` -Initializes GPIO and Timer peripherals, registers ISR. Expects populated config struct is alreay passed to the object +Initializes GPIO and Timer peripherals, registers ISR. Expects populated config struct is alreay passed to the class using config() + +```c++ +void config(DendoStepper_config_t* config); +``` +Configures the class as per passed config struct pointer. ```c++ -void config(const DendoStepper_config_t* config); +void setStepsPerMm(uint16_t steps); +uint16_t getStepsPerMm(); ``` -Same as init, but you can pass populated config struct if you didn't pass it in constructor. +Sets or gets steps needed to move one millimiter, useful if stepper is moving along linear axis. ```c++ -void setSpeed(uint16_t speed,uint16_t accTimeMs); +void setSpeed(uint16_t speed,uint16_t accT, uint16_t decT); +uint16_t getSpeed(); +float getAcc(); +``` +Sets maximum speed in steps per second, acceleration and deceleration time in milliseconds. +Gets speed in steps per second +Gets acceleration in steps per second per second + +```c++ +void setSpeedMm(uint16_t speed,uint16_t accT, uint16_t decT); ``` -Sets maximum speed in steps per second and acceleration time in milliseconds. +Sets maximum speed in mm/s, acceleration and deceleration time in milliseconds. Expects already defined steps per millimeter with setStepsPerMm() ```c++ void runPos(int32_t relative); ``` -Runs motor to position relative from current position, respecting constraints set with setSpeed() +Runs motor to position relative from current position in steps, respecting constraints set with setSpeed() + +```c++ +void runPosMm(int32_t relative); +``` +Runs motor to position relative from current position in millimeters, respecting constraints set with setSpeed() +Expects already defined steps per millimeter with setStepsPerMm() + +```c++ + bool runAbsolute(uint32_t position); +``` +Runs motor in absolute coordinate plane. Unit: steps (should be constrained with home switch) + +```c++ + bool runAbsoluteMm(uint32_t position); +``` +Runs motor in absolute coordinate plane. Unit: millimiters (should be constrained with home switch) +Expects already defined steps per millimeter with setStepsPerMm() + +```c++ + bool runInf(bool direction); +``` +Runs motor infintely in desired direction with constrains set using setSpeed(). ```c++ void disableMotor(); @@ -65,29 +114,26 @@ enum motor_status{ ``` Returns current state of motor, return type is enum motor_status -```c++ - bool runAbsolute(uint32_t position); -``` -Runs motor in absolute coordinate plane(should be constrained with home switch) ```c++ void resetAbsolute(); ``` -Resets absolute position to 0. Called for ex. when endswitch is hit. +Resets absolute position to 0. Called for ex. when endswitch is hit. ```c++ -uint16_t getSpeed(); +void getPosition(); ``` -Returns currently set motor speed +Gets current position in absolute coordinate plane in steps. ```c++ -uint16_t getAcc(); +void getPositionMm(); ``` -Returns currently set acceleration time in ms +Gets current position in absolute coordinate plane in millimeters. +Expects already defined steps per millimeter with setStepsPerMm() ```c++ void stop(); ``` -Stops the motor dead on the spot. Eg. e-stop. +Stops the motor dead on the spot. No deceleration is performed this way. Eg. e-stop. diff --git a/example/main/main.cpp b/example/main/main.cpp index 666d54f..774b458 100644 --- a/example/main/main.cpp +++ b/example/main/main.cpp @@ -16,8 +16,7 @@ extern "C" void app_main(void) .timer_group = TIMER_GROUP_0, .timer_idx = TIMER_0, .miStep = MICROSTEP_32, - .stepAngle = 1.8 - }; + .stepAngle = 1.8}; DendoStepper_config_t step1_cfg = { .stepPin = 18, @@ -26,8 +25,7 @@ extern "C" void app_main(void) .timer_group = TIMER_GROUP_0, .timer_idx = TIMER_1, .miStep = MICROSTEP_32, - .stepAngle = 1.8 - }; + .stepAngle = 1.8}; step.config(&step_cfg); step1.config(&step1_cfg); @@ -35,17 +33,17 @@ extern "C" void app_main(void) step.init(); step1.init(); - step.setSpeed(10000,1000,1000); - step1.setSpeed(20000,1000,1000); + step.setSpeed(10000, 1000, 1000); + step1.setSpeed(20000, 1000, 1000); - //step.runInf(true); + // step.runInf(true); step.setStepsPerMm(10); - while(1){ + while (1) + { step.runPosMm(500); step1.runPos(10000); vTaskDelay(1000); - //step.runAbs(5000); + // step.runAbs(5000); } - } \ No newline at end of file diff --git a/include/DendoStepper.h b/include/DendoStepper.h index 4bd3ddc..9846412 100644 --- a/include/DendoStepper.h +++ b/include/DendoStepper.h @@ -1,5 +1,22 @@ #pragma once +/* ESP-IDF library for bipolar stepper motor drivers with STEP/DIR interface + Copyright (C) 2022 Denis Voltmann + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + #ifndef DENDOSTEPPER_H #define DENDOSTEPPER_H @@ -15,35 +32,36 @@ //#define STEP_DEBUG - #define NS_TO_T_TICKS(x) (x) #define TIMER_F 1000000ULL #define TICK_PER_S TIMER_F -enum motor_status{ +enum motor_status +{ DISABLED, IDLE, ACC, COAST, - DEC, - INF, + DEC }; -enum dir{ +enum dir +{ CW, CCW }; -enum microStepping_t { - MICROSTEP_1=0x1, +enum microStepping_t +{ + MICROSTEP_1 = 0x1, MICROSTEP_2, - MICROSTEP_4=0x4, - MICROSTEP_8=0x8, - MICROSTEP_16=0x10, - MICROSTEP_32=0x20, - MICROSTEP_64=0x40, - MICROSTEP_128=0x80, - MICROSTEP_256=0x100, + MICROSTEP_4 = 0x4, + MICROSTEP_8 = 0x8, + MICROSTEP_16 = 0x10, + MICROSTEP_32 = 0x20, + MICROSTEP_64 = 0x40, + MICROSTEP_128 = 0x80, + MICROSTEP_256 = 0x100, }; /** @@ -51,42 +69,37 @@ enum microStepping_t { */ typedef struct { - uint8_t stepPin; /** step signal pin */ - uint8_t dirPin; /** dir signal pin */ - uint8_t enPin; /** enable signal pin */ - timer_group_t timer_group; /** timer group, useful if we are controlling more than 2 steppers */ - timer_idx_t timer_idx; /** timer index, useful if we are controlling 2steppers */ - microStepping_t miStep; /** microstepping configured on driver - used in distance calculation */ - float stepAngle; /** one step angle in degrees (usually 1.8deg), used in steps per rotation calculation */ + uint8_t stepPin; /** step signal pin */ + uint8_t dirPin; /** dir signal pin */ + uint8_t enPin; /** enable signal pin */ + timer_group_t timer_group; /** timer group, useful if we are controlling more than 2 steppers */ + timer_idx_t timer_idx; /** timer index, useful if we are controlling 2steppers */ + microStepping_t miStep; /** microstepping configured on driver - used in distance calculation */ + float stepAngle; /** one step angle in degrees (usually 1.8deg), used in steps per rotation calculation */ } DendoStepper_config_t; -typedef struct{ - uint32_t stepInterval=40000; //step interval in ns/25 - double targetSpeed=0; //target speed in steps/s - double currentSpeed=0; - double accInc=0; - double decInc=0; - uint32_t stepCnt=0; //step counter - uint32_t accEnd; //when to end acc and start coast - uint32_t coastEnd; //when to end coast and start decel - uint32_t stepsToGo=0; //steps we need to take - float speed=100; //speed in rad/s - float acc=100; //acceleration in rad*second^-2 - float dec=100; //decceleration in rad*second^-2 - uint32_t accSteps=0; - uint32_t decSteps=0; - uint8_t status=DISABLED; - bool dir=CW; - bool runInfinite=false; - uint16_t stepsPerRot; //steps per one revolution, 360/stepAngle * microstep - uint16_t stepsPerMm=0; /** Steps per one milimiter, if the motor is performing linear movement */ -}ctrl_var_t; - -typedef struct { - uint32_t stepInterval = 40000; /** step interval in ns/25 */ - uint32_t accelEnd; /** End of acceleration phase in steps */ - uint32_t coastEnd; /** End of coasting phase in steps */ -} speed_profile_t; +typedef struct +{ + uint32_t stepInterval = 40000; // step interval in ns/25 + double targetSpeed = 0; // target speed in steps/s + double currentSpeed = 0; + double accInc = 0; + double decInc = 0; + uint32_t stepCnt = 0; // step counter + uint32_t accEnd; // when to end acc and start coast + uint32_t coastEnd; // when to end coast and start decel + uint32_t stepsToGo = 0; // steps we need to take + float speed = 100; // speed in rad/s + float acc = 100; // acceleration in rad*second^-2 + float dec = 100; // decceleration in rad*second^-2 + uint32_t accSteps = 0; + uint32_t decSteps = 0; + uint8_t status = DISABLED; + bool dir = CW; + bool runInfinite = false; + uint16_t stepsPerRot; // steps per one revolution, 360/stepAngle * microstep + uint16_t stepsPerMm = 0; /** Steps per one milimiter, if the motor is performing linear movement */ +} ctrl_var_t; class DendoStepper { @@ -95,8 +108,8 @@ class DendoStepper ctrl_var_t ctrl; esp_timer_handle_t dyingTimer; TaskHandle_t enTask; - uint64_t currentPos=0; //absolute position - bool timerStarted=0; + uint64_t currentPos = 0; // absolute position + bool timerStarted = 0; /** @brief PRIVATE: Step interval calculation * @param speed maximum movement speed @@ -120,20 +133,21 @@ class DendoStepper * @param _this DendoStepper* this pointer * @return bool */ - static bool xISRwrap(void* _this){ + static bool xISRwrap(void *_this) + { return static_cast(_this)->xISR(); } /** @brief enableMotor wrapper */ - static void _disableMotor(void* _this){ + static void _disableMotor(void *_this) + { static_cast(_this)->disableMotor(); } bool xISR(); public: - /** @brief Costructor - conf variables to be passed later */ DendoStepper(); @@ -141,8 +155,8 @@ class DendoStepper /** @brief Configuration of library, used with constructor w/o params * @param config DendoStepper_config_t structure pointer - can be freed after this call */ - void config(DendoStepper_config_t* config); - + void config(DendoStepper_config_t *config); + /** @brief initialize GPIO and Timer peripherals * @param stepP step pulse pin * @param dirP direction signal pin @@ -152,19 +166,19 @@ class DendoStepper * @param microstepping microstepping performed by the driver, used for more accuracy * @param stepsPerRot how many steps it takes for the motor to move 2Pi rads. this can be also used instead of microstepping parameter */ - void init(uint8_t,uint8_t,uint8_t,timer_group_t,timer_idx_t,microStepping_t microstep,uint16_t stepsPerRot); - + void init(uint8_t, uint8_t, uint8_t, timer_group_t, timer_idx_t, microStepping_t microstep, uint16_t stepsPerRot); + /** @brief initialize GPIO and Timer peripherals, class must be configured beforehand with @attention config() */ void init(); /** @brief runs motor to relative position in steps - * @param relative number of steps to run, negative is reverse + * @param relative number of steps to run, negative is reverse */ esp_err_t runPos(int32_t relative); /** @brief runs motor to relative position in mm - * @param relative number of mm to run, negative is reverse + * @param relative number of mm to run, negative is reverse */ esp_err_t runPosMm(int32_t relative); @@ -185,7 +199,7 @@ class DendoStepper * @param accT acceleration time in ms * @param decT deceleration time in ms */ - void setSpeed(uint32_t speed,uint16_t accT, uint16_t decT); + void setSpeed(uint32_t speed, uint16_t accT, uint16_t decT); /** @brief sets motor speed and accel in millimeters/second * @param speed speed mm*s^-1 @@ -196,19 +210,19 @@ class DendoStepper /** * @brief Set steps per 1 mm of linear movement - * + * * @param steps steps needed to move one millimiter */ void setStepsPerMm(uint16_t steps); /** * @brief get steps per 1mm settings - * + * */ uint16_t getStepsPerMm(); /** @brief set EN pin 1, stops movement - */ + */ void disableMotor(); /** @brief set EN pin to 0, enables movement @@ -241,8 +255,8 @@ class DendoStepper void resetAbsolute(); /** @brief - * - */ + * + */ void runInf(bool direction); /** @brief returns current speed in steps per second @@ -251,12 +265,11 @@ class DendoStepper /** @brief returns current acceleration time in ms */ - uint16_t getAcc(); + float getAcc(); /** @brief stops the motor dead, but stays enabled */ void stop(); - }; #endif \ No newline at end of file