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?
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?