12-29-2021 14:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-29-2021 14:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hello,
I copied a basic watch face to start on and the step counter worked. Now it just stays on 0.
It is counting them because it shows on the app but the watch face counter doesn't change from 0.
Thanks in advance!
Answered! Go to the Best Answer.
Accepted Solutions
12-29-2021 16:25
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-29-2021 16:25
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Where in your code are you updating the displayed value? The display won't change unless you tell it to. Maybe paste the relevant bit of code.
Gondwana Software

12-29-2021 16:25
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-29-2021 16:25
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Where in your code are you updating the displayed value? The display won't change unless you tell it to. Maybe paste the relevant bit of code.
Gondwana Software

12-29-2021 22:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-29-2021 22:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Ok cool. Any idea what that might look like?

12-29-2021 22:20
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-29-2021 22:20
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
ontick listener is a common choice.
Gondwana Software
12-30-2021 12:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-30-2021 12:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Cracked it thank you. There was an erroneous space in the original, turns out the one I copied would never have worked.
12-30-2021 12:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-30-2021 12:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Good debugging! 👍
Gondwana Software
02-21-2024 06:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-21-2024 06:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @Gondwana I saw that you helped Jamesismagic with his code. My Versa2 clock face has a similar problem. I initially get the correct number of steps on the clock face, but after a few seconds (probably one second) it changes to zero. Sometimes it changes to undefined if I don't have the || 0 on the stepsValue assignment
excerpts of my code:
import clock from "clock";
import * as document from "document";
import { today } from "user-activity";
import { battery } from "power";
...
let stepsHandle = document.getElementById("stepsLabel"); //tried both let and const initialization
const batteryHandle = document.getElementById("batteryLabel");
...
function updateClock() {
...
// Activity Values: adjusted type
let stepsValue = (today.adjusted.steps || 0); // without || 0, steps displays and then changes to undefined
stepsHandle.text = `${stepsValue}`; // also tried = stepsValue instead of literal
// Battery Measurement
let batteryValue = battery.chargeLevel;
// Assignment value battery
batteryHandle.text = `${batteryValue} %`; // battery level works correctly on clock face
...
}
clock.ontick = () => updateClock();
FROM INDEX.GUI
<svg viewport-fill="black">
...
<text id="stepsLabel" x="80%" y="82%"
fill="red" font-size="40" font-family="System-Regular"
text-anchor="middle" text-length="10">--</text>
<text id="batteryLabel" x="10%" y="7%"
fill="lime" font-size="30" font-family="System-Regular"
text-anchor="middle" text-length="6">00</text>
</svg>
Parts of the code I don't show here that are inside the function updateClock work correctly, as does batterylevel. Just steps goes to zero. Any help that you can suggest to a novice code-writer is appreciated.

02-21-2024 11:26
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-21-2024 11:26
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
At a quick glance, I can't see what's wrong with that. Consider putting a console.log line below the stepsValue calculation, displaying stepsValue, to verify that its value is wrong. You might also be able to verify that the function is being called only once per second.
As an aside, I'm not a fan of ||0 . If the steps value can't be read, it doesn't mean that the user hasn't taken any steps during the day. They almost certainly have, so displaying 0 is fibbing.
Gondwana Software

02-21-2024 12:03
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-21-2024 12:03
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks for taking a look, Peter
Unfortunately I can't side-load apps or clock faces now. my versa 2 never connects to the Developer Bridge. I'm loading and testing thru GAM. I don't know of a way to see the console.log. I also cant get the simulator to work either.
I'm not a fan of ||0 either. However, looking at 0 is better than undefined on my watch face. Maybe I'll make it ||10000 so it looks like I'm being active. 🙂

02-21-2024 12:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-21-2024 12:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
That's a painful way to debug. The simulator really should work for things like this. Perhaps an account issue.
Make sure that no other code is setting stepsHandle.text (which can happen if you copy-and-paste and forget to change).
Instead of a number, I make invalid fields display — or ?.
Gondwana Software

02-21-2024 15:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-21-2024 15:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I'll have to read up on the simulator again. its been a while since I tried it.
Thanks

02-22-2024 19:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-22-2024 19:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @RustyKeyboard - also possibly check your code in case you assign something to a today variable or definition.
Author | ch, passion for improvement.

