Complete
over 4 years ago

WERETECH-9471

Fixed

Sensor.setEnabledSensors exception on Venu, Vivoactive 4

I have been getting numerous reports of app crashes due to the Sensor.setEnabledSensors call. This is occurring on a Venu with the new 4.90 firmware, and I've had reports of possibly the same error on Vivoactive 3 and 4 watches after they received their most recent firmware updates in the past week.

My call is

 Snsr.setEnabledSensors( [Snsr.SENSOR_HEARTRATE,Snsr.SENSOR_BIKECADENCE,Snsr.SENSOR_BIKEPOWER] );

(which has been unchanged for literally years) and this is causing this error:
Error: Array Out Of Bounds Error
Details: 'Failed invoking <symbol>'

Removing Snsr.SENSOR_BIKEPOWER from the array does not make any difference.

Parents
  • I was able to reproduce this on a 945, but only once.  I removed all sensors I had paired with ANT, and ran an app that does

    Sensor.setEnabledSensors([Sensor.SENSOR_PULSE_OXIMETRY]);

    And got the "Array out of Bounds" error.  So, it doesn't seem to be based on a specific sensor.

    Rebooting the watch and all runs fine.

    Looking through my ERA reports, I see cases of this, but the number of occurrences for each is small.  The specific sensor doesn't matter in those apps, and in one case I was disabling the senors by passing an array of [] (this was really old code that I first added in the CIQ 1.2 days and hasn't been an issue before.)

    Some of the apps were compiled with 3.1, some 3.2, so that doesn't matter.

    And it's happening on different devices, but what's common, is all have CIQ 3.2.x VMs

Comment
  • I was able to reproduce this on a 945, but only once.  I removed all sensors I had paired with ANT, and ran an app that does

    Sensor.setEnabledSensors([Sensor.SENSOR_PULSE_OXIMETRY]);

    And got the "Array out of Bounds" error.  So, it doesn't seem to be based on a specific sensor.

    Rebooting the watch and all runs fine.

    Looking through my ERA reports, I see cases of this, but the number of occurrences for each is small.  The specific sensor doesn't matter in those apps, and in one case I was disabling the senors by passing an array of [] (this was really old code that I first added in the CIQ 1.2 days and hasn't been an issue before.)

    Some of the apps were compiled with 3.1, some 3.2, so that doesn't matter.

    And it's happening on different devices, but what's common, is all have CIQ 3.2.x VMs

Children
  • It's more the state of the watch than a specific sensor it seems.  As I said, I've seen it with Sensor.SENSOR_PULSE_OXIMETRY (but only once) and also where I'm passing an empty array to disable sensors in ERA.  In ERA, I also see it when I'm just using  SENSOR_TEMPERATURE.

    Based on the number of occurrences I see in ERA, it's really not that common, as I only see it a small number of times.  in the case of Sensor.SENSOR_PULSE_OXIMETRY, after rebooting the watch, I've not seen it again.

  • Hi Rob.

    Thanks for your comment.

    I changed the command to enableSensorType(), and now it works, but it is still strange. One of my other apps uses SENSOR_HEARTRATE and SENSOR_TEMPERATURE and that works fine while compilated with 3.1.9 on a 3.2.0 watch. So I think that the problem is only with SENSOR_BIKECADENCE though.

    Kees

  • Garmin offers since CIQ 3.2 a new API where you can enable and disable one single sensor. Please refer to enableSensorType() and disableSensorType.

    If you call this function separately for all the sensors you would like to support, then it works.

    Please make sure you only do this on devices which have CIQ3.2, otherwise use the old way.

    I assume that enabling more than once sensor at the same time causes the problems. Since I updated my apps I see no app crashes anymore 

  • Hi Jim.

    We I use SENSOR_HEARTRATE ,Snsr.SENSOR_BIKEPOWER. it works fine. Whenever I use Snsr.SENSOR_BIKECADENCE it fails.

    My users are using app with v3.1.9, but a fiemware update the errors started.

    Kees