From 41e99e44dbcec9e27ee55d998122669b201e81e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B0=D0=B2=D0=B5=D0=BB=D0=B8=D0=B9=20=D0=A1=D0=B0?= =?UTF-8?q?=D0=B2=D0=B5=D0=BD=D0=BE=D0=BA?= <56991906+Lisoveliy@users.noreply.github.com> Date: Sun, 20 Oct 2024 03:29:33 +0300 Subject: [PATCH] fix: fixed battery leak and HB AOD --- app.json | 2 +- package.json | 2 +- watchface/modules/heartRate.js | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app.json b/app.json index 9205419..9c358b2 100644 --- a/app.json +++ b/app.json @@ -6,7 +6,7 @@ "appType": "watchface", "version": { "code": 1, - "name": "1.0.3" + "name": "1.0.4" }, "icon": "icon.png", "vender": "zepp", diff --git a/package.json b/package.json index c063b55..29a2001 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vhs-watch", - "version": "1.0.3", + "version": "1.0.4", "description": "vhs watch for Zepp OS 3.0 (GTS 4)", "main": "app.js", "scripts": { diff --git a/watchface/modules/heartRate.js b/watchface/modules/heartRate.js index ec70d91..f93fada 100644 --- a/watchface/modules/heartRate.js +++ b/watchface/modules/heartRate.js @@ -6,15 +6,16 @@ import secondaryFont from '../fontData/secondaryFont'; let heartRateWg; export default function () { console.log("[modules]: heartrate module init") - let heart = new hmSensor.HeartRate(); - updateHeartWidget(heart.getCurrent()) - heart.onCurrentChange(() => updateHeartWidget(heart.getCurrent())) - if (!getScene() != SCENE_AOD) + if (getScene() != SCENE_AOD) { + let heart = new hmSensor.HeartRate(); + updateHeartWidget(heart.getLast()) + heart.onCurrentChange(() => updateHeartWidget(heart.getCurrent())) hmUI.createWidget(hmUI.widget.IMG, { x: 10, y: 365, src: 'misc/hb.PNG' }) + } } function updateHeartWidget(hbpm) { @@ -24,7 +25,7 @@ function updateHeartWidget(hbpm) { if (heartRateWg) { hmUI.deleteWidget(heartRateWg) } - if (!getScene() != SCENE_AOD) { + if (getScene() != SCENE_AOD) { heartRateWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, { x: 100, y: 365,