Can a stopwatch can be done with kustom alone? (Also gyro info)

I’m thinking about a simple- start, pause, continue, reset- able one. All my ideas failed, the only solution I found is with tasker, Brandons’ videos, part 1 and 2. But as it’s very old, I wonder if there’s something inside kustom today, that I don’t find.

The other thing is similar story. Can kustom pull gyro info without tasker?

Hi there,

As far as I know, there is no support for a stopwatch functionality in any Kustom presets.

Perhaps that may be supported in some future versions.

I hope this would help.
:smiling_face::+1:

Thanks for letting me know. :+1: After I posted, I found a way to have an automatic counter, that goes from 0-59 based on df(s) continuous changing, I can reset to zero, and also managed to make a pause/continue function. This could be enough to make the minutes an hours as well.
But for some reason, it’s not synchronized, like compare to real time, it has a delay of a second so far, I was playing hours with it, yet still won’t be exact. So for now I give it a rest, til I finish the rest of the project.

Actually, it’s not a syncron issue. Now as u mentioned, I recreated it in a new project, to make it all clear. I noticed, that as long as I monitor it, it’s all perfect. But if I do anything else with the phone, it probably pauses the flow, and that is what makes the delay. I opened youtube, and after some minutes it was 10s of seconds different.
So technically it can be done, but -I assume - for energy savings, flows stop in the background.

I know it’s not as exact, as a real stopwatch, there would be always a +/-fraction of a second with every start/pause touch- for obvious reasons, but to bake a cake it could work :grinning:

I attach it, if u wanna have a look
almost_working_stopwatch.klwp (101.7 KB)

As long as you’re fine with only having seconds, you can simply store $df(S)$ in a global on touch (touch action > toggle global switch > select a text global), then simply use $df(S) - gv(stored)$ to calculate how many seconds have passed, which you can also format with tf(): $tf(df(S) - gv(stored), "H:mm:ss")$.

The last formula in your post shows minutes and hours too, so not sure what you mean by “only seconds” :slightly_smiling_face:
This is getting closer to a stopwatch definitely, I appreciate your help. Now hopefully I can find a way to have a pause/continue method.
Thanks

By “only seconds” I mean that you don’t get under second precision, when I think of stopwatch I just think more precision than seconds.

You can extend this idea for pausing/continuing, have 2 more text globals - paused to store the number of seconds at last pause time, and ispaused to hold 1 when paused and 0 when not. Then change your formula to:

$tf(gv(paused) + if(gv(ispaused) = 0, df(S) - gv(stored)), "H:mm:ss")$

To pause, store $df(S) - gv(stored) + gv(paused)$ in gv(paused) and set gv(ispaused) to 1.
To resume, set gv(ispaused) to 0 and gv(stored) to $df(S)$.
To stop (pause + reset), store 0 in gv(paused) and set gv(ispaused) to 1.
To restart, store 0 in gv(paused), set gv(ispaused) to 0 and gv(stored) to $df(S)$.

Global names are admittedly a bit janky but I hope you get the idea.

Ah, that makes sense now. Yeah, I’m happy with second precision.
Wow, you were ready with this, I wish I could know half of what you know. Thank you so much, I’ll try to figure it out, I made it be able to pause already, but now with this new info it’ll take surely way less time. :handshake:

1 Like

Glad it works!

Best resource I have is the kode guide, but it doesn’t really teach you problem solving, it just gives you general information about kode. I have a bunch of programming experience which unfortunately isn’t easily relied.

1 Like

Well, it doesn’t work yet, I haven’t tried yet since, but based on your first answer I’m sure it will, so in advance I signed your post as solution. That link is super useful, I was about to ask for a documentation where I can learn, I’ve never seen that capital S and H, and I might find something about gyro as well, or anything I need in future.

1 Like

It might take some debugging, there’s a bunch of moving parts and it’s easy to make a mistake, if you have trouble feel free to reply here and I might be able to assist.

Capital S is unix time, or seconds since Jan 1, 1970, capital H is total hours including full days (if you had for example 26 hours, H gives you the full 26, while h gives you 2 and D (days) gives you 1).

All format tokens for df() available here:

and here for tf():

That website also has docs for other Kustom functions.

2 Likes

Done. Works like a charm. It was i little confusing for first, (not what you wrote, but for my limitation of the brain) but after few strange, random numbers and rereading your post, now it’s functioning as I imagined. Thanks again for helping out.

1 Like