Skip to content

Begin the begin()

Choose a tag to compare

@Stutchbury Stutchbury released this 19 Jan 00:06
· 61 commits to main since this release

API Changes

The major API change in this release (v1.1.0) is the introduction of the begin() method on all input classes.
This follows the Arduino library convention and ensures better compatibility with boards that initialise their pins rather late.

The begin() method must be called for each input from within the setup() function before any other configuration.


For EventAnalog and EventJoystick the ADC resolution can be optionally passed to the constructor. The default is 10bit but most ESP32s use 12bit.


Also for EventAnalog and EventJoystick the following methods have been added:

enableAutoCalibration() (true by default) - this replaces the rather badly named allowRead() method.

setMinValue() and setMaxValue() allow the manual setting of the upper and lower limit od the ADC that can be achieved by a potentiometer or joystick. These are normally auto-calibrated as the input is used.

setAdcResolution() has been removed. Use the constructor ADC bits argument instead. setMaxValue() can be used if running a pin with a lower than expected voltage (eg my test rig feeds 3V3 into a 5v Uno pin).


The following methods are now available for all inputs:

unsetCallback() If using a class method as a callback, this must be called before destroying the class instance.

isCallbackSet() Returns true if setCallback() has been called and false if unsetCallback() has been called. Returning true does not guarantee the callback's function or method still exists.

resetIdleTimer() When called the IDLE event will be fired after setIdleTimeout() milliseconds (default 10 seconds).

New Events

DOUBLE_CLICKED and MULTI_CLICKED events for EventButton and EventEncoderButton. This means CLICKED will only fire for single clicks. As before clickCount() will return the number of clicks for MULTI_CLICKED.

Thanks to Andy @valentineautos for the feedback on these.

Fixes

Fixed idle timer so it is reset only if an event is actually fired (ie not the event has not been blocked).


Full Changelog: v1.0.2...v1.1.0