zepp-health / zeppos-samples

A collection of samples about Zepp OS watchfaces and applications
Apache License 2.0
144 stars 53 forks source link

timer is null , createTimer undefined #57

Open MatthiasDM opened 3 months ago

MatthiasDM commented 3 months ago

I am trying to create a timer to update the time for a watchface for the Amazfit band 7 which uses ZeppOS v1.0 API.

function startClock() {
  const timer1 = timer.createTimer(
    500, 
    1000, 
    function () {
      drawTime(); // Call the function to update the time on the screen
    }
  );

  // Optionally, keep a reference to the timer if you need to stop it later
  this.timer = timer1;
}

function stopClock() {
  if (this.timer) {
    timer.stopTimer(this.timer);
  }
}

But the typeof timer is null and thus createTimer is undefined

According to the API docs: https://docs.zepp.com/docs/1.0/watchface/api/timer/createTimer/ there should be a timer object available. (somehow it is null, not undefined).

Any ideas?