Debugging and troubleshooting
-
I am still learning my ways but wanted to see if there is anyone who has any ideas on where to start troubleshooting (and how to do it). I am new to both JS and have been away from coding for many years.
I am trying to develop an app that is pretty similar to the standard “intensity zones” screen - but with a few changes/improvements:
I will use it for heartrate based intervals so I want the app to start a counter once the 5s trailing HR >= a specific zone (and reset the time count once 5s trailing HR falls out of this specific zone
This was my original idea on how to identify 5s trailing HR (in evaluate function):
HRacc5.shift(); //remove oldest value from HRacc5 array HRacc5[4] = input.HRCurrent; //add current HR to position five in array var HRavg5 = HRacc5.reduce( function(total, num){ return total + num }) / 5;Followed by a series of if statements based on HRavg5. (The app works well in the simulator)
However - when testing the app on the watch it freezes like a couple of minutes into the workout and I need to soft reset it.
After eliminating almost everything in the code I have come to the conclusion that the above snippet is about the only thing in in the code that could possibly cause any errors.
All ideas on how to proceed with troubleshooting is most welcome!
-
@DonTomGot
I am no JS expert myself. But some tips.The watch runs Duktape JS engine, which is only ES5.1 compliant. The simulator runs QuickJS I think. So code that will work OK in the simulator may silently fail on the watch. There is a pinned thread on the difference between simulator and watch, you can check there for advice on some of the typical stumbling blocks.
For instance the missing semicolon on the return statement will work in the simulator but likely fail on the watch.
I would also use “View system events” in the “Suunto watch view”. A lot of the failures are silent or not easy to decode, but you may find something.
You can also insert your own systemEvent statement to “print” to the event log and get a traceback that way.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login