-
Notifications
You must be signed in to change notification settings - Fork 124
News & Updates Archive
The News & Updates Archive contains information that previously appeared in News & Updates section of the onoff README.
onoff v4.1.0 adds type definitions for TypeScript.
onoff v4.0.0 adds support for Promises to the asynchronous read and write methods. This is a breaking change as the asynchronous read and write methods can now return Promises in scenarios where undefined was previously returned.
onoff v3.2.0 adds an new boolean option called reconfigureDirection to the Gpio constructor. This option can be used to retain the value of a GPIO output when an application is stopped and restarted.
onoff v3.1.0 adds two new features.
- The new static property Gpio.accessible can be used to determine whether or not GPIO access is possible.
- The new static properties Gpio.HIGH and Gpio.LOW can be used in place of the numeric constants 1 and 0.
Prior to v3.0.0 onoff had inadequate and undocumented support for debouncing GPIO inputs. onoff v3.0.0 comes with a very effective debouncing implementation based on lodash.debounce. It's important to know that the new implementation in v3.0.0 is not compatible with the old undocumented implementation as the semantics of the debounceTimeout option which can be specified when invoking the Gpio Constructor have changed. An example of the usage of the debounceTimeout can be found at Debouncing Buttons.
User pi on recent versions of Raspbian can access GPIOs without superuser privileges and the techniques for avoiding superuser issues previously described in section "How to handle superuser issues" no longer need to be applied. Section "How to handle superuser issues" has since been removed from the documentation.
One of the techniques for avoiding superuser issues on older versions of Raspbian was titled "Resolving superuser issues with onoff". This technique is no longer supported with onoff v1.0.0 or higher.
The persistentWatch option that was supported by onoff v0.1.2 through v0.2.3 was removed with onoff v0.3.0. As of v0.3.0 watchers are always persistent. Note that this is a breaking change as the persistentWatch option defaulted to false which resulted in one-shot watchers.
If you were explicitly setting persistentWatch to true, the migration step is easy, simply remove the persistentWatch option.
If you were explicitly setting persistentWatch to false, or letting it default to false, you'll need to re-work your code. If one-shot watchers are needed, the effect can be achieved by calling unwatch or unwatchAll in the watcher callback the first time it's called.
The mechanisms that enable user pi on Raspbian to access GPIOs without
superuser privileges function correctly in the 2015-05-05 release of Raspbian
Wheezy. However, if Raspbian Wheezy is upgraded with sudo apt-get update
and
sudo apt-get upgrade
, these mechanisms will break. This is a known
Raspbian Wheezy issue. The
issue also describes how to work around the problem. Note that this is only an
issue on Raspbian Wheezy. On Raspbian Jessie the mechanisms function correctly.