mirror of https://github.com/espruino/BangleApps
Initial commit
parent
ef854552b2
commit
f4c301eda9
|
@ -0,0 +1 @@
|
||||||
|
0.01: New App!
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Charge LCD rotation
|
||||||
|
|
||||||
|
This simple app is for handling all types of charging cradles i.e.:
|
||||||
|
- [Official Bangle.js 2 dock](https://shop.espruino.com/banglejs2-dock)
|
||||||
|
- [Many more you can 3d print](https://www.thingiverse.com/search?q=banglejs+dock&page=1&type=things&sort=relevant)
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
In app settings set desired rotation.
|
||||||
|
App will swap screen rotation when charged and return to default one (you can change this in settings app) when undocked.
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
(() => {
|
||||||
|
const chargingRotation = 0 | require('Storage').readJSON("chargerot.settings.json").rotate;
|
||||||
|
const defaultRotation = 0 | require('Storage').readJSON("setting.json").rotate;
|
||||||
|
Bangle.on('charging', (charging) => {
|
||||||
|
if (charging) {
|
||||||
|
g.setRotation(chargingRotation&3,chargingRotation>>2).clear();
|
||||||
|
Bangle.showClock();
|
||||||
|
} else {
|
||||||
|
g.setRotation(defaultRotation&3,defaultRotation>>2).clear();
|
||||||
|
Bangle.showClock();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"id": "chargerot",
|
||||||
|
"name": "Charge LCD rotation",
|
||||||
|
"version": "0.01",
|
||||||
|
"description": "When charging, this app can rotate your screen and revert it when unplugged. Made for all sort of cradles.",
|
||||||
|
"icon": "icon.png",
|
||||||
|
"tags": "battery",
|
||||||
|
"readme": "README.md",
|
||||||
|
"type": "bootloader",
|
||||||
|
"supports": ["BANGLEJS2"],
|
||||||
|
"storage": [
|
||||||
|
{"name":"chargerot.boot.js","url":"boot.js"},
|
||||||
|
{"name":"chargerot.settings.js","url":"settings.js"}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
(function(back) {
|
||||||
|
var rotNames = [/*LANG*/"No",/*LANG*/"Rotate CW",/*LANG*/"Left Handed",/*LANG*/"Rotate CCW",/*LANG*/"Mirror"];
|
||||||
|
var FILE = "chargerot.settings.json";
|
||||||
|
var appSettings = Object.assign({
|
||||||
|
rotate: 0,
|
||||||
|
}, require('Storage').readJSON(FILE, true) || {});
|
||||||
|
|
||||||
|
function writeSettings() {
|
||||||
|
require('Storage').writeJSON(FILE, appSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
E.showMenu({
|
||||||
|
"" : { "title" : "Carging rotation" },
|
||||||
|
"< Back" : () => back(),
|
||||||
|
'Rotate': {
|
||||||
|
value: 0|appSettings.rotate,
|
||||||
|
min: 0,
|
||||||
|
max: rotNames.length-1,
|
||||||
|
format: v=> rotNames[v],
|
||||||
|
onchange: v => {
|
||||||
|
appSettings.rotate = 0 | v;
|
||||||
|
writeSettings();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// If(true) big();
|
||||||
|
})
|
Loading…
Reference in New Issue