Files
guadaloop_lev_control/PIDTesting-2yoke4coil/IndSensorMap.hpp

40 lines
735 B
C++
Raw Normal View History

#ifndef IND_SENSOR_MAP_HPP
#define IND_SENSOR_MAP_HPP
2025-11-16 20:05:18 -06:00
#include <stdint.h>
// Inductive Sensor Mapping Struct
typedef struct IndSensorMap {
float A;
float K;
float B;
float C;
float v;
} IndSensorMap;
2025-11-16 13:50:04 -06:00
class IndSensor {
2025-11-16 20:05:18 -06:00
public:
bool oor;
float mmVal;
2025-11-16 20:05:18 -06:00
// Constructor
IndSensor(IndSensorMap calibration, uint8_t analogPin);
// Read sensor directly from pin and convert to millimeters
float readMM();
2025-11-16 13:50:04 -06:00
2025-11-16 20:05:18 -06:00
private:
IndSensorMap consts;
uint8_t pin;
2025-11-16 13:50:04 -06:00
2025-11-16 20:05:18 -06:00
// helper function to convert analog reading to millimeters
float toMM(unsigned int raw);
2025-11-16 13:50:04 -06:00
};
// sensor instances
extern IndSensor indL;
extern IndSensor indR;
extern IndSensor indF;
extern IndSensor indB;
#endif // IND_SENSOR_MAP_HPP