Acknowledged
over 1 year ago

Bug with reading stress data on Forerunner 55

I got the following error on the Forerunner 55 trying to iterate through the stress history.  What is happening here?

Error: 'Watchdog Tripped Error - Code Executed Too Long'
Details: 'Failed invoking <symbol>'
Time: 2023-10-10T01:57:04Z
Part-Number: 006-B3869-00
Firmware-Version: '8.02'
Language-Code: rus
ConnectIQ-Version: 4.2.3
Store-Id: d88d7ef0-7430-4968-b5e7-b4668696ee45
Store-Version: 11
Filename: DA9B3440
Appname: (redacted)
Stack:
- pc: 0x10000993
- pc: 0x100012b9
---

This is the code snippet involved.

var sensorIter=null;
if (Toybox has :SensorHistory){
    if (Toybox.SensorHistory has :getStressHistory) {
        sensorIter= Toybox.SensorHistory.getStressHistory({
           :order => Toybox.SensorHistory.ORDER_OLDEST_FIRST });
    }
}
if (sensorIter != null) {
    var previous = sensorIter.next();
    var sample = sensorIter.next();
    while (sample != null ) {

        if (sample.data != null && previous.data != null ) {

            // code redacted (sample.when, sample.data, previous.when and previous.data read,)
       }

       // prep for next iteration
       previous = sample;
       sample = sensorIter.next();
        // THIS LOOP NEVER EXITS, CAUSING TIMEOUT ERROR

    }
}