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.

  • I cannot reproduce this error but I am seeing it in ERA with only the VA4, F6 and FRx45 family lines.    The user crash reports are a 'black screen' not a IQ!, odd behavior.   

    As a note, I used a Try Catch and still fails and does not fall to the Catch.

    Is the use of enableSensorType() a viable workaround the  setEnabledSensors Array out of bounds error?

  • This is all excellent info, thanks.  But it remains clear this is a bug that Garmin needs to fix - code that has been untouched for 4+ years, and complies with a documented and current API, must not suddenly start throwing exceptions in any circumstances.

  • 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