Merge branch 'master' into eslint-indent

master
Gordon Williams 2020-05-27 16:19:44 +01:00 committed by GitHub
commit 0f0402c7cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 7 deletions

View File

@ -137,7 +137,7 @@
"name": "Default Alarm",
"shortName":"Alarms",
"icon": "app.png",
"version":"0.07",
"version":"0.08",
"description": "Set and respond to alarms",
"tags": "tool,alarm,widget",
"storage": [

View File

@ -5,3 +5,4 @@
0.05: Add alarm.boot.js and move code from the bootloader
0.06: Change 'New Alarm' to 'Save', allow Deletion of Alarms
0.07: Don't overwrite existing settings on app update
0.08: Make alarm scheduling more reliable

View File

@ -2,15 +2,16 @@
(function() {
var alarms = require('Storage').readJSON('alarm.json',1)||[];
var time = new Date();
var active = alarms.filter(a=>a.on&&(a.last!=time.getDate()));
var active = alarms.filter(a=>a.on);
if (active.length) {
active = active.sort((a,b)=>a.hr-b.hr);
active = active.sort((a,b)=>(a.hr-b.hr)+(a.last-b.last)*24);
var hr = time.getHours()+(time.getMinutes()/60)+(time.getSeconds()/3600);
if (!require('Storage').read("alarm.js")) {
console.log("No alarm app!");
require('Storage').write('alarm.json',"[]")
require('Storage').write('alarm.json',"[]");
} else {
var t = 3600000*(active[0].hr-hr);
if (active[0].last == time.getDate() || t < 0) t += 86400000;
if (t<1000) t=1000;
/* execute alarm at the correct time. We avoid execing immediately
since this code will get called AGAIN when alarm.js is loaded. alarm.js
@ -21,4 +22,4 @@
},t);
}
}
})()
})();

View File

@ -446,5 +446,23 @@ var locales = {
abday: "ne,po,út,st,čt,pá,so",
day: "neděle,pondělí,úterý,středa,čtvrtek,pátek,sobota",
trans: { yes: "tak", Yes: "Tak", no: "nie", No: "Nie", ok: "ok", on: "na", off: "poza" }
},
"sl_SI": {
lang: "sl_SI",
decimal_point: ",",
thousands_sep: ".",
currency_symbol: "\x80",
int_curr_symbol: "EUR",
speed: "km/h",
distance: { 0: "m", 1: "km" },
temperature: "°C",
ampm: { 0: "dop.", 1: "pop." },
timePattern: { 0: "%HH:%MM:%SS", 1: "%HH:%MM" },
datePattern: { 0: "%d. %b %Y", 1: "%d.%m.%Y" }, // "30. jan. 2020" // "30.01.2020"(short)
abmonth: "jan.,feb.,mar.,apr.,maj,jun.,jul.,avg.,sep.,okt.,nov.,dec.",
month: "januar,februar,marec,april,maj,junij,julij,avgust,september,oktober,november,december",
abday: "ned.,pon.,tor.,sre.,čet.,pet.,sob.",
day: "nedelja,ponedeljek,torek,sreda,četrtek,petek,sobota",
trans: { yes: "da", Yes: "Da", no: "ne", No: "Ne", ok: "ok", on: "On", off: "Off" }
}
};

View File

@ -15,6 +15,7 @@ var SETTINGS = {
};
var Utils = require("../js/utils.js");
var AppInfo = require("../js/appinfo.js");
var noble = require('@abandonware/noble');
var apps;
function ERROR(msg) {
@ -62,7 +63,6 @@ function cmdInstallApp(appId) {
}
function bangleSend(command) {
var noble = require('noble');
var log = function() {
var args = [].slice.call(arguments);
console.log("UART: "+args.join(" "));

View File

@ -2,7 +2,7 @@ if (typeof btoa==="undefined") {
// Don't define btoa as a function here because Apple's
// iOS browser defines the function even though it's in
// an IF statement that is never executed!
btoa = function(d) { return BufferA.from(d).toString('base64'); }
btoa = function(d) { return Buffer.from(d).toString('base64'); }
}
// Converts a string into most efficient way to send to Espruino (either json, base64, or compressed base64)