diff --git a/app.json b/app.json index 421425e..49b6be9 100644 --- a/app.json +++ b/app.json @@ -6,7 +6,7 @@ "appType": "watchface", "version": { "code": 1, - "name": "1.0.5" + "name": "1.0.6" }, "icon": "icon.png", "vender": "zepp", diff --git a/package.json b/package.json index 74d1325..c7b9217 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vhs-watch", - "version": "1.0.5", + "version": "1.0.6", "description": "vhs watch for Zepp OS 3.0 (GTS 4)", "main": "app.js", "scripts": { diff --git a/watchface/modules/battery.js b/watchface/modules/battery.js index 352716e..cec6de7 100644 --- a/watchface/modules/battery.js +++ b/watchface/modules/battery.js @@ -1,36 +1,24 @@ import { getScene, SCENE_AOD } from '@zos/app' -import * as hmSensor from '@zos/sensor' import * as hmUI from '@zos/ui' import fontArray from '../fontData/secondaryFont' -let batteryWg; const moduleX = 310 const moduleY = 10 export default function () { - console.log("[modules]: battery module init") - let battery = new hmSensor.Battery() - updateBatteryWidget(battery.getCurrent()) - battery.onChange(() => updateBatteryWidget(battery.getCurrent())) - if (getScene() != SCENE_AOD) - hmUI.createWidget(hmUI.widget.IMG, { - x: moduleX, - y: moduleY, - src: 'date/perc.PNG' - }) -} -function updateBatteryWidget(batteryPercentage) { - if (batteryWg) - hmUI.deleteWidget(batteryWg) - - if (getScene() != SCENE_AOD) { - batteryWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, { - x: moduleX - 85, - y: moduleY, - type: hmUI.data_type.BATTERY, - font_array: fontArray, - h_space: 1, - align_h: hmUI.align.RIGHT, - text: batteryPercentage - }) - } + console.log("[modules]: battery module init") + if (getScene() != SCENE_AOD) { + hmUI.createWidget(hmUI.widget.IMG, { + x: moduleX, + y: moduleY, + src: 'date/perc.PNG' + }) + hmUI.createWidget(hmUI.widget.TEXT_IMG, { + x: moduleX - 85, + y: moduleY, + font_array: fontArray, + h_space: 1, + align_h: hmUI.align.RIGHT, + type: hmUI.data_type.BATTERY + }) + } } \ No newline at end of file diff --git a/watchface/modules/distance.js b/watchface/modules/distance.js index d58a13f..d5b1482 100644 --- a/watchface/modules/distance.js +++ b/watchface/modules/distance.js @@ -1,41 +1,24 @@ import { getScene, SCENE_AOD } from '@zos/app' -import * as hmSensor from '@zos/sensor' import * as hmUI from '@zos/ui'; import secondaryFont from '../fontData/secondaryFont'; -let distWg; const moduleX = 50 const moduleY = 405 export default function () { console.log("[modules]: distance module init") - let distance = new hmSensor.Distance(); - updateDistance(distance.getCurrent()) - distance.onChange(() => updateDistance(distance.getCurrent())) if (getScene() != SCENE_AOD) { hmUI.createWidget(hmUI.widget.IMG, { x: moduleX, y: moduleY, src: 'misc/dist.PNG' }) - } -} - -function updateDistance(dist) { - if (!dist) - dist = 0 - - if (distWg) - hmUI.deleteWidget(distWg) - - if (getScene() != SCENE_AOD) { - distWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, { + hmUI.createWidget(hmUI.widget.TEXT_IMG, { x: moduleX + 150, y: moduleY, - type: hmUI.data_type.DISTANCE, font_array: secondaryFont, h_space: 1, align_h: hmUI.align.LEFT, - text: dist + type: hmUI.data_type.DISTANCE }) } } \ No newline at end of file diff --git a/watchface/modules/heartRate.js b/watchface/modules/heartRate.js index f93fada..fcb79fd 100644 --- a/watchface/modules/heartRate.js +++ b/watchface/modules/heartRate.js @@ -1,39 +1,23 @@ import { getScene, SCENE_AOD } from '@zos/app' -import * as hmSensor from '@zos/sensor' import * as hmUI from '@zos/ui'; import secondaryFont from '../fontData/secondaryFont'; -let heartRateWg; export default function () { console.log("[modules]: heartrate module init") 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) { - if (!hbpm) { - hbpm = 0 - } - if (heartRateWg) { - hmUI.deleteWidget(heartRateWg) - } - if (getScene() != SCENE_AOD) { - heartRateWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, { + hmUI.createWidget(hmUI.widget.TEXT_IMG, { x: 100, y: 365, type: hmUI.data_type.BATTERY, font_array: secondaryFont, h_space: 1, align_h: hmUI.align.LEFT, - text: hbpm + type: hmUI.data_type.HEART }) } } \ No newline at end of file