Skip to content

Commit c9e4a99

Browse files
committed
Merge branch 'atjn-no-undef'
2 parents 3e83eaa + ff04564 commit c9e4a99

File tree

334 files changed

+1464
-390
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

334 files changed

+1464
-390
lines changed

apps/.eslintrc.js

+39-7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module.exports = {
44
"env": {
55
// TODO: "espruino": false
66
// TODO: "banglejs": false
7+
// For a prototype of the above, see https://github.com/espruino/BangleApps/pull/3237
78
},
89
"extends": "eslint:recommended",
910
"globals": {
@@ -25,10 +26,8 @@ module.exports = {
2526
"Flash": "readonly",
2627
"Float32Array": "readonly",
2728
"Float64Array": "readonly",
28-
"fs": "readonly",
2929
"Function": "readonly",
3030
"Graphics": "readonly",
31-
"heatshrink": "readonly",
3231
"I2C": "readonly",
3332
"Int16Array": "readonly",
3433
"Int32Array": "readonly",
@@ -48,20 +47,20 @@ module.exports = {
4847
"RegExp": "readonly",
4948
"Serial": "readonly",
5049
"SPI": "readonly",
51-
"Storage": "readonly",
5250
"StorageFile": "readonly",
5351
"String": "readonly",
5452
"SyntaxError": "readonly",
55-
"tensorflow": "readonly",
5653
"TFMicroInterpreter": "readonly",
5754
"TypeError": "readonly",
5855
"Uint16Array": "readonly",
5956
"Uint24Array": "readonly",
6057
"Uint32Array": "readonly",
6158
"Uint8Array": "readonly",
6259
"Uint8ClampedArray": "readonly",
60+
"Unistroke": "readonly",
6361
"Waveform": "readonly",
6462
// Methods and Fields at https://banglejs.com/reference
63+
"__FILE__": "readonly",
6564
"analogRead": "readonly",
6665
"analogWrite": "readonly",
6766
"arguments": "readonly",
@@ -131,7 +130,41 @@ module.exports = {
131130
"VIBRATE": "readonly",
132131
// Aliases and not defined at https://banglejs.com/reference
133132
"g": "readonly",
134-
"WIDGETS": "readonly"
133+
"WIDGETS": "readonly",
134+
"module": "readonly",
135+
"exports": "writable",
136+
"D0": "readonly",
137+
"D1": "readonly",
138+
"D2": "readonly",
139+
"D3": "readonly",
140+
"D4": "readonly",
141+
"D5": "readonly",
142+
"D6": "readonly",
143+
"D7": "readonly",
144+
"D8": "readonly",
145+
"D9": "readonly",
146+
"D10": "readonly",
147+
"D11": "readonly",
148+
"D12": "readonly",
149+
"D13": "readonly",
150+
"D14": "readonly",
151+
"D15": "readonly",
152+
"D16": "readonly",
153+
"D17": "readonly",
154+
"D18": "readonly",
155+
"D19": "readonly",
156+
"D20": "readonly",
157+
"D21": "readonly",
158+
"D22": "readonly",
159+
"D23": "readonly",
160+
"D24": "readonly",
161+
"D25": "readonly",
162+
"D26": "readonly",
163+
"D27": "readonly",
164+
"D28": "readonly",
165+
"D29": "readonly",
166+
"D30": "readonly",
167+
"D31": "readonly"
135168
},
136169
"parserOptions": {
137170
"ecmaVersion": 11
@@ -154,8 +187,7 @@ module.exports = {
154187
"no-unreachable": "warn",
155188
"no-cond-assign": "warn",
156189
"no-useless-catch": "warn",
157-
// TODO: "no-undef": "warn",
158-
"no-undef": "off",
190+
"no-undef": "warn",
159191
"no-unused-vars": ["warn", { "args": "none" } ],
160192
"no-useless-escape": "off",
161193
"no-control-regex" : "off"

apps/1button/ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
0.01: New Widget!
2+
0.02: Minor code improvements

apps/1button/metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "1button",
33
"name": "One-Button-Tracker",
4-
"version": "0.01",
4+
"version": "0.02",
55
"description": "A widget that turns BTN1 into a tracker, records time of button press/release.",
66
"icon": "widget.png",
77
"type": "widget",

apps/1button/widget.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
console.log("Button let go");
2323
digitalWrite(LED2,0);
2424
var unpress_time = new Date();
25-
recFile = require("Storage").open("one_button_presses.csv","a");
25+
const recFile = require("Storage").open("one_button_presses.csv","a");
2626
recFile.write([press_time.getTime(),unpress_time.getTime()].join(",")+"\n");
2727
}, BTN1, { repeat: true, edge: 'falling', debounce: 50 });
2828

apps/acmaze/ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
0.02: Faster maze generation
33
0.03: Avoid clearing bottom widgets
44
0.04: Minor code improvements
5+
0.05: Minor code improvements

apps/acmaze/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ function Maze(n) {
206206
return false;
207207
};
208208
this.tick = function() {
209-
accel = Bangle.getAccel();
209+
let accel = Bangle.getAccel();
210210
if (this.ball_x%this.wall_length) {
211211
this.try_move_horizontally(accel.x);
212212
} else if (this.ball_y%this.wall_length) {

apps/acmaze/metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ "id": "acmaze",
22
"name": "AccelaMaze",
33
"shortName":"AccelaMaze",
4-
"version": "0.04",
4+
"version": "0.05",
55
"description": "Tilt the watch to roll a ball through a maze.",
66
"icon": "app.png",
77
"tags": "game",

apps/activepedom/ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
0.08: Fixed zero steps issue caused by 0.07
99
0.09: Prettied up user interface, decluttered graphs
1010
0.10: Minor code improvements
11+
0.11: Minor code improvements

apps/activepedom/metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "activepedom",
33
"name": "Active Pedometer",
44
"shortName": "Active Pedometer",
5-
"version": "0.10",
5+
"version": "0.11",
66
"description": "(NOT RECOMMENDED) Pedometer that filters out arm movement and displays a step goal progress. Steps are saved to a daily file and can be viewed as graph. The `Health` app now provides step logging and graphs.",
77
"icon": "app.png",
88
"tags": "outdoors,widget",

apps/activepedom/widget.js

+13-12
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
}
3333

3434
function storeData() {
35-
now = new Date();
36-
month = now.getMonth() + 1; //month is 0-based
35+
let now = new Date();
36+
let month = now.getMonth() + 1; //month is 0-based
3737
if (month < 10) month = "0" + month; //leading 0
38-
filename = filename = "activepedom" + now.getFullYear() + month + now.getDate() + ".data"; //new file for each day
38+
let filename = "activepedom" + now.getFullYear() + month + now.getDate() + ".data"; //new file for each day
3939
dataFile = s.open(filename,"a");
4040
if (dataFile) { //check if filen already exists
4141
if (dataFile.getLength() == 0) {
@@ -222,16 +222,17 @@
222222
if (on) WIDGETS["activepedom"].draw();
223223
});
224224

225-
//Read data from file and set variables
226-
let pedomData = s.readJSON(PEDOMFILE,1);
227-
if (pedomData) {
228-
if (pedomData.lastUpdate) lastUpdate = new Date(pedomData.lastUpdate);
229-
stepsCounted = pedomData.stepsToday|0;
230-
stepsTooShort = pedomData.stepsTooShort;
231-
stepsTooLong = pedomData.stepsTooLong;
232-
stepsOutsideTime = pedomData.stepsOutsideTime;
225+
// Read data from file and set variables
226+
{ // new scope ensures pedomData gets freed
227+
let pedomData = s.readJSON(PEDOMFILE,1);
228+
if (pedomData) {
229+
if (pedomData.lastUpdate) lastUpdate = new Date(pedomData.lastUpdate);
230+
stepsCounted = pedomData.stepsToday|0;
231+
stepsTooShort = pedomData.stepsTooShort;
232+
stepsTooLong = pedomData.stepsTooLong;
233+
stepsOutsideTime = pedomData.stepsOutsideTime;
234+
}
233235
}
234-
pedomdata = 0; //reset pedomdata to save memory
235236

236237
setStepSensitivity(setting('stepSensitivity')); //set step sensitivity (80 is standard, 400 is muss less sensitive)
237238
/*timerStoreData =*/ setInterval(storeData, storeDataInterval); //store data regularly

apps/antonclkplus/ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
0.09: Use default Bangle formatter for booleans
1414
0.10: Use Bangle.setUI({remove:...}) to allow loading the launcher without a full reset on 2v16
1515
Modified to avoid leaving functions defined when using setUI({remove:...})
16+
0.11: Minor code improvements

apps/antonclkplus/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ let isoStr = function(date) {
107107

108108
let calWeekBuffer = [false,false,false]; //buffer tz, date, week no (once calculated until other tz or date is requested)
109109
let ISO8601calWeek = function(date) { //copied from: https://gist.github.com/IamSilviu/5899269#gistcomment-3035480
110-
dateNoTime = date; dateNoTime.setHours(0,0,0,0);
110+
const dateNoTime = date; dateNoTime.setHours(0,0,0,0);
111111
if (calWeekBuffer[0] === date.getTimezoneOffset() && calWeekBuffer[1] === dateNoTime) return calWeekBuffer[2];
112112
calWeekBuffer[0] = date.getTimezoneOffset();
113113
calWeekBuffer[1] = dateNoTime;

apps/antonclkplus/metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "antonclkplus",
33
"name": "Anton Clock Plus",
44
"shortName": "Anton Clock+",
5-
"version": "0.10",
5+
"version": "0.11",
66
"description": "A clock using the bold Anton font, optionally showing seconds and date in ISO-8601 format.",
77
"readme":"README.md",
88
"icon": "app.png",

apps/aptsciclk/ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
0.07: Added potato GLaDOS and quote functionality when you tap her
88
0.08: Fixed drawing issues with the quotes and added more
99
0.09: Minor code improvements
10+
0.10: Minor code improvements

apps/aptsciclk/app.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ else if (img == "apetureLaboratoriesLight"){
136136
function drawStart(){
137137
g.clear();
138138
g.reset();
139+
let apSciLab;
139140
if (g.theme.dark){apSciLab = getImg("apetureLaboratories");}
140141
else {apSciLab = getImg("apetureLaboratoriesLight");}
141142
g.drawImage(apSciLab, xyCenter-apSciLab.width/2, xyCenter-apSciLab.height/2);
@@ -241,7 +242,7 @@ function buttonPressed(){
241242
if (curWarning < maxWarning) curWarning += 1;
242243
else curWarning = 0;
243244
g.reset();
244-
buttonImg = getImg("butPress");
245+
const buttonImg = getImg("butPress");
245246
g.drawImage(buttonImg, 0, 0);
246247

247248
warningImg = getImg("w"+String(curWarning));
@@ -251,7 +252,7 @@ function buttonPressed(){
251252
}
252253
function buttonUnpressed(){
253254
if (!pause){
254-
buttonImg = getImg("butUnpress");
255+
const buttonImg = getImg("butUnpress");
255256
g.drawImage(buttonImg, 0, 0);
256257
}
257258
else{
@@ -277,11 +278,12 @@ function draw() {
277278

278279
g.reset(); // default draw styles
279280
//draw watchface
281+
let apSciWatch;
280282
if (g.theme.dark){apSciWatch = getImg("apetureWatch");}
281283
else {apSciWatch = getImg("apetureWatchLight");}
282284
g.drawImage(apSciWatch, xyCenter-apSciWatch.width/2, xyCenter-apSciWatch.height/2);
283285

284-
potato = getImg("potato");
286+
const potato = getImg("potato");
285287
g.drawImage(potato, 118, 118);
286288

287289
g.drawImage(warningImg, 1, g.getWidth()-61);//update warning

apps/aptsciclk/metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "aptsciclk",
33
"name": "Apeture Science Clock",
44
"shortName":"AptSci Clock",
5-
"version": "0.09",
5+
"version": "0.10",
66
"description": "A clock based on the portal series",
77
"icon": "app.png",
88
"screenshots": [{"url":"screenshot.png"}],

apps/astrocalc/ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
0.05: Enable widgets
66
0.06: Fix azimuth (bug #2651), only show degrees
77
0.07: Minor code improvements
8+
0.08: Minor code improvements

apps/astrocalc/astrocalc-app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function drawMoon(phase, x, y) {
2323
"waning-crescent",
2424
];
2525

26-
img = require("Storage").read(`${moonImgFiles[phase]}.img`);
26+
const img = require("Storage").read(`${moonImgFiles[phase]}.img`);
2727
// image width & height = 92px
2828
g.drawImage(img, x - parseInt(92 / 2), y);
2929
}

apps/astrocalc/metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "astrocalc",
33
"name": "Astrocalc",
4-
"version": "0.07",
4+
"version": "0.08",
55
"description": "Calculates interesting information on the sun like sunset and sunrise and moon cycles for the current day based on your location from MyLocation app",
66
"icon": "astrocalc.png",
77
"tags": "app,sun,moon,cycles,tool,outdoors",

apps/awairmonitor/ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
0.01: Beta version for Bangle 2 paired with Chrome (2021/12/11)
22
0.02: The app is now a clock, the data is greyed after the connection is lost (2021/12/22)
33
0.03: Set the Awair's IP directly on the webpage (2021/12/27)
4+
0.04: Minor code improvements

apps/awairmonitor/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function draw() {
8080
g.drawString(""+bt_current_humi, 123, 110);
8181
g.drawString(""+bt_current_temp, 158, 110);
8282

83-
for (i = 0; i < 10; i++) {
83+
for (let i = 0; i < 10; i++) {
8484
if (display_frozen) { g.setColor("#888"); }
8585

8686
// max height = 32

apps/awairmonitor/metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"icon": "app.png",
55
"screenshots": [{"url":"screenshot.png"}],
66
"allow_emulator": true,
7-
"version":"0.03",
7+
"version": "0.04",
88
"description": "Displays the level of CO2, VOC, PM 2.5, Humidity and Temperature, from your Awair device.",
99
"type": "clock",
1010
"tags": "clock,tool,health",

apps/balltastic/ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
0.01: Initial version of Balltastic released! Happy!
22
0.02: Set LCD timeout for Espruino 2v10 compatibility
33
0.03: Now also works on Bangle.js 2
4+
0.04: Minor code improvements

apps/balltastic/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
BANGLEJS2 = process.env.HWVERSION==2;
1+
const BANGLEJS2 = process.env.HWVERSION==2;
22
Bangle.setLCDBrightness(1);
33
if (!BANGLEJS2) Bangle.setLCDMode("doublebuffered");
44
Bangle.setLCDTimeout(0);

apps/balltastic/metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "balltastic",
33
"name": "Balltastic",
4-
"version": "0.03",
4+
"version": "0.04",
55
"description": "Simple but fun ball eats dots game.",
66
"icon": "app.png",
77
"screenshots": [{"url":"bangle2-balltastic-screenshot.png"}],

apps/banglexercise/ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
Clean up code
55
0.03: Add software back button on main menu
66
0.04: Minor code improvements
7+
0.05: Minor code improvements

apps/banglexercise/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ function accelHandler(accel) {
148148

149149
// slope for Z
150150
if (exerciseType.useZaxis) {
151-
l = historyAvgZ.length;
151+
let l = historyAvgZ.length;
152152
if (l > 1) {
153153
const p1 = historyAvgZ[l - 2];
154154
const p2 = historyAvgZ[l - 1];

apps/banglexercise/metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ "id": "banglexercise",
22
"name": "BanglExercise",
33
"shortName":"BanglExercise",
4-
"version": "0.04",
4+
"version": "0.05",
55
"description": "Can automatically track exercises while wearing the Bangle.js watch.",
66
"icon": "app.png",
77
"screenshots": [{"url":"screenshot.png"}],

apps/batchart/ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111
0.11: Initial port to the BangleJS2
1212
0.12: Remove debug log
1313
0.13: Minor code improvements
14+
0.14: Minor code improvements

apps/batchart/app.js

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ function loadLinesFromFile(requestedLineCount, fileName) {
101101

102102
var readFile = Storage.open(fileName, "r");
103103

104+
let nextLine;
104105
while ((nextLine = readFile.readLine())) {
105106
if(nextLine) {
106107
allLines.push(nextLine);

apps/batchart/metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "batchart",
33
"name": "Battery Chart",
44
"shortName": "Battery Chart",
5-
"version": "0.13",
5+
"version": "0.14",
66
"description": "A widget and an app for recording and visualizing battery percentage over time.",
77
"icon": "app.png",
88
"tags": "app,widget,battery,time,record,chart,tool",

apps/bigdclock/ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
0.05: proper fix for the race condition in queueDraw()
66
0.06: Tell clock widgets to hide.
77
0.07: Better battery graphic - now has green, yellow and red sections; battery status reflected in the bar across the middle of the screen; current battery state checked only once every 15 minutes, leading to longer-lasting battery charge
8+
0.08: Minor code improvements

apps/bigdclock/bigdclock.app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function draw() {
3131
var dow = require("date_utils").dows(0,1)[date.getDay()];
3232

3333
if ((date.getTime() >= lastBattCheck + 15*60000) || Bangle.isCharging()) {
34-
lastBattcheck = date.getTime();
34+
lastBattCheck = date.getTime();
3535
width = E.getBattery();
3636
width += width/2;
3737
}

0 commit comments

Comments
 (0)