Parameter is deleted if continue later is used

Hello


I write a program that shows me the times in the different training zones (data field).
So far the program works. However, if I interrupt the recording and want to continue it later, the data will be deleted. I have tried to use properties in the Event onTimerResume but unfortunality it dosen‘t work.
Has anybody a solution? Or is it possible to get the time in Esch Zone from the lieb?

Regards and thanks for the help
Heiko

  • You should be able to use Storage.setValue() to save data and Storage.getValue() to get it back. I'm not certain which timer callback you'll need to use, but it seems that you could do this...

    private const DATA_STORAGE_KEY = 1;
    private var mData;
    
    function initialize() {
        DataField.initialize();
    }
    
    function onTimerPause() {
        Storage.setValue(DATA_STORAGE_KEY, mData);
    }
    
    function onTimerResume() {
        mData = Storage.getValue(DATA_STORAGE_KEY);
    }
    
    function onTimerReset() {
        Storage.deleteValue(DATA_STORAGE_KEY);
    }
    
    function compute(info) {
        // update mData as needed
    }
    
    function onUpdate(dc) {
        var data = mData;
        if (data == null) {
            // no data yet
        } else {
            // display data
        }
    }

  • Hello 

    Thank you for your help. Unfortunality it doesn't work. It works on the simulator but not on the Forerunner 935.

    Regards Heiko

  • I found a solution.

    The function onTimerResume will not be called in the Forerunner 935. So I did a workaround.

    I check the elapsed time. If this is bigger than 0 I get the data from the storage (if the start has pushed).

    General the Garmins are realy cool watches. But it is sad that some functions do not work as it shoud.

    Regards Heiko