Closed dotorg closed 5 years ago
Thanks for demonstrating this issue so clearly. The problem is caused by static declarations in the code that should have been changed after standalone testing was completed.
New version is 2.1.0. I have tested it working, so please test when you can and close the issue if you find it is working.
No further response from OP
Subject of the issue
I'm having an issue with the library where it does't seem to handle having multiple instances of the MD_UISwitch_Digital class instantiated in the code. Not sure if I have something configured wrong, but based on the documentation, this seems correct. (See below.)
Your Environment
Library Version: 2.0.0 Arduino IDE version: 1.8.8 Hardware model/type: ESP8266 / Wemos D1
Steps to Reproduce
With the code below, if you don't define MDUISWITCH_ENABLE and log the raw button states, the code outputs correctly. (In my case B1 and B2 have external pull-downs, B3 uses an internal pull-up, but the issue presents itself regardless of which buttons are wired up where...)
When using MD_UISwitch_Digital, BTN2 and BTN3 do not respond to any changes on the GPIO pins. For example, a single press of BTN1 yields: B3: KEY_DOWN B1: KEY_DOWN B3: KEY_UP B1: KEY_UP B3: KEY_PRESS B1: KEY_PRESS
BTN2 doesn't respond at all, although it does work correctly without MD_UISwitch.
BT3 single push generates: B2: KEY_DOWN B3: KEY_DOWN B1: KEY_DOWN B2: KEY_UP B3: KEY_UP B1: KEY_UP B2: KEY_PRESS B3: KEY_PRESS B1: KEY_PRESS
If I downgrade to 1.2.1, things work fine, so this is something new in 2.0.
Code Demonstrating the Issue