Skip to content

Commit b71480e

Browse files
committed
more cleanup after some lint checking
1 parent ae23db5 commit b71480e

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

apps/dsky_clock/app.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function getdatetime(){
7474
datetime.month = d.getMonth()+1;
7575
datetime.day = d.getDate();
7676
datetime.localtime=String(d.getHours()).padStart(2,'0')+String(d.getMinutes()).padStart(2,'0');
77-
utchour=((d.getHours()+(Math.round(d.getTimezoneOffset()/60))) % 24);
77+
let utchour=((d.getHours()+(Math.round(d.getTimezoneOffset()/60))) % 24);
7878
datetime.utctime=String(utchour).padStart(2,'0')+String(d.getMinutes()).padStart(2,'0');
7979
return datetime;
8080
}
@@ -158,13 +158,12 @@ function setLight(id,label,check,onColour,offColour){
158158
function setDATA(id,label) {
159159
layout.clear(layout[id]);
160160
let data='-----';
161+
let sign='';
161162
try {
162163
if (!isNaN(label)) {
163164
if (label < 0) {
164165
label=Math.abs(label);
165166
sign='-';
166-
} else {
167-
sign='';
168167
}
169168
data=String(String(label).toString(16)).toUpperCase().padStart(5,'0').substring(0,5);
170169
data=sign+data;
@@ -179,13 +178,12 @@ function setDATA(id,label) {
179178
function setWORD(id,label){
180179
layout.clear(layout[id]);
181180
try {
182-
if (isNaN(label)) {
183-
data='--';
184-
} else {
181+
let data='--';
182+
if (!isNaN(label)) {
185183
data=String(String(label).toString(16)).toUpperCase().padStart(2,'0').substring(0,2);
186184
}
187185
} catch(e) {
188-
data='--';
186+
let data='--';
189187
}
190188
// print(id, data); //debug
191189
layout[id].label=data;
@@ -274,7 +272,7 @@ function mode_HRM() {
274272
setLight('COMPACTY','',true,Light_COMPACTY);
275273
AltDrawTimer = setTimeout( function() {
276274
Bangle.setHRMPower(true, 'dsky_clock');
277-
hrm=getHRM();
275+
let hrm=getHRM();
278276
setDATA('R1',hrm.bpm);
279277
setDATA('R2',hrm.bpmConfidence);
280278
setDATA('R3',getSteps());
@@ -297,7 +295,7 @@ function mode_compass() {
297295
AltDrawTimer = setTimeout ( function() {
298296
setLight('COMPACTY','',true,Light_COMPACTY); //isCompassOn seems to be incorrect?
299297
Bangle.setCompassPower(1);
300-
compass=Bangle.getCompass();
298+
let compass=Bangle.getCompass();
301299
setDATA('R1',compass.heading);
302300
setDATA('R2');
303301
setDATA('R3');
@@ -310,7 +308,7 @@ function mode_GPS() {
310308
setLight('COMPACTY','',true,Light_COMPACTY);
311309
AltDrawTimer = setTimeout( function() {
312310
Bangle.setGPSPower(1,'dsky_clock');
313-
gps=Bangle.getGPSFix();
311+
let gps=Bangle.getGPSFix();
314312
setWORD('NOUN',gps.fix);
315313
setWORD('VERB',gps.satellites);
316314
setDATA('R1',gps.lat);
@@ -324,7 +322,7 @@ function mode_GPS() {
324322
function mode_accel() {
325323
AltDrawTimer = setTimeout( function() {
326324
setLight('COMPACTY','',isActive(),Light_COMPACTY);
327-
accel=Bangle.getAccel();
325+
let accel=Bangle.getAccel();
328326
setDATA('R1',accel.x);
329327
setDATA('R2',accel.y);
330328
setDATA('R3',accel.z);

0 commit comments

Comments
 (0)