fix: cleanup, AOD fixes
This commit is contained in:
parent
dd8aa149af
commit
0c961f777a
2
app.json
2
app.json
@ -6,7 +6,7 @@
|
|||||||
"appType": "watchface",
|
"appType": "watchface",
|
||||||
"version": {
|
"version": {
|
||||||
"code": 1,
|
"code": 1,
|
||||||
"name": "1.0.2"
|
"name": "1.0.3"
|
||||||
},
|
},
|
||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
"vender": "zepp",
|
"vender": "zepp",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vhs-watch",
|
"name": "vhs-watch",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"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": {
|
||||||
|
@ -6,10 +6,6 @@ import heartRateModule from "./modules/heartRate"
|
|||||||
|
|
||||||
WatchFace({
|
WatchFace({
|
||||||
onInit() {
|
onInit() {
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
build() {
|
|
||||||
clockModule()
|
clockModule()
|
||||||
dateModule()
|
dateModule()
|
||||||
batteryModule()
|
batteryModule()
|
||||||
@ -17,6 +13,9 @@ WatchFace({
|
|||||||
distanceModule()
|
distanceModule()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
build() {
|
||||||
|
},
|
||||||
|
|
||||||
onDestroy() {
|
onDestroy() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { getScene, SCENE_AOD } from '@zos/app'
|
||||||
import * as hmSensor from '@zos/sensor'
|
import * as hmSensor from '@zos/sensor'
|
||||||
import * as hmUI from '@zos/ui'
|
import * as hmUI from '@zos/ui'
|
||||||
import fontArray from '../fontData/secondaryFont'
|
import fontArray from '../fontData/secondaryFont'
|
||||||
@ -10,6 +11,7 @@ export default function(){
|
|||||||
let battery = new hmSensor.Battery()
|
let battery = new hmSensor.Battery()
|
||||||
updateBatteryWidget(battery.getCurrent())
|
updateBatteryWidget(battery.getCurrent())
|
||||||
battery.onChange(() => updateBatteryWidget(battery.getCurrent()))
|
battery.onChange(() => updateBatteryWidget(battery.getCurrent()))
|
||||||
|
if (getScene() != SCENE_AOD)
|
||||||
hmUI.createWidget(hmUI.widget.IMG, {
|
hmUI.createWidget(hmUI.widget.IMG, {
|
||||||
x: moduleX,
|
x: moduleX,
|
||||||
y: moduleY,
|
y: moduleY,
|
||||||
@ -17,9 +19,10 @@ export default function(){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
function updateBatteryWidget(batteryPercentage) {
|
function updateBatteryWidget(batteryPercentage) {
|
||||||
if(batteryWg){
|
if (batteryWg)
|
||||||
hmUI.deleteWidget(batteryWg)
|
hmUI.deleteWidget(batteryWg)
|
||||||
}
|
|
||||||
|
if (getScene() != SCENE_AOD) {
|
||||||
batteryWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
|
batteryWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
|
||||||
x: moduleX - 85,
|
x: moduleX - 85,
|
||||||
y: moduleY,
|
y: moduleY,
|
||||||
@ -30,3 +33,4 @@ function updateBatteryWidget(batteryPercentage){
|
|||||||
text: batteryPercentage
|
text: batteryPercentage
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
import * as hmUI from '@zos/ui'
|
import * as hmUI from '@zos/ui'
|
||||||
|
import { getScene, SCENE_AOD } from '@zos/app'
|
||||||
import timeArray from '../fontData/primaryFont'
|
import timeArray from '../fontData/primaryFont'
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
console.log("[modules]: clock module init")
|
console.log("[modules]: clock module init")
|
||||||
hmUI.createWidget(hmUI.widget.IMG_TIME, {
|
hmUI.createWidget(hmUI.widget.IMG_TIME, {
|
||||||
@ -19,6 +21,7 @@ export default function(){
|
|||||||
minute_align: hmUI.align.CENTER_H | hmUI.align.CENTER_V,
|
minute_align: hmUI.align.CENTER_H | hmUI.align.CENTER_V,
|
||||||
show_level: hmUI.show_level.ONLY_NORMAL | hmUI.show_level.ONAL_AOD
|
show_level: hmUI.show_level.ONLY_NORMAL | hmUI.show_level.ONAL_AOD
|
||||||
})
|
})
|
||||||
|
if (getScene() != SCENE_AOD) {
|
||||||
hmUI.createWidget(hmUI.widget.IMG_TIME, {
|
hmUI.createWidget(hmUI.widget.IMG_TIME, {
|
||||||
second_startX: 220,
|
second_startX: 220,
|
||||||
second_startY: 290,
|
second_startY: 290,
|
||||||
@ -27,3 +30,4 @@ export default function(){
|
|||||||
second_align: hmUI.align.CENTER_H | hmUI.align.CENTER_V
|
second_align: hmUI.align.CENTER_H | hmUI.align.CENTER_V
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
import { getScene, SCENE_AOD } from '@zos/app'
|
||||||
import * as hmSensor from '@zos/sensor'
|
import * as hmSensor from '@zos/sensor'
|
||||||
import * as hmUI from '@zos/ui';
|
import * as hmUI from '@zos/ui';
|
||||||
import secondaryFont from '../fontData/secondaryFont';
|
import secondaryFont from '../fontData/secondaryFont';
|
||||||
@ -10,20 +11,23 @@ export default function(){
|
|||||||
let distance = new hmSensor.Distance();
|
let distance = new hmSensor.Distance();
|
||||||
updateDistance(distance.getCurrent())
|
updateDistance(distance.getCurrent())
|
||||||
distance.onChange(() => updateDistance(distance.getCurrent()))
|
distance.onChange(() => updateDistance(distance.getCurrent()))
|
||||||
|
if (getScene() != SCENE_AOD) {
|
||||||
hmUI.createWidget(hmUI.widget.IMG, {
|
hmUI.createWidget(hmUI.widget.IMG, {
|
||||||
x: moduleX,
|
x: moduleX,
|
||||||
y: moduleY,
|
y: moduleY,
|
||||||
src: 'misc/dist.PNG'
|
src: 'misc/dist.PNG'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function updateDistance(dist) {
|
function updateDistance(dist) {
|
||||||
if(!dist){
|
if (!dist)
|
||||||
dist = 0
|
dist = 0
|
||||||
}
|
|
||||||
if(distWg){
|
if (distWg)
|
||||||
hmUI.deleteWidget(distWg)
|
hmUI.deleteWidget(distWg)
|
||||||
}
|
|
||||||
|
if (getScene() != SCENE_AOD) {
|
||||||
distWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
|
distWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
|
||||||
x: moduleX + 150,
|
x: moduleX + 150,
|
||||||
y: moduleY,
|
y: moduleY,
|
||||||
@ -34,3 +38,4 @@ function updateDistance(dist){
|
|||||||
text: dist
|
text: dist
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
import { getScene, SCENE_AOD } from '@zos/app'
|
||||||
import * as hmSensor from '@zos/sensor'
|
import * as hmSensor from '@zos/sensor'
|
||||||
import * as hmUI from '@zos/ui';
|
import * as hmUI from '@zos/ui';
|
||||||
import secondaryFont from '../fontData/secondaryFont';
|
import secondaryFont from '../fontData/secondaryFont';
|
||||||
@ -8,6 +9,7 @@ export default function(){
|
|||||||
let heart = new hmSensor.HeartRate();
|
let heart = new hmSensor.HeartRate();
|
||||||
updateHeartWidget(heart.getCurrent())
|
updateHeartWidget(heart.getCurrent())
|
||||||
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,
|
||||||
@ -22,6 +24,7 @@ function updateHeartWidget(hbpm){
|
|||||||
if (heartRateWg) {
|
if (heartRateWg) {
|
||||||
hmUI.deleteWidget(heartRateWg)
|
hmUI.deleteWidget(heartRateWg)
|
||||||
}
|
}
|
||||||
|
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,
|
||||||
@ -32,3 +35,4 @@ function updateHeartWidget(hbpm){
|
|||||||
text: hbpm
|
text: hbpm
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user