mirror of
https://github.com/adafruit/Adafruit-GFX-Library.git
synced 2026-10-26 22:10:52 +00:00
fix(GFX_Button): initialize currstate/laststate
Adafruit_GFX_Button's constructor only initializes _gfx, leaving currstate/laststate as indeterminate memory. justPressed()/ justReleased() read these before the first press() call, so they can report a spurious press/release transition on a button that was never actually touched. Fixes #401 Signed-off-by: 94xhn <87560781+94xhn@users.noreply.github.com>
This commit is contained in:
1 parent
ac6d7c3869
commit
b522b1edba
1 file changed
+4
-1
+4
-1
@@ -1806,7 +1806,10 @@ void Adafruit_GFX::invertDisplay(bool i) {
|
||||
@brief Create a simple drawn button UI element
|
||||
*/
|
||||
/**************************************************************************/
|
||||
Adafruit_GFX_Button::Adafruit_GFX_Button(void) { _gfx = 0; }
|
||||
Adafruit_GFX_Button::Adafruit_GFX_Button(void) {
|
||||
_gfx = 0;
|
||||
currstate = laststate = false;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
|
||||
Reference in new issue
Block a user