2025-12-28 20:52:11 -06:00
|
|
|
#ifndef CALIBRATION_H
|
|
|
|
|
#define CALIBRATION_H
|
|
|
|
|
#include <atomic>
|
|
|
|
|
#include "encoder.hpp"
|
|
|
|
|
|
|
|
|
|
class Calibration {
|
|
|
|
|
public:
|
2026-01-08 18:14:36 -06:00
|
|
|
void init();
|
|
|
|
|
bool beginDownwardCalib(Encoder& topEnc);
|
|
|
|
|
bool completeCalib(Encoder& topEnc);
|
|
|
|
|
int32_t convertToTicks(uint8_t appPos);
|
|
|
|
|
uint8_t convertToAppPos(int32_t ticks);
|
|
|
|
|
bool getCalibrated() {return calibrated;}
|
|
|
|
|
bool clearCalibrated();
|
|
|
|
|
std::atomic<int32_t> DownTicks;
|
|
|
|
|
std::atomic<int32_t> UpTicks;
|
2025-12-28 20:52:11 -06:00
|
|
|
|
|
|
|
|
private:
|
2026-01-08 18:14:36 -06:00
|
|
|
std::atomic<bool> calibrated;
|
2025-12-28 20:52:11 -06:00
|
|
|
};
|
|
|
|
|
|
2026-01-08 18:14:36 -06:00
|
|
|
extern Calibration calib;
|
|
|
|
|
|
2025-12-28 20:52:11 -06:00
|
|
|
#endif
|