Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/ESP32RotaryEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
#endif
#endif

#if __cplusplus >= 201703L
#define MAYBE_UNUSED [[maybe_unused]]
#elif defined( __GNUC__ ) || defined( __clang__ )
#define MAYBE_UNUSED __attribute__((unused))
#else
#define MAYBE_UNUSED
#endif

RotaryEncoder::RotaryEncoder( uint8_t encoderPinA, uint8_t encoderPinB, int8_t buttonPin, int8_t vccPin, uint8_t encoderSteps )
: encoderPinA{ encoderPinA },
encoderPinB{ encoderPinB },
Expand Down Expand Up @@ -258,7 +266,7 @@ bool RotaryEncoder::buttonPressed()
}

bool wasPressed;
unsigned long duration;
MAYBE_UNUSED unsigned long duration;

portENTER_CRITICAL( &mux );
wasPressed = buttonPressedFlag;
Expand All @@ -279,7 +287,7 @@ bool RotaryEncoder::encoderChanged()
}

bool hasChanged;
long value;
MAYBE_UNUSED long value;

portENTER_CRITICAL( &mux );
hasChanged = encoderChangedFlag;
Expand Down