Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Boardcore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
Skyward Boardcore
Commits
908bf85b
Commit
908bf85b
authored
Mar 19, 2022
by
Alberto Nidasio
Browse files
Options
Downloads
Patches
Plain Diff
[Stepper] Added function to zero the position and fixed a bug
parent
79a931b5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/shared/drivers/stepper/Stepper.h
+11
-1
11 additions, 1 deletion
src/shared/drivers/stepper/Stepper.h
with
11 additions
and
1 deletion
src/shared/drivers/stepper/Stepper.h
+
11
−
1
View file @
908bf85b
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
* THE SOFTWARE.
* THE SOFTWARE.
*/
*/
#pragma once
#include
<interfaces-impl/gpio_impl.h>
#include
<interfaces-impl/gpio_impl.h>
#include
<interfaces/delays.h>
#include
<interfaces/delays.h>
#include
<utils/testutils/MockGpioPin.h>
#include
<utils/testutils/MockGpioPin.h>
...
@@ -74,6 +76,12 @@ public:
...
@@ -74,6 +76,12 @@ public:
*/
*/
void
setMicrostepping
(
Microstep
microstep
);
void
setMicrostepping
(
Microstep
microstep
);
/**
* @brief Zeros the driver's internal position.
*
*/
void
zeroPosition
();
/**
/**
* @brief Move the stepper motor by the specified amount of steps.
* @brief Move the stepper motor by the specified amount of steps.
*/
*/
...
@@ -184,6 +192,8 @@ inline void Stepper::setMicrostepping(Microstep microstep)
...
@@ -184,6 +192,8 @@ inline void Stepper::setMicrostepping(Microstep microstep)
}
}
}
}
void
Stepper
::
zeroPosition
()
{
currentPosition
=
0
;
}
inline
void
Stepper
::
move
(
int32_t
steps
)
inline
void
Stepper
::
move
(
int32_t
steps
)
{
{
if
(
speed
==
0
)
if
(
speed
==
0
)
...
@@ -229,7 +239,7 @@ inline uint32_t Stepper::getCurrentPosition() { return currentPosition; }
...
@@ -229,7 +239,7 @@ inline uint32_t Stepper::getCurrentPosition() { return currentPosition; }
inline
float
Stepper
::
getCurrentDegPosition
()
inline
float
Stepper
::
getCurrentDegPosition
()
{
{
return
currentPosition
*
stepAngle
;
return
currentPosition
*
stepAngle
/
getMicrosteppingValue
()
;
}
}
inline
int
Stepper
::
getMicrosteppingValue
()
inline
int
Stepper
::
getMicrosteppingValue
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment