#pragma once #include enum AxisPos : int8_t { POS_LOW = -1, POS_CENTRE = 0, POS_HIGH = 1 }; class GearSelector { public: GearSelector(uint8_t xPin, uint8_t yPin, int threshLow, int threshHigh); bool update(); int getGear() const; char getGearChar() const; private: uint8_t _xPin, _yPin; int _threshLow, _threshHigh; int _currentGear; AxisPos _quantize(int val) const; int _mapToGear(AxisPos x, AxisPos y) const; };