Toybox.Timer limit

Does anyone know the maximum time in ms that a Timer will accept?

  • as the value you pass when you start a timer is a Number (32 bits), and it's in milliseconds.  If it's treated as unsigned (it likely is), that's something like 4b ms.

  • Thanks, it's not what seems to be happening in a watchface without background.

    In the simulator it works fine for 10 minutes or less for sure, but something more than that [not sure the break point, hence the question] and it fails.

    Is it possible that the Simulator sleeps after a certain time without raising the condition.

    To that end on a real device, onShow and OnHide correspond to display on and off. What else happens whilst the display is off, when is sleep activated?

  • In a watch face you can only have a timer running in high power mode, which happens on a real device after a tap/gesture and after after 10 seconds it drops back to low power

    onEnterSleep() is called when you enter low power.  onExitSleep() when you enter highPower.

    Are you talking about a device with an MIP display or AMOLED.  I think it's AMOLED as MIP displays don't turn off.  With AMOLED you can keep the display on if Always On Display is set on the watch and you do things like no more than 10% of the pixels are on in low power.

  • Venu 2 Plus

    Can anything be done in the app in lower power mode without having the screen on and without background?

  • In low power, on all watches, onUpdate is only called once a minute, so that's as often as the WF runs

  • I'm running a test with a widget in the sim where I set the timer to 20 minutes and it's working fine.

  • Testing in a WF, 999 seconds fails to trigger, 599 does trigger

    Command

    mTimer.start(method(:ProcessTimed), 999*1000, false);

    Trace
     ** onHide
    15:21:22 Process timer started in 999000
    Hello base settings changed
     ** onHide
    15:39:29 Process timer started in 599000
    15:49:28 ProcessTimed triggered
    15:49:28 Process timer started in 599000

    15:59:27 ProcessTimed triggered
    15:59:27 Process timer started in 34000
    16:00:01 ProcessTimed triggered
    16:00:01 Process timer started in 599000
    16:00:01 Process on hour reached

  • On a real devices you can only have a timer run for the 10 seconds you are in high power mode with a watchface

    In the WF Template (or at least the old one), it has this comment for onEneterSleep()

    //! Terminate any active timers and prepare for slow updates.
    function onEnterSleep() {

  • Strange that the Simulator works so differently from a real watch.

    Yes the template has that text but does the real watch actually activate Sleep, or low power mode for sure, when the display goes off? will have to test as the Simulator doesn't.

    Is there a way to have the WF run but with the display off [in potentially low power mode], then the number of lit pixels is irrelevant?

    Update: have updated earlier post to show automated "on hour" detection working in the Simulator.

  • With the sim you have to switch between low and high power yourself, by way of the Settings>Low Power Mode switch in the sim.  There are times you want to test things for extended time in high power mode.

    There are other things, like on a real watch, a widget will timeout and close after 1-2 minutes, while it runs forever in the sim.

    As one of the Garmin folks has said, it's a simulator and not an emulator.