style: fix missing formatting
This commit is contained in:
parent
0dcbe05688
commit
633d9006fb
12
maths.cpp
12
maths.cpp
|
|
@ -5,22 +5,22 @@ double degToRad(double deg) { return deg * M_PI / 180.0; }
|
|||
|
||||
double radToDeg(double rad) { return rad * 180.0 / M_PI; }
|
||||
|
||||
void angleToStep(Turret::StepRatio stepRatio, vec2<double> angle, vec2<long> &step) {
|
||||
void angleToStep(Turret::StepRatio stepRatio, vec2<double> angle,
|
||||
vec2<long> &step) {
|
||||
step.x = angle.x * stepRatio.x;
|
||||
step.y = angle.y * stepRatio.y;
|
||||
}
|
||||
|
||||
void cartesianToPolar(Turret::StepRatio stepRatio, Turret::Offset offset, vec2<long> zero, vec3<double> position, vec2<long> &step) {
|
||||
void cartesianToPolar(Turret::StepRatio stepRatio, Turret::Offset offset,
|
||||
vec2<long> zero, vec3<double> position,
|
||||
vec2<long> &step) {
|
||||
// x = -x; // natural axis direction
|
||||
position.y = -position.y; // natural axis direction
|
||||
double dX = position.x + offset.x;
|
||||
double dY = position.y + offset.y;
|
||||
double dZ = position.z + offset.z;
|
||||
|
||||
vec2<double> angle(
|
||||
atan2(dZ, dY) - M_PI / 2,
|
||||
atan2(dZ, dX) - M_PI / 2
|
||||
);
|
||||
vec2<double> angle(atan2(dZ, dY) - M_PI / 2, atan2(dZ, dX) - M_PI / 2);
|
||||
|
||||
angleToStep(stepRatio, angle, step);
|
||||
}
|
||||
|
|
|
|||
6
maths.h
6
maths.h
|
|
@ -2,5 +2,7 @@
|
|||
|
||||
double degToRad(double deg);
|
||||
double radToDeg(double rad);
|
||||
void angleToStep(Turret::StepRatio stepRatio, vec2<double> angle, vec2<long> &step);
|
||||
void cartesianToPolar(Turret::StepRatio stepRatio, Turret::Offset offset, vec2<long> zero, vec3<double> position, vec2<long> &step);
|
||||
void angleToStep(Turret::StepRatio stepRatio, vec2<double> angle,
|
||||
vec2<long> &step);
|
||||
void cartesianToPolar(Turret::StepRatio stepRatio, Turret::Offset offset,
|
||||
vec2<long> zero, vec3<double> position, vec2<long> &step);
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
#include "maths.h"
|
||||
#include <kissStepper.h>
|
||||
|
||||
Turret::Turret(StepRatio step_ratio, Offset offset, PinMap pin_map_x, PinMap pin_map_y)
|
||||
: _stepper(
|
||||
kissStepper(static_cast<uint8_t>(pin_map_x.direction),
|
||||
Turret::Turret(StepRatio step_ratio, Offset offset, PinMap pin_map_x,
|
||||
PinMap pin_map_y)
|
||||
: _stepper(kissStepper(static_cast<uint8_t>(pin_map_x.direction),
|
||||
static_cast<uint8_t>(pin_map_x.pulse),
|
||||
static_cast<uint8_t>(pin_map_x.enable)),
|
||||
kissStepper(static_cast<uint8_t>(pin_map_y.direction),
|
||||
|
|
|
|||
9
turret.h
9
turret.h
|
|
@ -3,8 +3,7 @@
|
|||
|
||||
#include <kissStepper.h>
|
||||
|
||||
template <typename T>
|
||||
struct vec3 {
|
||||
template <typename T> struct vec3 {
|
||||
T x;
|
||||
T y;
|
||||
T z;
|
||||
|
|
@ -13,8 +12,7 @@ struct vec3 {
|
|||
vec3(T _x, T _y, T _z) : x(_x), y(_y), z(_z) {}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct vec2 {
|
||||
template <typename T> struct vec2 {
|
||||
T x;
|
||||
T y;
|
||||
|
||||
|
|
@ -40,7 +38,8 @@ public:
|
|||
int laser;
|
||||
};
|
||||
|
||||
Turret(StepRatio step_ratio, Offset offset, PinMap pin_map_x, PinMap pin_map_y);
|
||||
Turret(StepRatio step_ratio, Offset offset, PinMap pin_map_x,
|
||||
PinMap pin_map_y);
|
||||
|
||||
Turret &init();
|
||||
Turret &gotoHome();
|
||||
|
|
|
|||
Loading…
Reference in a new issue