Prevent auto-compass calibration when a compass event listener is registered

- Calibraiton algorithm now only activated when heading() is requested
This commit is contained in:
Joe Finney 2018-09-08 18:07:41 +01:00
parent 1c7c1518e5
commit d54e26fd4d
1 changed files with 1 additions and 2 deletions

View File

@ -216,8 +216,7 @@ void MicroBit::onListenerRegisteredEvent(MicroBitEvent evt)
case MICROBIT_ID_COMPASS:
// A listener has been registered for the compass.
// The compass uses lazy instantiation, we just need to read the data once to start it running.
// Touch the compass through the heading() function to ensure it is calibrated. if it isn't this will launch any associated calibration algorithms.
compass.heading();
compass.getSample();
break;