UWP MetaWear R Error Until Battery Dies

Hello,

I'm working on a UWP app that involves streaming angular data (as you may remember). It seems that whenever I am streaming data and exit the program without hitting "Stop" (which runs the appropriate code for stopping the signal), my sensor gets an error the next time I use it. This is the error:

System.AccessViolationException occurred
  HResult=0x80004003
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  Source=<Cannot evaluate the exception source>
  StackTrace:
   at MbientLab.MetaWear.Functions.mbl_mw_connection_notify_char_changed(IntPtr board, Byte[] value, Byte len)
   at MbientLab.MetaWear.Template.MetaWearBoard.notifyHandler(GattCharacteristic gattCharChanged, GattValueChangedEventArgs obj) in C:\Users\Dan\Desktop\Angle Sensor Project\MetaWear-UwpStarter-master\CS Template\MetaWearBoard.cs:line 145

This occurs as soon as I select the sensor from the list of connected sensor. This problem is not fixed by reconnecting the sensor or restarting the computer. I have to wait until the sensor dies and is recharged for it to work again. This is very inconvenient, and occasionally happens even with perfect use (hitting stop every time before exiting). Is there any code that can be run on the sensor, or any other solution that could solve this problem? It seems like basically the sensor need to be "reset".

Thank you,
Dan

Comments

This discussion has been closed.