Merge branch 'espruino:master' into master

master
Ronin0000 2022-01-19 08:05:51 -08:00 committed by GitHub
commit 05fb11ebe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 122 additions and 15 deletions

View File

@ -1,5 +1,17 @@
---
---
{% comment %}
=================================================================
ALL THE INFORMATION INSIDE APPS.JSON HAS NOW BEEN MOVED
You'll find it inside a file called apps/yourapp/metadata.json
Otherwise nothing has changed. GitHub Pages will automatically
create apps.json as your site is hosted, or if you're hosting
yourself you can run bin/create_apps_json.sh
=================================================================
{% endcomment %}
{%- assign apps = site.static_files | where: "name", "metadata.json" -%}
[

View File

@ -0,0 +1,17 @@
{ "id": "configurable_clock",
"name": "Configurable Analog Clock",
"shortName":"Configurable Clock",
"version":"0.02",
"description": "an analog clock with several kinds of faces, hands and colors to choose from",
"icon": "app-icon.png",
"type": "clock",
"tags": "clock",
"supports" : ["BANGLEJS2"],
"allow_emulator": true,
"screenshots": [{"url":"app-screenshot.png"}],
"readme": "README.md",
"storage": [
{"name":"configurable_clock.app.js","url":"app.js"},
{"name":"configurable_clock.img","url":"app-icon.js","evaluate":true}
]
}

View File

@ -1,7 +1,7 @@
{
"id": "ffcniftya",
"name": "Nifty-A Clock",
"version": "0.01",
"version": "0.02",
"description": "A nifty clock with time and date",
"icon": "app.png",
"screenshots": [{"url":"screenshot_nifty.png"}],
@ -12,6 +12,8 @@
"allow_emulator": true,
"storage": [
{"name":"ffcniftya.app.js","url":"app.js"},
{"name":"ffcniftya.img","url":"app-icon.js","evaluate":true}
]
{"name":"ffcniftya.img","url":"app-icon.js","evaluate":true},
{"name":"ffcniftya.settings.js","url":"settings.js"}
],
"data": [{"name":"ffcniftya.json"}]
}

View File

@ -2,16 +2,15 @@
"id": "launch",
"name": "Launcher",
"shortName": "Launcher",
"version": "0.10",
"version": "0.11",
"description": "This is needed to display a menu allowing you to choose your own applications. You can replace this with a customised launcher.",
"icon": "app.png",
"type": "launch",
"tags": "tool,system,launcher",
"supports": ["BANGLEJS","BANGLEJS2"],
"storage": [
{"name":"launch.app.js","url":"app-bangle1.js","supports":["BANGLEJS"]},
{"name":"launch.app.js","url":"app-bangle2.js","supports":["BANGLEJS2"]},
{"name":"launch.settings.js","url":"settings.js","supports":["BANGLEJS2"]}
{"name":"launch.app.js","url":"app.js"},
{"name":"launch.settings.js","url":"settings.js"}
],
"data": [{"name":"launch.json"}],
"sortorder": -10

View File

@ -0,0 +1,17 @@
{
"id": "limelight",
"name": "Limelight",
"version": "0.01",
"description": "Simple analogue clock (with configurable fonts) based on the work of @Andreas_Rozek (Simple_Clock)",
"icon": "limelight.png",
"readme":"README.md",
"screenshots": [{"url":"screenshot_limelight.png"}],
"type": "clock",
"tags": "clock",
"supports": ["BANGLEJS","BANGLEJS2"],
"storage": [
{"name":"limelight.app.js","url":"limelight.app.js"},
{"name":"limelight.settings.js","url":"limelight.settings.js"},
{"name":"limelight.img","url":"limelight.icon.js","evaluate":true}
]
}

View File

