Merge branch 'espruino:master' into master
commit
eebec3b832
|
|
@ -0,0 +1,2 @@
|
|||
0.01: initial release
|
||||
1.00: first official release (also fixes bug in Customizer)
|
||||
|
|
@ -321,7 +321,7 @@
|
|||
|
||||
function chosenClockHands () {
|
||||
switch (ClockHands) {
|
||||
case 'simple': return "require('https://raw.githubusercontent.com/rozek/banglejs-2-simpled-clock-hands/main/ClockHands.js')"
|
||||
case 'simple': return "require('https://raw.githubusercontent.com/rozek/banglejs-2-simple-clock-hands/main/ClockHands.js')"
|
||||
case 'rounded': return "require('https://raw.githubusercontent.com/rozek/banglejs-2-rounded-clock-hands/main/ClockHands.js')"
|
||||
case 'hollow': return "require('https://raw.githubusercontent.com/rozek/banglejs-2-hollow-clock-hands/main/ClockHands.js')"
|
||||
case 'custom': return "require('" + ClockHandsURL + "')"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{ "id": "ac_ac",
|
||||
"name": "A Configurable Analog Clock",
|
||||
"shortName":"Configurable Clock",
|
||||
"version":"0.03",
|
||||
"version":"1.00",
|
||||
"description": "AC-AC, a highly customizable analog clock with several clock faces, hands and complications to choose from",
|
||||
"icon": "app-icon.png",
|
||||
"type": "clock",
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@
|
|||
<select id="languages" class="form-select">
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input id="translations" type="checkbox" /> <label for="translations">Add common language translations like "Yes", "No", "On", "Off"<br/><i>(Not recommended. For translations use the option under <code>More...</code> in the app loader.</i></label>
|
||||
</div>
|
||||
<p>Then click <button id="upload" class="btn btn-primary">Upload</button></p>
|
||||
|
||||
<script src="../../core/lib/customize.js"></script>
|
||||
|
|
@ -106,12 +109,18 @@ exports = { name : "en_GB", currencySym:"£",
|
|||
const lang = languageSelector.options[languageSelector.selectedIndex].value;
|
||||
console.log(`Language ${lang}`);
|
||||
|
||||
const translations = document.getElementById('translations').checked;
|
||||
console.log(`Translations: ${translations}`);
|
||||
|
||||
const locale = locales[lang];
|
||||
if (!locale) {
|
||||
alert(`Language ${lang} not found!`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!translations)
|
||||
locale.trans = null;
|
||||
|
||||
const codePageName = "ISO8859-1";
|
||||
if (locale.codePage)
|
||||
codePageName = locale.codePage;
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
0.01: New App!
|
||||
0.02: Change color from red->yellow to ease readability (fix #710)
|
||||
0.03: Color/positioning change to allow it to work with Bangle.js 1 (although not pretty)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<li>Go to <a href="https://umap.openstreetmap.fr/en/">https://umap.openstreetmap.fr/en/</a></li>
|
||||
<li>Create a map</li>
|
||||
<li>Draw a polyline (right hand side)</li>
|
||||
<li>Embed and share (leb>ft hand side)</li>
|
||||
<li>Embed and share (left hand side)</li>
|
||||
<li>Download data as KML</li>
|
||||
</ul>
|
||||
|
||||
|
|
@ -104,21 +104,23 @@ document.getElementById('fileLoader').addEventListener('change', handleFileSelec
|
|||
|
||||
document.getElementById("upload").addEventListener("click", function() {
|
||||
var app = `${js}
|
||||
var gcoords = new Uint8Array(coords.length);
|
||||
var coordDistance = new Uint16Array(coords.length/2);
|
||||
var gcoords = new Uint8Array(coords.length);
|
||||
var coordDistance = new Uint16Array(coords.length/2);
|
||||
var colHL = g.theme.dark ? "#FF0" : "#00F";
|
||||
var W = g.getWidth(), H = g.getHeight();
|
||||
|
||||
var PT_DISTANCE = 30; // distance to a point before we consider it complete
|
||||
var PT_DISTANCE = 30; // distance to a point before we consider it complete
|
||||
|
||||
function toScr(p) {
|
||||
function toScr(p) {
|
||||
return {
|
||||
x : 10 + (p.x-min.x)*100/(max.x-min.x),
|
||||
y : 230 - (p.y-min.y)*100/(max.y-min.y)
|
||||
y : H - 10 - (p.y-min.y)*100/(max.y-min.y)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var last;
|
||||
var totalDistance = 0;
|
||||
for (var i=0;i<coords.length;i+=2) {
|
||||
var last;
|
||||
var totalDistance = 0;
|
||||
for (var i=0;i<coords.length;i+=2) {
|
||||
var c = {x:coords[i],y:coords[i+1]};
|
||||
var s = toScr(c);
|
||||
gcoords[i ] = s.x;
|
||||
|
|
@ -130,61 +132,64 @@ for (var i=0;i<coords.length;i+=2) {
|
|||
coordDistance[i/2] = totalDistance;
|
||||
}
|
||||
last = c;
|
||||
}
|
||||
var fix, lastFix;
|
||||
var nextPtIdx = 0; // 2x the number of points
|
||||
var nextPt = {x:coords[nextPtIdx], y:coords[nextPtIdx+1]};
|
||||
var nextAngle = 0;
|
||||
var nextDist = 0;
|
||||
var currentDist = 0;
|
||||
}
|
||||
var fix, lastFix;
|
||||
var nextPtIdx = 0; // 2x the number of points
|
||||
var nextPt = {x:coords[nextPtIdx], y:coords[nextPtIdx+1]};
|
||||
var nextAngle = 0;
|
||||
var nextDist = 0;
|
||||
var currentDist = 0;
|
||||
|
||||
|
||||
|
||||
function drawMap() {
|
||||
g.clearRect(0,0,239,120);
|
||||
function drawMap() {
|
||||
var R = W*180/240;
|
||||
var L = W*50/240;
|
||||
|
||||
g.clearRect(0,0,W,H/2);
|
||||
g.setFontAlign(0,0);
|
||||
g.setColor(1,1,0);
|
||||
g.setColor(colHL);
|
||||
g.setFontVector(40);
|
||||
g.drawString((currentDist===undefined)?"?":(Math.round(currentDist)+"m"), 160, 30);
|
||||
g.setColor(1,1,1);
|
||||
g.drawString((currentDist===undefined)?"?":(Math.round(currentDist)+"m"), R, 30);
|
||||
g.setColor(g.theme.fg);
|
||||
g.setFont("6x8",2);
|
||||
g.drawString(Math.round(totalDistance)+"m", 160, 70);
|
||||
g.drawString((nextPtIdx/2)+"/"+coordDistance.length, 50, 20);
|
||||
g.drawString(Math.round(totalDistance)+"m", R, 70);
|
||||
g.drawString((nextPtIdx/2)+"/"+coordDistance.length, L, 20);
|
||||
if (!fix.fix) {
|
||||
g.setColor(1,1,0);
|
||||
g.drawString("No GPS", 50, 50);
|
||||
g.setColor(colHL);
|
||||
g.drawString("No GPS", L, 50);
|
||||
g.setFont("6x8",1);
|
||||
g.drawString(fix.satellites+" Sats", 50, 70);
|
||||
g.drawString(fix.satellites+" Sats", L, 70);
|
||||
}
|
||||
|
||||
if (lastFix && lastFix.fix) {
|
||||
g.setColor(0,0,0);
|
||||
g.setColor(g.theme.bg);
|
||||
g.drawCircle(lastFix.s.x,lastFix.s.y,10);
|
||||
}
|
||||
var c1 = g.toColor(1,1,0);
|
||||
var c2 = g.toColor(0.7,0.7,0.7);
|
||||
var c1 = g.toColor(colHL);
|
||||
var c2 = g.toColor("#888");
|
||||
for (var i=0;i<gcoords.length;i+=2)
|
||||
g.setColor((i<=nextPtIdx) ? c1 : c2).fillRect(gcoords[i]-2,gcoords[i+1]-2,gcoords[i]+2,gcoords[i+1]+2);
|
||||
g.setColor(1,1,0); // first part of path
|
||||
g.setColor(colHL); // first part of path
|
||||
g.drawPoly(new Uint8Array(gcoords.buffer, 0, nextPtIdx+2));
|
||||
g.setColor(1,1,1); // remaining part of path
|
||||
g.setColor(g.theme.fg); // remaining part of path
|
||||
g.drawPoly(new Uint8Array(gcoords.buffer, nextPtIdx));
|
||||
|
||||
if (fix && fix.fix) {
|
||||
g.setColor(1,1,0);
|
||||
g.setColor(colHL);
|
||||
g.drawCircle(fix.s.x,fix.s.y,10);
|
||||
}
|
||||
lastFix = fix;
|
||||
}
|
||||
}
|
||||
|
||||
function getNextPtInfo() {
|
||||
function getNextPtInfo() {
|
||||
var dx = nextPt.x - fix.p.x;
|
||||
var dy = nextPt.y - fix.p.y;
|
||||
nextAngle = Math.atan2(dx,dy)*180/Math.PI;
|
||||
nextDist = Math.sqrt(dx*dx+dy*dy)*coordScale;
|
||||
}
|
||||
}
|
||||
|
||||
function onGPS(f) {
|
||||
function onGPS(f) {
|
||||
fix = f;
|
||||
fix.p = Bangle.project(fix);
|
||||
fix.s = toScr(fix.p);
|
||||
|
|
@ -208,9 +213,9 @@ function onGPS(f) {
|
|||
|
||||
if (!Bangle.isLCDOn()) return;
|
||||
drawMap();
|
||||
}
|
||||
}
|
||||
|
||||
function arrow(r,c) {
|
||||
function arrow(r,c) {
|
||||
r=r*Math.PI/180;
|
||||
var p = Math.PI*3/4;
|
||||
g.setColor(c);
|
||||
|
|
@ -220,25 +225,25 @@ function arrow(r,c) {
|
|||
180-10*Math.sin(r), 180+10*Math.cos(r),
|
||||
180+20*Math.sin(r+-p), 180-20*Math.cos(r-p),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
function onCompass(m) {
|
||||
function onCompass(m) {
|
||||
if (!Bangle.isLCDOn()) return;
|
||||
|
||||
arrow(oldHeading,0);
|
||||
arrow(oldHeading,g.theme.bg);
|
||||
var heading = m.heading + nextAngle;
|
||||
arrow(heading,0xF800);
|
||||
arrow(heading,"#f00");
|
||||
oldHeading = heading;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// draw the heading
|
||||
var oldHeading = 0;
|
||||
Bangle.on('GPS', onGPS);
|
||||
Bangle.on('mag', onCompass);
|
||||
Bangle.setGPSPower(1);
|
||||
Bangle.setCompassPower(1);
|
||||
g.clear();
|
||||
// draw the heading
|
||||
var oldHeading = 0;
|
||||
Bangle.on('GPS', onGPS);
|
||||
Bangle.on('mag', onCompass);
|
||||
Bangle.setGPSPower(1);
|
||||
Bangle.setCompassPower(1);
|
||||
g.clear();
|
||||
`;
|
||||
|
||||
sendCustomizedApp({
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"id": "route",
|
||||
"name": "Route Viewer",
|
||||
"version": "0.02",
|
||||
"version": "0.03",
|
||||
"description": "Upload a KML file of a route, and have your watch display a map with how far around it you are",
|
||||
"icon": "app.png",
|
||||
"tags": "",
|
||||
"supports": ["BANGLEJS"],
|
||||
"supports": ["BANGLEJS","BANGLEJS2"],
|
||||
"custom": "custom.html",
|
||||
"storage": [
|
||||
{"name":"route.app.js"},
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ function showBLEMenu() {
|
|||
},
|
||||
/*LANG*/'HID': {
|
||||
value: Math.max(0,0 | hidV.indexOf(settings.HID)),
|
||||
min: 0, max: 3,
|
||||
min: 0, max: hidN.length-1,
|
||||
format: v => hidN[v],
|
||||
onchange: v => {
|
||||
settings.HID = hidV[v];
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
0.01: New App!
|
||||
0.02: Fix crash on start
|
||||
|
|
|
|||
|
|
@ -90,7 +90,10 @@ if (global.sleeplog.enabled) {
|
|||
var storage = require("Storage");
|
||||
|
||||
// read previous logfile
|
||||
var log = JSON.parse(atob(storage.read(this.logfile)));
|
||||
var logContent = storage.read(this.logfile) || "";
|
||||
|
||||
// parse previous logfile
|
||||
var log = JSON.parse(logContent.length > 0 ? atob(logContent) : "[]") ;
|
||||
|
||||
// remove last state if it was unknown and is less then 10min ago
|
||||
if (log.length > 0 && log[0][1] === 0 &&
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"id":"sleeplog",
|
||||
"name":"Sleep Log",
|
||||
"shortName": "SleepLog",
|
||||
"version": "0.01",
|
||||
"version": "0.02",
|
||||
"description": "Log and view your sleeping habits. This app derived from SleepPhaseAlarm and uses also the principe of Estimation of Stationary Sleep-segments (ESS).",
|
||||
"icon": "app.png",
|
||||
"type": "app",
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@
|
|||
<div class="form-group">
|
||||
<select class="form-select form-inline" id="settings-lang" style="width: 10em">
|
||||
<option value="">None (English)</option>
|
||||
</select> <span>Translations (<a href="https://github.com/espruino/BangleApps/issues/1311" target="_blank">BETA - more info</a>)</span>
|
||||
</select> <span>Translations (<a href="https://github.com/espruino/BangleApps/issues/1311" target="_blank">BETA - more info</a>). Any apps that are uploaded to Bangle.js after changing this will have any text automatically translated.</span>
|
||||
</div>
|
||||
<button class="btn" id="defaultsettings">Default settings</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@
|
|||
{"code":"nl_NL","name":"Dutch","url":"nl_NL.json"},
|
||||
{"code":"sv_SE","name":"Swedish","url":"sv_SE.json"},
|
||||
{"code":"tr_TR","name":"Turkish","url":"tr_TR.json"},
|
||||
{"code":"ru_RU","name":"Russian","url":"ru_RU.json"},
|
||||
{"code":"ru_RU","name":"Russian","url":"ru_RU.json", "disabled":"Characters not in ISO Latin codepage"},
|
||||
{"code":"pt_PT","name":"Portuguese","url":"pt_PT.json"},
|
||||
{"code":"bg_BG","name":"Bulgarian","url":"bg_BG.json"},
|
||||
{"code":"bg_BG","name":"Bulgarian","url":"bg_BG.json", "disabled":"Characters not in ISO Latin codepage"},
|
||||
{"code":"da_DA","name":"Danish","url":"da_DA.json"},
|
||||
{"code":"el_EL","name":"Greek","url":"el_EL.json"},
|
||||
{"code":"el_EL","name":"Greek","url":"el_EL.json", "disabled":"Characters not in ISO Latin codepage"},
|
||||
{"code":"et_ET","name":"Estonian","url":"et_ET.json"},
|
||||
{"code":"lt_LT","name":"Lithuanian","url":"lt_LT.json"},
|
||||
{"code":"lv_LV","name":"Latvian","url":"lv_LV.json"},
|
||||
|
|
|
|||
Loading…
Reference in New Issue