1
0
Fork 0

add JSON for widgets, and fix filenames for settings (only 8 chars allowed, so '@setting')

master
Gordon Williams 2019-11-07 21:49:47 +00:00
parent 85a5dba9ad
commit 7ea95ddce8
24 changed files with 47 additions and 34 deletions

View File

@ -63,6 +63,7 @@ the *default* of `To RAM`
"name": "Readable name", // readable name
"icon": "icon.png", // icon in apps/
"description": "...", // long description
"type":"...", // optional(if app) - 'app' or 'widget'
"tags": "", // comma separated tag list for searching
"custom": "custom.html", // if supplied, apps/custom.html is loaded in an

View File

@ -98,17 +98,17 @@
{"name":"*slevel","url":"spiritlevel-icon.js","evaluate":true}
]
},
{ "id": "settings",
{ "id": "setting",
"name": "Settings",
"icon": "settings.png",
"description": "Show the current angle of the watch, so you can use it to make sure something is absolutely flat",
"tags": "tool,system",
"storage": [
{"name":"+settings","url":"settings.json"},
{"name":"-settings","url":"settings.js"},
{"name":"=settings","url":"settings-init.js"},
{"name":"@settings","url":"settings-default.json","evaluate":true},
{"name":"*settings","url":"settings-icon.js","evaluate":true}
{"name":"+setting","url":"settings.json"},
{"name":"-setting","url":"settings.js"},
{"name":"=setting","url":"settings-init.js"},
{"name":"@setting","url":"settings-default.json","evaluate":true},
{"name":"*setting","url":"settings-icon.js","evaluate":true}
]
},
{ "id": "files",
@ -127,16 +127,20 @@
"icon": "widget-battery.png",
"description": "Show the current battery level and charging status in the top right of the clock",
"tags": "widget,battery",
"type":"widget",
"storage": [
{"name":"+sbat","url":"widget-battery.json"},
{"name":"=sbat","url":"widget-battery.js"}
]
},
{ "id": "sbt",
"name": "Bluetooth Widget",
"name": "c Widget",
"icon": "widget-bluetooth.png",
"description": "Show the current Bluetooth connection status in the top right of the clock",
"tags": "widget,bluetooth",
"type":"widget",
"storage": [
{"name":"+sbt","url":"widget-bluetooth.json"},
{"name":"=sbt","url":"widget-bluetooth.js"}
]
},

View File

@ -1,5 +1,5 @@
{
"name":"Animals Game",
"name":"Animals Game", "type":"app",
"icon":"*animals",
"src":"-animals"
}

View File

@ -1,5 +1,5 @@
{
"name":"Asteroids!",
"name":"Asteroids!","type":"app",
"icon":"*astroid",
"src":"-astroid"
}

View File

@ -11,7 +11,7 @@ setWatch(function() {
apps = s.list().filter(a=>a[0]=='+').map(app=>{
try { return s.readJSON(app); }
catch (e) { return {name:"DEAD: "+app.substr(1)} }
});
}).filter(app=>app.type=="app" || !app.type);
var selected = 0;
var menuScroll = 0;
var menuShowing = false;

View File

@ -1,5 +1,5 @@
{
"name":"Clock",
"name":"Clock","type":"app",
"icon":"*clock",
"src":"-clock"
}

View File

@ -1,5 +1,5 @@
{
"name":"Compass",
"name":"Compass","type":"app",
"icon":"*compass",
"src":"-compass"
}

View File

@ -1,5 +1,5 @@
{
"name":"App Manager",
"name":"App Manager","type":"app",
"icon":"*files",
"src":"-files"
}

View File

@ -1,5 +1,5 @@
{
"name":"GPS Time",
"name":"GPS Time","type":"app",
"icon":"*gpstime",
"src":"-gpstime"
}

View File

@ -1,5 +1,5 @@
{
"name":"Heart Rate",
"name":"Heart Rate","type":"app",
"icon":"*hrm",
"src":"-hrm"
}

View File

@ -1,6 +1,6 @@
var storage = require('Storage');
const settings = storage.readJSON('@settings') || { HID: false };
const settings = storage.readJSON('@setting') || { HID: false };
var sendHid, next, prev, toggle, up, down, profile;

View File

@ -1,5 +1,5 @@
{
"name": "Keyboard Control",
"name": "Keyboard Control","type":"app",
"icon": "*hidkbd",
"src": "-hidkbd"
}

View File

@ -1,6 +1,6 @@
var storage = require('Storage');
const settings = storage.readJSON('@settings') || { HID: false };
const settings = storage.readJSON('@setting') || { HID: false };
var sendHid, next, prev, toggle, up, down, profile;

View File

@ -1,5 +1,5 @@
{
"name": "Music Control",
"name": "Music Control","type":"app",
"icon": "*hidmsic",
"src": "-hidmsic"
}

View File

@ -1,4 +1,4 @@
{
"name":"Open Location",
"name":"Open Location","type":"app",
"src":"-openloc"
}

View File

@ -1,5 +1,5 @@
(function() {
var s = require('Storage').readJSON('@settings');
var s = require('Storage').readJSON('@setting');
var adv = { uart: true };
if (s.HID) {
// Report from https://notes.iopush.net/custom-usb-hid-device-descriptor-media-keyboard/

View File

@ -12,8 +12,8 @@ function debug(msg, arg) {
function updateSettings() {
debug('updating settings', settings);
storage.erase('@settings');
storage.write('@settings', settings);
storage.erase('@setting');
storage.write('@setting', settings);
}
function resetSettings() {
@ -30,7 +30,7 @@ function resetSettings() {
}
try {
settings = storage.readJSON('@settings');
settings = storage.readJSON('@setting');
} catch (e) {}
if (!settings) resetSettings();
@ -121,11 +121,11 @@ function showResetMenu() {
},
// this is include for debugging. remove for production
/*'Erase': () => {
storage.erase('=settings');
storage.erase('-settings');
storage.erase('@settings');
storage.erase('*settings');
storage.erase('+settings');
storage.erase('=setting');
storage.erase('-setting');
storage.erase('@setting');
storage.erase('*setting');
storage.erase('+setting');
E.reboot();
}*/
};

View File

@ -1,5 +1,5 @@
{
"name": "Settings",
"name": "Settings","type":"app",
"icon": "*settings",
"src": "-settings"
}

View File

@ -1,5 +1,5 @@
{
"name":"Speedo",
"name":"Speedo","type":"app",
"icon":"*speedo",
"src":"-speedo"
}

View File

@ -1,5 +1,5 @@
{
"name":"Spirit Level",
"name":"Spirit Level","type":"app",
"icon":"*slevel",
"src":"-slevel"
}

View File

@ -1,5 +1,5 @@
{
"name":"Stopwatch",
"name":"Stopwatch","type":"app",
"icon":"*swatch",
"src":"-swatch"
}

View File

@ -1,5 +1,5 @@
{
"name":"T-Rex",
"name":"T-Rex","type":"app",
"icon":"*trex",
"src":"-trex"
}

4
apps/widget-battery.json Normal file
View File

@ -0,0 +1,4 @@
{
"name":"Battery Level","type":"widget",
"src":"=sbat"
}

View File

@ -0,0 +1,4 @@
{
"name":"bluetooth","type":"widget",
"src":"=sbt"
}