Minor tweaks after reviewing lint changes

pull/3261/head
Gordon Williams 2024-03-14 11:39:04 +00:00
parent ab75c85f11
commit ff04564e2a
20 changed files with 45 additions and 82 deletions

View File

@ -223,6 +223,7 @@
}); });
// Read data from file and set variables // Read data from file and set variables
{ // new scope ensures pedomData gets freed
let pedomData = s.readJSON(PEDOMFILE,1); let pedomData = s.readJSON(PEDOMFILE,1);
if (pedomData) { if (pedomData) {
if (pedomData.lastUpdate) lastUpdate = new Date(pedomData.lastUpdate); if (pedomData.lastUpdate) lastUpdate = new Date(pedomData.lastUpdate);
@ -231,7 +232,7 @@
stepsTooLong = pedomData.stepsTooLong; stepsTooLong = pedomData.stepsTooLong;
stepsOutsideTime = pedomData.stepsOutsideTime; stepsOutsideTime = pedomData.stepsOutsideTime;
} }
pedomdata = 0; //reset pedomdata to save memory - TODO: Should `pedomdata` have been `pedomData` here? }
setStepSensitivity(setting('stepSensitivity')); //set step sensitivity (80 is standard, 400 is muss less sensitive) setStepSensitivity(setting('stepSensitivity')); //set step sensitivity (80 is standard, 400 is muss less sensitive)
/*timerStoreData =*/ setInterval(storeData, storeDataInterval); //store data regularly /*timerStoreData =*/ setInterval(storeData, storeDataInterval); //store data regularly

View File

@ -31,7 +31,7 @@ function draw() {
var dow = require("date_utils").dows(0,1)[date.getDay()]; var dow = require("date_utils").dows(0,1)[date.getDay()];
if ((date.getTime() >= lastBattCheck + 15*60000) || Bangle.isCharging()) { if ((date.getTime() >= lastBattCheck + 15*60000) || Bangle.isCharging()) {
lastBattcheck = date.getTime(); // TODO: should `lastBattcheck` have been `lastBattCheck` ? lastBattCheck = date.getTime();
width = E.getBattery(); width = E.getBattery();
width += width/2; width += width/2;
} }

View File

@ -409,7 +409,8 @@ function updateClock() {
if ( emulator ) { if ( emulator ) {
max.spd++; max.alt++; max.spd++; max.alt++;
const d=new Date(); sec=d.getSeconds(); const d=new Date();
sec=d.getSeconds();
onGPS(lf); onGPS(lf);
} }
} }

View File

@ -74,6 +74,7 @@ let digestTime = new Uint8Array([ 0, 0, 0 ]);
let numberOfDigestPages = 0; let numberOfDigestPages = 0;
let sensorData = [ 0x82, 0x08, 0x3f ]; let sensorData = [ 0x82, 0x08, 0x3f ];
let cyclicCount = 0; let cyclicCount = 0;
let encodedBattery = 0;
let lastDigestTime = Math.round(getTime()); let lastDigestTime = Math.round(getTime());
let lastResetTime = Math.round(getTime()); let lastResetTime = Math.round(getTime());
let isExciterPresent = false; let isExciterPresent = false;
@ -513,7 +514,6 @@ function encodeAcceleration() {
function updateSensorData() { function updateSensorData() {
// Update the battery measurement each time the cyclic count resets // Update the battery measurement each time the cyclic count resets
let encodedBattery;
if(cyclicCount === 0) { if(cyclicCount === 0) {
encodedBattery = encodeBatteryPercentage(); encodedBattery = encodeBatteryPercentage();
} }

View File

@ -163,12 +163,10 @@ const drawHR = function () {
} }
if (grow) { if (grow) {
const color = settings.hr.color; g.setColor(settings.hr.color);
g.setColor(color);
g.fillCircle(settings.hr.x, settings.hr.y, size); g.fillCircle(settings.hr.x, settings.hr.y, size);
} else { } else {
const color = "#000000"; g.setColor("#000000");
g.setColor(color);
g.drawCircle(settings.hr.x, settings.hr.y, size); g.drawCircle(settings.hr.x, settings.hr.y, size);
} }
}; };

View File

@ -2,4 +2,3 @@
0.02: RAM efficient version of `fourTwentyTz.js` (as suggested by @gfwilliams). 0.02: RAM efficient version of `fourTwentyTz.js` (as suggested by @gfwilliams).
0.03: `mkFourTwentyTz.js` now handles new timezonedb.com CSV format 0.03: `mkFourTwentyTz.js` now handles new timezonedb.com CSV format
0.04: Tell clock widgets to hide. 0.04: Tell clock widgets to hide.
0.05: Minor code improvements

View File

@ -1,7 +1,7 @@
{ {
"id": "ftclock", "id": "ftclock",
"name": "Four Twenty Clock", "name": "Four Twenty Clock",
"version": "0.05", "version": "0.04",
"description": "A clock that tells when and where it's going to be 4:20 next", "description": "A clock that tells when and where it's going to be 4:20 next",
"icon": "app.png", "icon": "app.png",
"screenshots": [{"url":"screenshot.png"}, {"url":"screenshot1.png"}], "screenshots": [{"url":"screenshot.png"}, {"url":"screenshot1.png"}],

View File

@ -1,3 +1,4 @@
/* This file is designed to be run on the desktop, not Bangle.js */
/* eslint-env node */ /* eslint-env node */
let fs = require('fs'); let fs = require('fs');
let csv = require('csv'); let csv = require('csv');
@ -31,7 +32,7 @@ fs.createReadStream(__dirname+'/country.csv')
} else { } else {
country = countries[r[1]]; // e.g. United States country = countries[r[1]]; // e.g. United States
} }
zone = zones[r[0]] || { "name": `${city}, ${country}` }; let zone = zones[r[0]] || { "name": `${city}, ${country}` };
let starttime = parseInt(r[3] || "0"), // Bugger. They're feeding us blanks for UTC now let starttime = parseInt(r[3] || "0"), // Bugger. They're feeding us blanks for UTC now
offs = parseInt(r[4]); offs = parseInt(r[4]);
if (offs<0) { if (offs<0) {
@ -44,15 +45,15 @@ fs.createReadStream(__dirname+'/country.csv')
zones[r[0]] = zone; zones[r[0]] = zone;
}) })
.on('end', () => { .on('end', () => {
for (z in zones) { for (let z in zones) {
zone = zones[z]; let zone = zones[z];
if (zone.offs%60) continue; // One a dem funky timezones. Ignore. if (zone.offs%60) continue; // One a dem funky timezones. Ignore.
zonelist = offsdict[zone.offs] || []; let zonelist = offsdict[zone.offs] || [];
zonelist.push(zone.name); zonelist.push(zone.name);
offsdict[zone.offs] = zonelist; offsdict[zone.offs] = zonelist;
} }
offsets = []; let offsets = [];
for (o in offsdict) { for (let o in offsdict) {
offsets.unshift(parseInt(o)); offsets.unshift(parseInt(o));
} }
fs.open("fourTwentyTz.js","w", (err, fd) => { fs.open("fourTwentyTz.js","w", (err, fd) => {
@ -68,7 +69,7 @@ fs.createReadStream(__dirname+'/country.csv')
fs.write(fd, ";\n", handleWrite); fs.write(fd, ";\n", handleWrite);
fs.write(fd, "exports.timezones = function(offs) {\n", handleWrite); fs.write(fd, "exports.timezones = function(offs) {\n", handleWrite);
fs.write(fd, " switch (offs) {\n", handleWrite); fs.write(fd, " switch (offs) {\n", handleWrite);
for (i=0; i<offsets.length; i++) { for (let i=0; i<offsets.length; i++) {
let o = offsets[i].toString(); let o = offsets[i].toString();
fs.write(fd, ` case ${o}: return ${JSON.stringify(offsdict[o])};\n`, handleWrite); fs.write(fd, ` case ${o}: return ${JSON.stringify(offsdict[o])};\n`, handleWrite);
} }

View File

@ -135,7 +135,7 @@ function checkPreciseHomework(subjectnum) { // P A I N
checkPreciseHomeworkMenu[subject] = function() {}, checkPreciseHomeworkMenu[subject] = function() {},
checkPreciseHomeworkMenu[taskmsg] = function() {}, checkPreciseHomeworkMenu[taskmsg] = function() {},
checkPreciseHomeworkMenu[statusmsg] = function() { checkPreciseHomeworkMenu[statusmsg] = function() {
status = "Status: Finished"; // TODO: Should this have been called `statusmsg`? statusmsg = "Status: Finished";
var d = new Date(); var d = new Date();
var currenttime = require("locale").time(d, 1); var currenttime = require("locale").time(d, 1);
var currentdate = require("locale").date(d); var currentdate = require("locale").date(d);
@ -160,11 +160,11 @@ function checkPreciseHomework(subjectnum) { // P A I N
} }
/*
function pushHomework(subject, status, datetimehwdone) { function pushHomework(subject, status, datetimehwdone) {
homework = require("Storage").readJSON("homework.txt", "r"); homework = require("Storage").readJSON("homework.txt", "r");
} }
*/
function addNewHomework(subject) { // Pass subject function addNewHomework(subject) { // Pass subject
console.log(subject); console.log(subject);

View File

@ -1,3 +1,3 @@
0.01: New library 0.01: New library
0.02: Minor code improvements 0.02: Minor code improvements
0.03: Minor code improvements

View File

@ -1,7 +1,7 @@
{ {
"id": "icons", "id": "icons",
"name": "Icons", "name": "Icons",
"version": "0.03", "version": "0.02",
"description": "Library containing useful icons for apps", "description": "Library containing useful icons for apps",
"icon": "app.png", "icon": "app.png",
"type": "module", "type": "module",

View File

@ -353,13 +353,6 @@ module.exports = {
"no-unused-vars" "no-unused-vars"
] ]
}, },
"homework/app.js": {
"hash": "4bc5694ed77e47f116d2b9cbdb5083c6b218e09899809f977f1a2cbcc53318cf",
"rules": [
"no-unused-vars",
"no-undef"
]
},
"hidmsicswipe/hidmsicswipe.js": { "hidmsicswipe/hidmsicswipe.js": {
"hash": "8c8c2058315c6debaec71b65b1409ebf5725233c72dbcc2ac921bec0d238fd4f", "hash": "8c8c2058315c6debaec71b65b1409ebf5725233c72dbcc2ac921bec0d238fd4f",
"rules": [ "rules": [
@ -687,12 +680,6 @@ module.exports = {
"no-undef" "no-undef"
] ]
}, },
"testuserinput/app.js": {
"hash": "83ec7fe0b9f0590715d47fc362fe48caf5b33af0f3d840acc70f16be72a0cef9",
"rules": [
"no-undef"
]
},
"terminal/app.js": { "terminal/app.js": {
"hash": "19d4913fed5a8817e3e60caf04aa6b45413ed683cf5b2c5b6859bd9080d37a34", "hash": "19d4913fed5a8817e3e60caf04aa6b45413ed683cf5b2c5b6859bd9080d37a34",
"rules": [ "rules": [
@ -915,12 +902,6 @@ module.exports = {
"no-undef" "no-undef"
] ]
}, },
"owmweather/settings.js": {
"hash": "e1df731fee42428a0a45e8bba2415d48c82b357df56806555bab70682f1e7236",
"rules": [
"no-undef"
]
},
"owmweather/boot.js": { "owmweather/boot.js": {
"hash": "10fe98e871a7df3338fc764d62ac4db65c20c44774aad112f5faf26c7497f78e", "hash": "10fe98e871a7df3338fc764d62ac4db65c20c44774aad112f5faf26c7497f78e",
"rules": [ "rules": [
@ -1221,12 +1202,6 @@ module.exports = {
"no-undef" "no-undef"
] ]
}, },
"ftclock/mkFourTwentyTz.js": {
"hash": "c1db4878121aea068481bcdb83a2725755032c6a56250c698fe2d5f96135cd7c",
"rules": [
"no-undef"
]
},
"fontclock/fontclock.js": { "fontclock/fontclock.js": {
"hash": "478c96b1319d548a79727c5af3191b77ac9753c6314789570e900e512a99a152", "hash": "478c96b1319d548a79727c5af3191b77ac9753c6314789570e900e512a99a152",
"rules": [ "rules": [
@ -1383,12 +1358,6 @@ module.exports = {
"no-undef" "no-undef"
] ]
}, },
"bigdclock/bigdclock.app.js": {
"hash": "f7bde42d4a5b95e1b11dbe79b6c7a885900678828abb893375d2492fb25efca8",
"rules": [
"no-undef"
]
},
"beebclock/beebclock.js": { "beebclock/beebclock.js": {
"hash": "f2860eb523d6394de737d249303a87a96c619ce925943026238d2aedc2441133", "hash": "f2860eb523d6394de737d249303a87a96c619ce925943026238d2aedc2441133",
"rules": [ "rules": [
@ -1473,12 +1442,6 @@ module.exports = {
"no-undef" "no-undef"
] ]
}, },
"activepedom/widget.js": {
"hash": "b60792cb3017f9b7ce43471828434501bfa255f327fde6c52ae36a7a06f84d6f",
"rules": [
"no-undef"
]
},
"accelrec/app.js": { "accelrec/app.js": {
"hash": "b5369a60afc8f360f0b33f71080eb3f5d09a1bf3703acfcf07cd80dd19f1997d", "hash": "b5369a60afc8f360f0b33f71080eb3f5d09a1bf3703acfcf07cd80dd19f1997d",
"rules": [ "rules": [

View File

@ -4,8 +4,7 @@ function draw() {
g.reset(); g.reset();
g.setFontCustom(font, 48, 8, 1801); g.setFontCustom(font, 48, 8, 1801);
g.setFontAlign(0, -1, 0); g.setFontAlign(0, -1, 0);
let line1; let line1, line2;
let line2;
if (showDate) { if (showDate) {
if (g.theme.dark) { if (g.theme.dark) {
g.setColor("#00ffff"); // cyan date numbers for dark mode g.setColor("#00ffff"); // cyan date numbers for dark mode

View File

@ -6,4 +6,3 @@
0.05: Add message icon for 'jira' 0.05: Add message icon for 'jira'
0.06: Add message icon for 'molly' and 'threema libre' 0.06: Add message icon for 'molly' and 'threema libre'
0.07: Minor code improvements 0.07: Minor code improvements
0.08: Minor code improvements

View File

@ -1,7 +1,7 @@
{ {
"id": "messageicons", "id": "messageicons",
"name": "Message Icons", "name": "Message Icons",
"version": "0.08", "version": "0.07",
"description": "Library containing a list of icons and colors for apps", "description": "Library containing a list of icons and colors for apps",
"icon": "app.png", "icon": "app.png",
"type": "module", "type": "module",

View File

@ -70,7 +70,7 @@
E.showMenu(buildMainMenu()); E.showMenu(buildMainMenu());
}); });
} else { } else {
E.showPrompt("Install a text input lib"),then(()=>{ // TODO: Should `,then` have been `.then` ? E.showAlert("Install a text input lib").then(()=>{
E.showMenu(buildMainMenu()); E.showMenu(buildMainMenu());
}); });
} }

View File

@ -313,8 +313,8 @@ Graphics.prototype.setFontKdamThmor = function(scale) {
if( Bangle.isCharging() ) if( Bangle.isCharging() )
{ {
g.setBgColor(settings.bg); g.setBgColor(settings.bg);
const image = ()=> { return require("heatshrink").decompress(atob("j8OwMB/4AD94DC44DCwP//n/gH//EOgE/+AdBh/gAYMH4EAvkDAYP/+/AFAX+FgfzGAnAA=="));} const image = require("heatshrink").decompress(atob("j8OwMB/4AD94DC44DCwP//n/gH//EOgE/+AdBh/gAYMH4EAvkDAYP/+/AFAX+FgfzGAnAA=="));
g.drawImage(image(),x+3,y+4); g.drawImage(image,x+3,y+4);
} }
} }

View File

@ -249,6 +249,7 @@ function DrawRowSelArrow(v_drawRow, v_clearRow){
//for clear previous draw arrow //for clear previous draw arrow
if (v_clearRow!== undefined) { if (v_clearRow!== undefined) {
g.setColor(colbackg); g.setColor(colbackg);
let v_y_arrow;
if (v_clearRow==1) v_y_arrow=v_y_optionrow1+14; if (v_clearRow==1) v_y_arrow=v_y_optionrow1+14;
else if (v_clearRow==2) v_y_arrow=v_y_optionrow2+14; else if (v_clearRow==2) v_y_arrow=v_y_optionrow2+14;
else if (v_clearRow==3) v_y_arrow=v_y_optionrow3+14; else if (v_clearRow==3) v_y_arrow=v_y_optionrow3+14;
@ -257,6 +258,7 @@ function DrawRowSelArrow(v_drawRow, v_clearRow){
} }
//draw an arrow to select a row //draw an arrow to select a row
if (v_drawRow!== undefined) { if (v_drawRow!== undefined) {
let v_y_arrow;
if (v_drawRow==1) v_y_arrow=v_y_optionrow1+14; if (v_drawRow==1) v_y_arrow=v_y_optionrow1+14;
else if (v_drawRow==2) v_y_arrow=v_y_optionrow2+14; else if (v_drawRow==2) v_y_arrow=v_y_optionrow2+14;
else if (v_drawRow==3) v_y_arrow=v_y_optionrow3+14; else if (v_drawRow==3) v_y_arrow=v_y_optionrow3+14;