Skip to content
Snippets Groups Projects
Commit 2cfd7aa5 authored by Emilio Corigliano's avatar Emilio Corigliano Committed by Matteo Pignataro
Browse files

[Stepper] Updated StepperData struct

parent 082ab1f4
Branches
Tags
1 merge request!177[Stepper] Updated StepperData struct
Pipeline #6256 passed
...@@ -166,13 +166,8 @@ bool Stepper::isEnabled() { return enabled; } ...@@ -166,13 +166,8 @@ bool Stepper::isEnabled() { return enabled; }
StepperData Stepper::getState(float moveDeg) StepperData Stepper::getState(float moveDeg)
{ {
return {TimestampTimer::getTimestamp(), return {TimestampTimer::getTimestamp(), enabled, getCurrentDegPosition(),
static_cast<unsigned int>(stepPin.getPort()), speed, moveDeg};
stepPin.getNumber(),
enabled,
getCurrentDegPosition(),
speed,
moveDeg};
} }
} // namespace Boardcore } // namespace Boardcore
\ No newline at end of file
...@@ -30,24 +30,32 @@ namespace Boardcore ...@@ -30,24 +30,32 @@ namespace Boardcore
struct StepperData struct StepperData
{ {
uint64_t timestamp; uint64_t timestamp;
unsigned int pulsePinPort;
unsigned int pulsePinNumber;
bool enabled; bool enabled;
float positionDeg; float positionDeg;
float speed; float speed;
float moveDeg; float moveDeg;
StepperData()
: timestamp(0), enabled(0), positionDeg(0), speed(0), moveDeg(0)
{
}
StepperData(uint64_t timestamp, bool enabled, float positionDeg,
float speed, float moveDeg)
: timestamp(timestamp), enabled(enabled), positionDeg(positionDeg),
speed(speed), moveDeg(moveDeg)
{
}
static std::string header() static std::string header()
{ {
return "timestamp,pulsePinPort,pulsePinNumber,enabled,positionDeg," return "timestamp,enabled,positionDeg,speed,moveDeg\n";
"speed,moveDeg\n";
} }
void print(std::ostream& os) const void print(std::ostream& os) const
{ {
os << timestamp << "," << pulsePinPort << "," << pulsePinNumber << "," os << timestamp << "," << enabled << "," << positionDeg << "," << speed
<< enabled << "," << positionDeg << "," << speed << "," << moveDeg << "," << moveDeg << "\n";
<< "\n";
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment