microbit: BUGFIX Wake accelerometer on listen for GESTURE events
Previously, the accelerometer was only lazily initialised when it was acccessed directly or an event handler was registered for MICROBIT_ID_ACCELEROMETER. This patch also wakes the accelerometer on event handlers registering for MICROBIT_ID_GESTURE.
This commit is contained in:
parent
5de0824717
commit
c5889e4c72
1 changed files with 1 additions and 0 deletions
|
@ -208,6 +208,7 @@ void MicroBit::onListenerRegisteredEvent(MicroBitEvent evt)
|
|||
break;
|
||||
|
||||
case MICROBIT_ID_ACCELEROMETER:
|
||||
case MICROBIT_ID_GESTURE:
|
||||
// A listener has been registered for the accelerometer.
|
||||
// The accelerometer uses lazy instantiation, we just need to read the data once to start it running.
|
||||
accelerometer.updateSample();
|
||||
|
|
Loading…
Reference in a new issue