espruino / BangleApps

Bangle.js App Loader (and Apps)
https://banglejs.com/apps
MIT License
496 stars 1.17k forks source link

sched/clkinfo: reset `last` when activating an alarm #3620

Closed bobrippling closed 2 weeks ago

bobrippling commented 1 month ago

Oddly, my watch didn't go off this morning - I have a nightly backup which ran before the alarm time, so I had this snapshot of my alarm before it went off:

{
  "t": 23940000,
  "del": false,
  "on": true,
  "rp": false,
  "as": false,
  "dow": 127,
  "last": 23,
  "vibrate": "::",
  "msg": ""
}

I see two possible reasons the alarm didn't trigger:

This PR fixes the possible issue where a user has dismissed the alarm but then re-activates it via clkinfo. This shouldn't normally be possible for that alarm to retrigger in the same day (without time travel), but clearly somehow the .last property has been set on this alarm already.

thyttan commented 4 weeks ago

Thanks!

thyttan commented 4 weeks ago

I haven't tested this yet. But if you rebase on the changes Gordon made I can give it a try 👍

bobrippling commented 4 weeks ago

All sorted, and thanks - I would deploy to my gh-pages but I've got that in-use already I'm afraid! (#3626)

bobrippling commented 4 weeks ago

~All sorted, and thanks - I would deploy to my gh-pages but I've got that in-use already I'm afraid!~

Deployed!

thyttan commented 3 weeks ago

Sorry for not coming back sooner.

I just tried setting an alarm, then toggling it off then on again. It then fired at the set time a minute later.

Not an exhaustive test, but at least doesn't seem to break on my watch.

bobrippling commented 3 weeks ago

No worries, thanks for the check - I've been using this for a little while too with no issues. I could merge at the weekend if you've no objections?

thyttan commented 3 weeks ago

Yes I think that's fine 👍