Hi everyone,
I am developing a datafield for Edge 530 and 830; Basically it is to be able to use more than the 10 maximum fields.
In addition to the fields that CIQ exposes, I calculate others such as Normalized Power, TSS, etc ...
I am not a developer and I am very new to all this; every step is costing me a lot.
It seems that the fields were starting to work but I discovered a bug. I had a mechanical breakdown on the bike and stopped to fix it. When I finished my Edge 830 it had turned off and when I turned it on I received an IQ from my datafield!
Looking in the forum I see that it may be a problem with the loss of variables and now when I do a timerStop I store 6 variables. In the onstop clear the variables and in onStart I feed the variables with the stored keys.
But I keep getting the IQ! Message. It's a problem because to reproduce the error I have to pass the .prg file and wait for the Edge to shut down after stopping it.
The error I get is:
Stack:
- pc: 0x100021e1 -> 268444129 (decimal)
- pc: 0x10001709 -> 268441353 (decimal)
<entry filename="C:\\Users\\carlos_2\\OneDrive\\ECLIPSE\\POWER-MARO\\source\\POWERMARO.mc" id="39" lineNum="378" pc="268444108" symbol="compute"/>
<entry filename="C:\\Users\\carlos_2\\OneDrive\\ECLIPSE\\POWER-MARO\\source\\POWERMARO.mc" id="39" lineNum="392" pc="268444138" symbol="compute"/>
altitud = info.altitude.format("%02d");
power30 = power30s(info.currentPower);
<entry filename="C:\\Users\\carlos_2\\OneDrive\\ECLIPSE\\POWER-MARO\\source\\POWERMAROView.mc" id="19" lineNum="426" pc="268441334" symbol="compute"/>
<entry filename="C:\\Users\\carlos_2\\OneDrive\\ECLIPSE\\POWER-MARO\\source\\POWERMAROView.mc" id="19" lineNum="427" pc="268441354" symbol="compute"/>
function compute(info) {
fields.compute(info);
return 1;
}
I use these functions:
function onTimerStop(){ Storage.setValue("KEY_elapsedTime", fields.elapsedTimer); Storage.setValue("KEY_lapINI", fields.lapINI); Storage.setValue("KEY_LAPdistINI", fields.LAPdistINI); Storage.setValue("KEY_power30", fields.power30); Storage.setValue("KEY_powerNPraw", fields.powerNPraw); Storage.setValue("KEY_avg_smoothed_power_4", fields.avg_smoothed_power_4); } --------------------------------- function onStart(app, state) { lapINI = Storage.getValue("KEY_lapINI"); elapsedTimer = Storage.getValue("KEY_elapsedTime"); LAPdistINI = Storage.getValue("KEY_LAPdistINI"); power30 = Storage.getValue("KEY_power30"); powerNPraw = Storage.getValue("KEY_powerNPraw"); avg_smoothed_power_4 = Storage.getValue("KEY_avg_smoothed_power_4"); } function onStop(app, state) { Storage.clearValues(); }
Can you give me a hand to more specifically debug the error or a vision of how not to lose the variables after the device is suspended?
I have read some post about this but they are a bit old and I can't quite fix it.
Thanks for the attention.