Hello everybody and thanks for reading!
Non-developer here trying to develop a widget.
The widget has a main View which is generated dynamically (drawing points on calculated coordinates (like 200 of them)). With the instructions related to the calculations multiplied by 200 I easily hit the watchdog, so my idea was to call the calculation function asynchronously, using timers.
This is an excerpt of what I'm doing:
class MainView extends WatchUi.View {
function onUpdate(dc as Dc) as Void {
for(var i=0; i<200; i+=1){
drawGraphTimer = new Timer.Timer();
drawGraphTimer.start(self.method(:drawGraph), 10, false);
drawGraphTimer.stop();
}
}
function drawGraph(dc as DC) as Void {
// calculate x,y coordinates here
dc.drawPoint(x,y);
}
}
Of course I get errors there, as it seems I cannot pass dc to the callback function....
1st: I do not know if this makes any sense.
2nd. I do not know if there is any obviously better solution to this.
Thanks in advance for any attempt to help!