From bcdce9633dc351d3bc7f347a165348b8fab87cd9 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 15 Feb 2022 12:33:52 +0100 Subject: refactor: reorganize files & improve classes --- src/sensor/sensor.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'src/sensor/sensor.cpp') 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; } -- cgit v1.2.3-18-g5258