diff --git a/src/TouchInput.cpp b/src/TouchInput.cpp index 1df4c85..f0309ac 100644 --- a/src/TouchInput.cpp +++ b/src/TouchInput.cpp @@ -4,24 +4,23 @@ #include #include -#define TOUCH_THRESHOLD 20 - class TouchInput { const unsigned int _debounceDelay = 50; - int _pin; + int _pin, _touchThreshold; std::function _callback; unsigned long _touchStart; bool _currentTouchValue, _prevTouchValue; public: - TouchInput(int pin, std::function callback){ + TouchInput(int pin, int touchThreshold, std::function callback){ _pin = pin; + _touchThreshold = touchThreshold; _callback = callback; } void loop(){ - bool touching = touchRead(_pin) <= TOUCH_THRESHOLD; + bool touching = touchRead(_pin) <= _touchThreshold; if (_prevTouchValue != touching) { _touchStart = millis(); diff --git a/src/main.cpp b/src/main.cpp index 42701e7..0020356 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,11 +31,11 @@ LedManager _leds(&_timers); BluetoothLightControl _bluetoothLightControl(&_leds); BluetoothLEDCallback _btCallback(&_bluetoothLightControl); BluetoothService _btService("Van Lights", &_btCallback); -TouchInput _touchInput(32, []() { +TouchInput _touchInput(33, 9, []() { _seatingLeds.toggle(); _kitchenLeds.toggle(); _bathroomLeds.toggle(); - _awningLeds.toggle(); + //_awningLeds.toggle(); _cabLeds.toggle(); });