lancaster-university / microbit-dal

http://lancaster-university.github.io/microbit-docs
Other
254 stars 130 forks source link

Magnetometer service calibration characteristic queues requests #420

Open martinwork opened 5 years ago

martinwork commented 5 years ago

If calibration is in progress, I think the CALIBRATION_NEEDED event is queued. When the present calibration is completed another one starts, which seems to result in an OOM panic.

Perhaps the simplest compatible improvement would be to check isCalibrating() in onDataWritten and notify COMPASS_CALIBRATION_COMPLETED_ERR. A different value meaning "in progress" would be better but might throw existing software.

But what if the CALIBRATION_NEEDED event is queued for another reason? Could the value in magnetometerCalibrationCharacteristicBuffer be used as a flag?