- provide a generic way to read default status of the pin after boot
allows us to use switch as both on and off, independent of the position on boot
- add BUTTON_DEFAULT_LOW & BUTTON_DEFAULT_BOOT (now it's not just BUTTON_DEFAULT_HIGH)
wiki described raw numbers for some reason :/ this will break that
- clean-up 'constexpr const' and 'const' function args, both are redundant
- clean-up debounce event member defaults, put things in the header
- Add ::Released button event to be used specifically with switches, opposite of ::Pressed
- Always use default state for switches instead of ignoring it and using current pin reading as value. This allows us to boot with the switch held in the opposite state and trigger the correct event immediately
(meaning, switches now depend on the BUTTON_DEFAULT_HIGH presence to detect the default position)
- BREAKING: Fixup hardware.h. Any custom board needs manual changes.
- BREAKING: Rework MQTT button messages to send text from debug messages instead of numeric code
- Buttons events source as button property instead of a global one
- Rename events source -> provider for all settings, consistent with the other things like relay and light providers
- AnalogPin to read between a certain analogRead() range
Trying to follow defaults here - analog 'press' is digital LOW, default value is HIGH, so no additional cfg entries are needed besides pin, level and changing evt source
- (debug) Refactor gpio command, add adc to show analogRead(pin)
- (debug) Add button command
Implemented based on:
https://gitter.im/tinkerman-cat/espurna?at=5f5d44c8df4af236f902e25dhttps://gitter.im/tinkerman-cat/espurna?at=5f60e7f1f969413294e95370
- general conversion from .ino modules into a separate .cpp files
- clean-up internal headers, place libraries into .h. guard .cpp with _SUPPORT flags
- fix some instances of shared variables instead of public methods
- tweak build system to still build a single source file via os environment variable ESPURNA_BUILD_SINGLE_SOURCE
With uint8_t length function _buttonMapReleased never returned BUTTON_EVENT_LNGCLICK. BUTTON_EVENT_CLICK returned instesd. I verified that with uint16_t length it returns BUTTON_EVENT_LNGCLICK when correspondent delay passed.
- use similar to relay & wifi, configuration through helper methods that
use indexed defines
- clock cycles for led delay polling
- button mode defaults