summaryrefslogtreecommitdiff
path: root/src/sensor/sensor.cpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-02-15 12:33:52 +0100
committerHampusM <hampus@hampusmat.com>2022-02-15 12:33:52 +0100
commitbcdce9633dc351d3bc7f347a165348b8fab87cd9 (patch)
tree88c2f5d8f0c5fac2bca28e4b543e5209f3bc98fb /src/sensor/sensor.cpp
parent917adc6a2b6b166e37fc3d4f94b41488f0c245a5 (diff)
refactor: reorganize files & improve classes
Diffstat (limited to 'src/sensor/sensor.cpp')
-rw-r--r--src/sensor/sensor.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/sensor/sensor.cpp b/src/sensor/sensor.cpp
index a3b9a5c..5ca5dc3 100644
--- a/src/sensor/sensor.cpp
+++ b/src/sensor/sensor.cpp
@@ -1,20 +1,18 @@
#include "sensor.hpp"
-#include "registers.hpp"
-#include "utils/serial.hpp"
-#include "utils/time.hpp"
+#include "sensor/registers.hpp"
Sensor::Sensor(uint8_t address, TwoWire wire, SerialStream sout,
unsigned int throttle_time)
: _wire(wire),
+ _sout(sout),
_address(address),
_throttle_enabled(true),
_throttle_time(throttle_time),
_last_time(0),
_status(SensorStatus::OK),
_accel_to_g_force(RAW_TO_G_FACTOR),
- _ang_rate_to_dps(RAW_TO_DPS_FACTOR),
- _sout(sout)
+ _ang_rate_to_dps(RAW_TO_DPS_FACTOR)
{
}
@@ -241,52 +239,52 @@ bool Sensor::setGyroSensitivity(uint8_t sensitivity)
return true;
}
-double Sensor::getAccelX()
+double Sensor::getAccelX() const
{
return _accel_raw_x;
}
-double Sensor::getAccelY()
+double Sensor::getAccelY() const
{
return _accel_raw_y;
}
-double Sensor::getAccelZ()
+double Sensor::getAccelZ() const
{
return _accel_raw_z;
}
-double Sensor::getAngleX()
+double Sensor::getAngleX() const
{
return _accel_x;
}
-double Sensor::getAngleY()
+double Sensor::getAngleY() const
{
return _accel_y;
}
-double Sensor::getGyroX()
+double Sensor::getGyroX() const
{
return _gyro_raw_x;
}
-double Sensor::getGyroY()
+double Sensor::getGyroY() const
{
return _gyro_raw_y;
}
-double Sensor::getGyroZ()
+double Sensor::getGyroZ() const
{
return _gyro_raw_z;
}
-double Sensor::getPitch()
+double Sensor::getPitch() const
{
return _pitch;
}
-double Sensor::getRoll()
+double Sensor::getRoll() const
{
return _roll;
}