fix: fixed battery leak and HB AOD

This commit is contained in:
Савелий Савенок 2024-10-20 03:29:33 +03:00
parent 0c961f777a
commit 41e99e44db
3 changed files with 8 additions and 7 deletions

View File

@ -6,7 +6,7 @@
"appType": "watchface", "appType": "watchface",
"version": { "version": {
"code": 1, "code": 1,
"name": "1.0.3" "name": "1.0.4"
}, },
"icon": "icon.png", "icon": "icon.png",
"vender": "zepp", "vender": "zepp",

View File

@ -1,6 +1,6 @@
{ {
"name": "vhs-watch", "name": "vhs-watch",
"version": "1.0.3", "version": "1.0.4",
"description": "vhs watch for Zepp OS 3.0 (GTS 4)", "description": "vhs watch for Zepp OS 3.0 (GTS 4)",
"main": "app.js", "main": "app.js",
"scripts": { "scripts": {

View File

@ -6,15 +6,16 @@ import secondaryFont from '../fontData/secondaryFont';
let heartRateWg; let heartRateWg;
export default function () { export default function () {
console.log("[modules]: heartrate module init") console.log("[modules]: heartrate module init")
if (getScene() != SCENE_AOD) {
let heart = new hmSensor.HeartRate(); let heart = new hmSensor.HeartRate();
updateHeartWidget(heart.getCurrent()) updateHeartWidget(heart.getLast())
heart.onCurrentChange(() => updateHeartWidget(heart.getCurrent())) heart.onCurrentChange(() => updateHeartWidget(heart.getCurrent()))
if (!getScene() != SCENE_AOD)
hmUI.createWidget(hmUI.widget.IMG, { hmUI.createWidget(hmUI.widget.IMG, {
x: 10, x: 10,
y: 365, y: 365,
src: 'misc/hb.PNG' src: 'misc/hb.PNG'
}) })
}
} }
function updateHeartWidget(hbpm) { function updateHeartWidget(hbpm) {
@ -24,7 +25,7 @@ function updateHeartWidget(hbpm) {
if (heartRateWg) { if (heartRateWg) {
hmUI.deleteWidget(heartRateWg) hmUI.deleteWidget(heartRateWg)
} }
if (!getScene() != SCENE_AOD) { if (getScene() != SCENE_AOD) {
heartRateWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, { heartRateWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
x: 100, x: 100,
y: 365, y: 365,