@ -116,8 +116,33 @@ TODO:
if (document.getElementById("3bit").checked) {
options = {
compression:false, output:"raw",
mode:"3bit", brightness:-64,
mode:"3bit",
};
/* If in 3 bit mode, go through all the data beforehand and
turn the saturation up to maximum, so when thresholded it
works a lot better */
var imageData = ctx.getImageData(0,0,width,height);
var rgba = imageData.data;
var l = width*height*4;
for (var i=0;i<l;i+=4) {
var min = Math.min(rgba[i+0],rgba[i+1],rgba[i+2]);
var max = Math.max(rgba[i+0],rgba[i+1],rgba[i+2]);
var d = max-min;
if (max<120) { // black
rgba[i+0]=0;
rgba[i+1]=0;
rgba[i+2]=0;
} else if (min>240 || d<8) { // white or grey
rgba[i+0]=255;
rgba[i+1]=255;
rgba[i+2]=255;
} else { // another colour - use max saturation
rgba[i+0] = (rgba[i+0]-min) * 255 / d;
rgba[i+1] = (rgba[i+1]-min) * 255 / d;
rgba[i+2] = (rgba[i+2]-min) * 255 / d;
}
}
ctx.putImageData(imageData,0,0);
}
console.log("Compression options", options);
var w = Math.round(width / TILESIZE);
@ -131,7 +156,7 @@ TODO:
options.width = TILESIZE;
options.height = TILESIZE;
var imgstr = imageconverter.RGBAtoString(rgba, options);
ctx.putImageData(imageData,x*TILESIZE, y*TILESIZE);
ctx.putImageData(imageData,x*TILESIZE, y*TILESIZE); // write preview
/*var compress = 'require("heatshrink").decompress('
if (!imgstr.startsWith(compress)) throw "Data in wrong format";
imgstr = imgstr.slice(compress.length,-1);*/

View File

@ -1 +1 @@
0.1: New app
0.01: New app

View File

@ -0,0 +1,18 @@
{
"id": "timeandlife",
"name": "Time and Life",
"shortName":"Time and Lfie",
"icon": "app.png",
"version":"0.01",
"description": "A simple watchface which displays the time when the screen is tapped and decay according to the rules of Conway's game of life.",
"type": "clock",
"tags": "clock",
"supports": ["BANGLEJS2"],
"allow_emulator":true,
"readme": "README.md",
"storage": [
{"name":"timeandlife.app.js","url":"app.js"},
{"name":"timeandlife.img","url":"app-icon.js","evaluate":true}
]
}

View File

@ -1,7 +1,7 @@
{
"id": "vectorclock",
"name": "Vector Clock",
"version": "0.03",
"version": "0.04",
"description": "A digital clock that uses the built-in vector font.",
"icon": "app.png",
"type": "clock",
@ -14,6 +14,8 @@
],
"storage": [
{"name":"vectorclock.app.js","url":"app.js"},
{"name":"vectorclock.img","url":"app-icon.js","evaluate":true}
]
{"name":"vectorclock.img","url":"app-icon.js","evaluate":true},
{"name":"vectorclock.settings.js","url":"settings.js"}
],
"data": [{"name":"vectorclock.json"}]
}

14
bin/create_apps_json.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
cd `dirname $0`/..
echo "[" > apps.json
for app in apps/*/; do
echo "Processing $app...";
if [[ "$app" =~ ^apps/_example.* ]]; then
echo "Ignoring $app"
else
cat ${app}metadata.json >> apps.json
echo ",\"$app\"," >> apps.json
fi
done
echo "null]" >> apps.json

View File

@ -30,11 +30,12 @@ var apps = [];
var dirs = fs.readdirSync(APPSDIR, {withFileTypes: true});
dirs.forEach(dir => {
var appsFile;
if (dir.name.startsWith("_example"))
if (dir.name.startsWith("_example") || !dir.isDirectory())
return;
try {
appsFile = fs.readFileSync(APPSDIR+dir.name+"/metadata.json").toString();
} catch (e) {
ERROR(dir.name+"/metadata.json does not exist");
return;
}
try{

2
core

@ -1 +1 @@
Subproject commit e0b43e62d0daaa498508951f89c108b96ce1d0d1
Subproject commit 5023ee1228030130ba9f026d5dbe920f7527ee7d

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB