➕ Moves common math functions to own file
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
#ifndef MATHUTILS_H
|
||||
#define MATHUTILS_H
|
||||
|
||||
#include <cmath>
|
||||
|
||||
inline float lerp(float start, float end, float t) { return (1 - t) * start + t * end; }
|
||||
|
||||
inline bool isEqual(float a, float b, float epsilon) { return std::fabs(a - b) < epsilon; }
|
||||
|
||||
inline float round2(float value) { return (int)(value * 100 + 0.5) / 100.0; }
|
||||
|
||||
#endif
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <EventSocket.h>
|
||||
#include <TaskManager.h>
|
||||
#include <Kinematics.h>
|
||||
#include <MathUtils.h>
|
||||
|
||||
#define DEFAULT_STATE false
|
||||
#define LIGHT_SETTINGS_ENDPOINT_PATH "/api/input"
|
||||
@@ -91,8 +92,6 @@ class MotionService {
|
||||
_socket->emit(ANGLES_EVENT, output, originId.c_str());
|
||||
}
|
||||
|
||||
float lerp(float start, float end, float t) { return (1 - t) * start + t * end; }
|
||||
|
||||
bool updateMotion() {
|
||||
switch (motionState) {
|
||||
case MOTION_STATE::IDLE: return false; break;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <HttpEndpoint.h>
|
||||
#include <SecurityManager.h>
|
||||
#include <StatefulService.h>
|
||||
#include <MathUtils.h>
|
||||
#include <list>
|
||||
|
||||
#include <SPI.h>
|
||||
@@ -333,8 +334,6 @@ class Peripherals : public StatefulService<PeripheralsConfiguration> {
|
||||
return temperature;
|
||||
}
|
||||
|
||||
double round2(double value) { return (int)(value * 100 + 0.5) / 100.0; }
|
||||
|
||||
protected:
|
||||
void updateImu() {
|
||||
doc.clear();
|
||||
|
||||
Reference in New Issue
Block a user