04-22-2021 06:12 - edited 04-30-2021 07:14
04-22-2021 06:12 - edited 04-30-2021 07:14
I want to have to steps update in my clockface constantly, like every second or so. It currently refreshes on screen-wake or when I go back to the clock face from another app, but there is a noticeable delay.
This is the code I was using to have the steps update:
let txtSteps = document.getElementById("txtSteps");
function updateSteps() {
let steps = (txtSteps.text = today.adjusted.steps || 0);
txtSteps.text = `${steps}`;
}
display.onchange = () => updateSteps();
updateSteps();
display.onchange = function() {if (display.on) {
updateSteps();
} }
Any suggestions?
Answered! Go to the Best Answer.
09-08-2021 04:55
09-08-2021 04:55
I finally figured out how to put it in my ontick() handler. For those curious, here is the code I used:
let txtSteps = document.getElementById("txtSteps");
clock.granularity = "seconds";
clock.addEventListener("tick", (evt) => {
let steps = (txtSteps.text = today.adjusted.steps || 0);
txtSteps.text = `Steps: ${steps}`;
});
04-22-2021 13:31
04-22-2021 13:31
Do it in your ontick() handler.
04-23-2021 05:41 - edited 05-03-2021 06:09
04-23-2021 05:41 - edited 05-03-2021 06:09
@Gondwana wrote:Do it in your ontick() handler.
Thank you so much. Would you mind giving me the code fully written out? I am not a great programmer, so I am not quite sure how to do so.
05-01-2021 19:25 - edited 05-01-2021 19:27
05-01-2021 19:25 - edited 05-01-2021 19:27
I do it in a very similar way as you originally posted, and it works fine for me! 🤷:male_sign:
05-02-2021 08:34
05-02-2021 08:34
@Tnoff wrote:I do it in a very similar way as you originally posted, and it works fine for me! 🤷
The code in my original post does work fine, but as mentioned before, there is a noticeable delay of the steps updating. What code are you using?
05-28-2021 06:18
05-28-2021 06:18
I have been fiddling around on the Fitbit Studio, but I have had no luck with being able to update the steps constantly. I was wondering if anyone else has any suggestions. Thanks in advance.
09-08-2021 04:55
09-08-2021 04:55
I finally figured out how to put it in my ontick() handler. For those curious, here is the code I used:
let txtSteps = document.getElementById("txtSteps");
clock.granularity = "seconds";
clock.addEventListener("tick", (evt) => {
let steps = (txtSteps.text = today.adjusted.steps || 0);
txtSteps.text = `Steps: ${steps}`;
});