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 saw this one today, too, but I can confirm it has nothing to do with the specific sensors!

    This is the code it failed on:

    function disableSensors() {
        Position.enableLocationEvents(Position.LOCATION_DISABLE, method(:onPosition));
    	Sensor.setEnabledSensors([]);	// CRASHES ON THIS LINE!	
    }

    I'm afraid I've lost the ERA report, but I think it was on a Fenix 6.

Comment
  • I saw this one today, too, but I can confirm it has nothing to do with the specific sensors!

    This is the code it failed on:

    function disableSensors() {
        Position.enableLocationEvents(Position.LOCATION_DISABLE, method(:onPosition));
    	Sensor.setEnabledSensors([]);	// CRASHES ON THIS LINE!	
    }

    I'm afraid I've lost the ERA report, but I think it was on a Fenix 6.

Children
  • In case it's relevant, on one app it crashed here on a Vivoactive 4 (French):

    Sensor.enableSensorType(Sensor.SENSOR_FOOTPOD);

    In another app, also in Vivoactive 4 (French), it crashed inside my checkEnabledSensors method, but on a nonsense line ("if(value == 26)") so not sure what the hell happened there.

  • Has something changed?

    I have the fix suggested above (if Sensor has :enableSensorType) and it worked for a while, but since yesterday I am seeing reports of this from Vivoactive 4.

  • Not sure whether it's relevant, but that was called in response to a menu action.

    EG: The view opens, sensors might or might not have been enabled (I have no way of knowing), pushView into menu, menu item selected, disableSensors() called as part of clean up to prepare for new menu setting.

    Obviously, no bugs shown in simulator or on my 735xt, only where it matters in front of someone using my app!