Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Accuracy of setInterval and new Date() on Versa3/Sense (SDK6) while screen is off

Right now I am facing the issue that my metronome application which vibrates depending on defined BPM  is approx. only updated once per second if the screen is off on my Versa3/Sense. Due to the fact that setInterval itself is not accurate enough for a metronome I am using the new Date() object to check the passed milliseconds after each 10ms with setInterval function. Maybe there are better ways to implement this but it worked completly fine with my old Versa.

For some reasons the application is working fine as long as developer bridge is enabled on phone/Versa3. This is the reason why I didn't notice this issue in development phase. Also the review by Fitbit was passed without any issues. The bug was reported by users.

Can someone explain what happens here or how I can fix it?

 

Thanks for your support!

Best Answer
0 Votes
2 REPLIES 2

The setInterval may not be that accurate but possibly check less often than 10 ms.

Depending on the code it may take too long to process for such a short period and of course you are clearing the old interval at each adjustment?

Odd about the developer bridge having an influence.

Author | ch, passion for improvement.

Best Answer
0 Votes

Thanks for your reply @Guy_. The modification of the interval period does not change anything and the interval is cleared after each adjustment.

 

I have also added some logging (for "debugging" reasons) on the screen for each interval execution and I can see correct timestamps but the vibration is missing. But if the logging (text) on the screen is added during screen is off or immediatly after turning the screen on I am obviously not sure. 

 

Maybe someone from Fitbit can explain the reason why this happens.

Best Answer
0 Votes