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:
Joe Finney 2016-04-08 16:10:46 +01:00
parent 5de0824717
commit c5889e4c72

View file

@ -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();