Tweaks to appease the sanity checker

pull/414/head
Gordon Williams 2020-05-12 08:08:19 +01:00
parent 30e982f06a
commit 4391b48aeb
7 changed files with 34 additions and 34 deletions

View File

@ -6,7 +6,7 @@ Bangle.js App Loader (and Apps)
* Try the **release version** at [banglejs.com/apps](https://banglejs.com/apps)
* Try the **development version** at [github.io](https://espruino.github.io/BangleApps/)
**All software (including apps) in this repository is MIT Licensed - see [LICENSE](LICENSE)** By
**All software (including apps) in this repository is MIT Licensed - see [LICENSE](LICENSE)** By
submitting code to this repository you confirm that you are happy with it being MIT licensed,
and that it is not licensed in another way that would make this impossible.
@ -203,7 +203,7 @@ and which gives information about the app for the Launcher.
// added by BangleApps loader on upload - lists all files
// that belong to the app so it can be deleted
"data":"appid.data.json,appid.data?.json;appidStorageFile,appidStorageFile*"
// added by BangleApps loader on upload - lists files that
// added by BangleApps loader on upload - lists files that
// the app might write, so they can be deleted on uninstall
// typically these files are not uploaded, but created by the app
// these can include '*' or '?' wildcards
@ -251,7 +251,7 @@ and which gives information about the app for the Launcher.
"storageFile":true // if supplied, file is treated as storageFile
},
{"wildcard":"appid.data.*" // wildcard of filenames used in storage
}, // this is mutually exclusive with using "name"
}, // this is mutually exclusive with using "name"
],
"sortorder" : 0, // optional - choose where in the list this goes.
// this should only really be used to put system
@ -341,9 +341,12 @@ See [apps/gpsrec/interface.html](the GPS Recorder) for a full example.
Apps (or widgets) can add their own settings to the "Settings" menu under "App/widget settings".
To do so, the app needs to include a `settings.js` file, containing a single function
that handles configuring the app.
When the app settings are opened, this function is called with one
When the app settings are opened, this function is called with one
argument, `back`: a callback to return to the settings menu.
Usually it will save any information in `app.json` where `app` is the name
of your app - so you should change the example accordingly.
Example `settings.js`
```js
// make sure to enclose the function in parentheses
@ -352,7 +355,7 @@ Example `settings.js`
function save(key, value) {
settings[key] = value;
require('Storage').write('app.json',settings);
}
}
const appMenu = {
'': {'title': 'App Settings'},
'< Back': back,

View File

@ -168,7 +168,7 @@
"name": "Image background clock",
"shortName":"Image Clock",
"icon": "app.png",
"version":"0.05",
"version":"0.06",
"description": "A clock with an image as a background",
"tags": "clock",
"type" : "clock",
@ -1469,7 +1469,7 @@
"name": "Round clock with seconds, minutes and date",
"shortName":"Round Clock",
"icon": "app.png",
"version":"0.02",
"version":"0.03",
"description": "Designed round clock with ticks for minutes and seconds and heart rate indication",
"tags": "clock",
"type": "clock",
@ -1572,7 +1572,7 @@
"id": "largeclock",
"name": "Large Clock",
"icon": "largeclock.png",
"version": "0.02",
"version": "0.03",
"description": "A readable and informational digital watch, with date, seconds and moon phase",
"readme": "README.md",
"tags": "clock",
@ -1591,12 +1591,10 @@
{
"name": "largeclock.settings.js",
"url": "settings.js"
},
{
"name": "largeclock.json",
"url": "largeclock.json",
"evaluate": true
}
],
"data": [
{"name":"largeclock.json"}
]
},
{ "id": "smtswch",
@ -1699,7 +1697,7 @@
"version": "0.01",
"description": "A clock for time travellers. The light pie segment shows the minutes, the black circle, the hour. The dial itself reads 'time' just in case you forget.",
"tags": "clock",
"readme": "README.md",
"readme": "README.md",
"type": "clock",
"allow_emulator":true,
"storage": [
@ -1708,7 +1706,7 @@
{ "name": "gallifr.settings.js", "url": "settings.js" }
],
"data": [
{"name":"app.json"}
{"name":"gallifr.json"}
]
}
]
]

View File

@ -10,7 +10,7 @@ const cirRad = 2*Math.PI;
const proportion = 0.3; // relative size of hour hand
const thickness = 4; // thickness of decorative lines
// retrieve settings from menu
let settings = require('Storage').readJSON('app.json',1)||{};
let settings = require('Storage').readJSON('gallifr.json',1)||{};
const decoration = !settings.decoration;
const widgets = !settings.widgets;
if (widgets) {
@ -133,21 +133,21 @@ const drawDecoration = () => {
drawSegment(params);
params = {
fromX: 0.4,
fromY: 0.2,
fromY: 0.2,
toX: 0.6,
toY: 0.1
};
drawThickLine(params);
params = {
fromX: -0.2,
fromY: -0.05,
fromY: -0.05,
toX: -0.7,
toY: -0.7
};
drawThickLine(params);
params = {
fromX: -0.3,
fromY: 0.05,
fromY: 0.05,
toX: -0.95,
toY: -0.3
};
@ -166,7 +166,7 @@ const drawMinuteHand = () => {
break;
case "blue":
g.setColor(0,0,1);
break;
break;
case "80s":
g.setColor(1,0,0);
break;
@ -203,7 +203,7 @@ const drawClockFace = () => {
break;
case "blue":
g.setColor(0,0.3,0.8);
break;
break;
case "80s":
g.setColor(1,1,1);
break;

View File

@ -1,11 +1,11 @@
// make sure to enclose the function in parentheses
(function (back) {
let settings = require('Storage').readJSON('app.json',1)||{};
let settings = require('Storage').readJSON('gallifr.json',1)||{};
let colours = ["green","red","blue","80s"];
let onoff = ["on","off"];
function save(key, value) {
settings[key] = value;
require('Storage').write('app.json',settings);
require('Storage').writeJSON('gallifr.json',settings);
}
const appMenu = {
'': {'title': 'Clock Settings'},
@ -21,13 +21,13 @@
min:0,max:1,
format: m => onoff[m],
onchange: m => {save('widgets', m)}
},
},
'Decoration': {
value: 0|settings['decoration'],
min:0,max:1,
format: m => onoff[m],
onchange: m => {save('decoration', m)}
}
}
};
E.showMenu(appMenu)
})
})

View File

@ -1,2 +1,3 @@
0.01: Init
0.02: fix 3/4 moon orientation
0.03: Change `largeclock.json` to 'data' file to allow settings to be preserved

View File

@ -9,10 +9,8 @@ const moonX = 215;
const moonY = 50;
const settings = require("Storage").readJSON("largeclock.json", 1);
const BTN1app = settings.BTN1;
const BTN3app = settings.BTN3;
console.log("BTN1app", BTN1app);
console.log("BTN3app", BTN3app);
const BTN1app = settings.BTN1 || "";
const BTN3app = settings.BTN3 || "";
function drawMoon(d) {
const BLACK = 0,
@ -174,14 +172,14 @@ Bangle.setLCDMode();
// Show launcher when middle button pressed
clearWatch();
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" });
setWatch(
if (BTN1app) setWatch(
function() {
load(BTN1app);
},
BTN1,
{ repeat: false, edge: "rising" }
);
setWatch(
if (BTN3app) setWatch(
function() {
load(BTN3app);
},

View File

@ -34,7 +34,7 @@
function onchange(v) {
settings[btn] = v;
s.write("largeclock.json", settings);
s.writeJSON("largeclock.json", settings);
}
const btnMenu = {