Merge branch 'espruino:master' into master

pull/2125/head
pebl-hank 2022-09-21 14:45:10 +02:00 committed by GitHub
commit a4d32d5e7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 225 additions and 8 deletions

View File

@ -5,3 +5,4 @@
0.05: changed text to uppercase, just looks better, removed colons on text
0.06: better contrast for light theme, use fg color instead of dithered for ring
0.07: Use default Bangle formatter for booleans
0.08: fix idle timer always getting set to true

View File

@ -83,7 +83,7 @@ function loadSettings() {
settings = require("Storage").readJSON(SETTINGS_FILE,1)||{};
settings.gy = settings.gy||'#020';
settings.fg = settings.fg||'#0f0';
settings.idle_check = settings.idle_check||true;
settings.idle_check = (settings.idle_check === undefined ? true : settings.idle_check);
assignPalettes();
}

View File

@ -1,6 +1,6 @@
{ "id": "daisy",
"name": "Daisy",
"version":"0.07",
"version":"0.08",
"dependencies": {"mylocation":"app"},
"description": "A beautiful digital clock with large ring guage, idle timer and a cyclic information line that includes, day, date, steps, battery, sunrise and sunset times",
"icon": "app.png",

Binary file not shown.

1
apps/deko/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: first release

10
apps/deko/README.md Normal file
View File

@ -0,0 +1,10 @@
# Deko Clock
A simple clock with an Art Deko font
The font was obtained from https://dafonttop.com/building.font and is free for personal use
![](screenshot.png)
Written by: [Hugh Barney](https://github.com/hughbarney) For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/)

1
apps/deko/app-icon.js Normal file
View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwIdah/wAof//4ECgYFB4AFBg4FB8AFBj/wh/4AoM/wEB/gFBvwCEBAU/AQP4gfAj8AgPwAoMPwED8AFBg/AAYIBDA4ngg4TB4EBApkPKgJSBJQIFTMgIFCJIIFDKoIFEvgFBGoMAnw7DP4IFEh+BAoItBg+DNIQwBMIaeCKoKxCPoIzCEgKVHUIqtFXIrFFaIrdFdIwAV"))

64
apps/deko/app.js Normal file

File diff suppressed because one or more lines are too long

BIN
apps/deko/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 908 B

16
apps/deko/metadata.json Normal file
View File

@ -0,0 +1,16 @@
{
"id": "deko",
"name": "Deko Clock",
"version": "0.01",
"description": "Clock with Art Deko font",
"readme": "README.md",
"icon": "app.png",
"screenshots": [{"url":"screenshot.png"}],
"type": "clock",
"tags": "clock",
"supports": ["BANGLEJS","BANGLEJS2"],
"storage": [
{"name":"deko.app.js","url":"app.js"},
{"name":"deko.img","url":"app-icon.js","evaluate":true}
]
}

BIN
apps/deko/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -18,3 +18,4 @@
added setting to enable/disable idle timer warning
0.16: make check_idle boolean setting work properly with new B2 menu
0.17: Use default Bangle formatter for booleans
0.18: fix idle option always getting defaulted to true

View File

@ -2,7 +2,7 @@
"id": "pastel",
"name": "Pastel Clock",
"shortName": "Pastel",
"version": "0.17",
"version": "0.18",
"description": "A Configurable clock with custom fonts, background and weather display. Has a cyclic information line that includes, day, date, battery, sunrise and sunset times",
"icon": "pastel.png",
"dependencies": {"mylocation":"app","weather":"app"},

View File

@ -34,7 +34,7 @@ function loadSettings() {
settings = require("Storage").readJSON(SETTINGS_FILE,1)||{};
settings.grid = settings.grid||false;
settings.font = settings.font||"Lato";
settings.idle_check = settings.idle_check||true;
settings.idle_check = (settings.idle_check === undefined ? true : settings.idle_check);
}
// requires the myLocation app

View File

@ -8,3 +8,4 @@
0.08: removed unused font, fix autocycle, imported suncalc and trimmed, removed pedometer dependency, "tap to cycle" setting
0.09: fix battery icon size
0.10: Tell clock widgets to hide.
0.11: fix issue https://github.com/espruino/BangleApps/issues/2128 (#2128) ( settings undefined )

View File

@ -2,7 +2,7 @@
"id": "rebble",
"name": "Rebble Clock",
"shortName": "Rebble",
"version": "0.10",
"version": "0.11",
"description": "A Pebble style clock, with configurable background, three sidebars including steps, day, date, sunrise, sunset, long live the rebellion",
"readme": "README.md",
"icon": "rebble.png",

View File

@ -292,6 +292,9 @@ function queueDraw() {
log_debug("starting..");
loadSettings();
loadLocation();
if(settings.autoCycle || settings.sideTap==0)
{
@ -314,8 +317,6 @@ Bangle.loadWidgets();
* area to the top bar doesn't get cleared.
*/
for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";}
loadSettings();
loadLocation();

1
apps/saclock/app-icon.js Normal file
View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwIFCn/8AgUB///wAFBh4FB8AFBj4FB/AFBv4FBDAX/4ED/wcB/0DwH/gED/EH4E/wEH+AFBj/Ah/gAoMH8EPAYIeB+EfCYPAgPwn8AAoX4nwFCgAFFvl8ApN+Aok+KoIFOjwFEj4FCOwIFD+AFEOwIFCgZwBAoR/BwAjCRYPAF4QPBAogwBnxNBSQOAAoYABvl+AohxBAAX8QYIAC/CPBDwQFETYKhBGASrBagSxBX4JCDgLUCv4bBK4LxBBAS8BboMAn7vEfYR+BOwTxBIgX/CwRqDAYIA=="))

BIN
apps/saclock/app-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

88
apps/saclock/app.js Normal file
View File

@ -0,0 +1,88 @@
Math.TAU = Math.PI*2; // the real circle constant
/**
* Rotate points around origin
*
* @param points List of coordinates: [x1,y1, x2,y2, ...]
* @param radians Angle by which to rotate
*/
function rotate(points, radians) {
for(let i = 0; i<points.length; i += 2) {
const x = points[i], y = points[i+1];
points[i] = x*Math.cos(radians)-y*Math.sin(radians);
points[i+1] = y*Math.cos(radians)+x*Math.sin(radians);
}
}
/**
* Move points
*
* @param points List of coordinates: [x1,y1, x2,y2, ...]
* @param x Horizontal offset
* @param y Vertical offset
*/
function move(points, x, y) {
for(let i = 0; i<points.length; i += 2) {
points[i] = points[i]+x;
points[i+1] = points[i+1]+y;
}
}
let clock = new (require("ClockFace"))({
settingsFile: "saclock.settings.json",
init: function() {
// create a graphics buffer, and pre-draw the outer ring
const bs = Math.min(Bangle.appRect.w, Bangle.appRect.h); // buffer size
this.r = Math.min(Bangle.appRect.w, Bangle.appRect.h)/2; // outer radius
this.buffer = Graphics.createArrayBuffer(bs, bs, 1, {msb: true});
let buf = this.buffer;
buf.fillCircle(this.r, this.r, this.r); // only fill this once: we only draw inside the inner ring
},
update: function(time) {
// clear the inner circle, and draw
const
r = this.r, // outer radius
c = r, // Center of buffer: the buffer is 2r x 2r, so the center is at (r,r)
r2 = 0.8*r, // inner radius
hw = (r-r2)/2, // *half* the hand width (we never use the full width)
hl = 0.5*r2, // hour hand length
hr = ((time.getHours()%12)+(time.getMinutes()/60))/12*Math.TAU, // hour hand rotation
ml = 0.8*r2, // minute hand length
mr = time.getMinutes()/60*Math.TAU, // minute hand rotation
x = Math.floor((Bangle.appRect.x+Bangle.appRect.x2)/2), // "real" clock center, only
y = Math.floor((Bangle.appRect.y+Bangle.appRect.y2)/2); // used for drawing buffer
let buf = this.buffer;
function drawHand(length, radians) {
let hand = [ // just a rectangle
0-hw, 0,
0-hw, 0-length,
0, 0-length, // extra point at the middle of the line: draw the tip here
hw, 0-length,
hw, 0,
];
rotate(hand, radians);
move(hand, c, c);
buf.fillPolyAA(hand);
buf.fillCircle(hand[4], hand[5], hw); // the tip
}
buf.setColor(g.theme.bg).fillCircle(c, c, r2); // clear inside
buf.setColor(g.theme.fg);
drawHand(hl, hr); // hour hand
drawHand(ml, mr); // minute hand
buf.fillCircle(c, c, Math.floor(hw)); // hands joiner
g.drawImage({
width: buf.getWidth(), height: buf.getHeight(),
buffer: buf.buffer
}, x, y, {rotate: 0}); // setting `rotate` centers the image on x,y
},
});
clock.start();
// for debugging/screenshots
clock.test = function(hours, minutes) {
this.draw({
getHours: () => hours,
getMinutes: () => minutes,
});
};

BIN
apps/saclock/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,20 @@
{ "id": "saclock",
"name": "Simple analog clock",
"shortName":"Analog clock",
"version":"0.01",
"description": "A very basic analog clock",
"screenshots": [{"url":"screenshot.png"}],
"icon": "icon.png",
"type": "clock",
"tags": "clock,analog",
"supports" : ["BANGLEJS","BANGLEJS2"],
"allow_emulator":true,
"storage": [
{"name":"saclock.app.js","url":"app.js"},
{"name":"saclock.settings.js","url":"settings.js"},
{"name":"saclock.img","url":"app-icon.js","evaluate":true}
],
"data": [
{"name": "saclock.settings.json"}
]
}

BIN
apps/saclock/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

10
apps/saclock/settings.js Normal file
View File

@ -0,0 +1,10 @@
(function(back) {
let menu = {
"": {"title": /*LANG*/"Analog Clock"},
/*LANG*/"< Back": back,
};
require("ClockFace_menu").addSettingsFile(menu, "saclock.settings.json", [
"loadWidgets"
]);
E.showMenu(menu);
});

View File

@ -2,3 +2,4 @@
0.02: Change start sequence to BTN1/3/1/3 to avoid accidental turning on (fix #342)
0.03: Add Color Changing Settings
0.04: Add Support For Bangle.js 2
0.05: Default full Brightness

View File

@ -7,6 +7,7 @@ function loadSettings() {
loadSettings();
Bangle.setLCDBrightness(1);
Bangle.setLCDPower(1);
Bangle.setLCDTimeout(0);
g.reset();

View File

@ -2,7 +2,7 @@
"id": "torch",
"name": "Torch",
"shortName": "Torch",
"version": "0.04",
"version": "0.05",
"description": "Turns screen white to help you see in the dark. Select from the launcher or press BTN1,BTN3,BTN1,BTN3 quickly to start when in any app that shows widgets on Bangle.js 1. You can also set the color through the app's setting menu.",
"icon": "app.png",
"tags": "tool,torch",