Merge branch 'espruino:master' into master
commit
aaa3338f99
|
|
@ -5,3 +5,5 @@
|
||||||
0.05: Update calendar weekend colors for start on Sunday
|
0.05: Update calendar weekend colors for start on Sunday
|
||||||
0.06: Use larger font for dates
|
0.06: Use larger font for dates
|
||||||
0.07: Fix off-by-one-error on previous month
|
0.07: Fix off-by-one-error on previous month
|
||||||
|
0.08: Do not register as watch, manually start clock on button
|
||||||
|
read start of week from system settings
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,7 @@ const blue = "#0000ff";
|
||||||
const yellow = "#ffff00";
|
const yellow = "#ffff00";
|
||||||
|
|
||||||
let settings = require('Storage').readJSON("calendar.json", true) || {};
|
let settings = require('Storage').readJSON("calendar.json", true) || {};
|
||||||
if (settings.startOnSun === undefined)
|
let startOnSun = ((require("Storage").readJSON("setting.json", true) || {}).firstDayOfWeek || 0) === 0;
|
||||||
settings.startOnSun = false;
|
|
||||||
if (settings.ndColors === undefined)
|
if (settings.ndColors === undefined)
|
||||||
if (process.env.HWVERSION == 2) {
|
if (process.env.HWVERSION == 2) {
|
||||||
settings.ndColors = true;
|
settings.ndColors = true;
|
||||||
|
|
@ -50,14 +49,14 @@ function getDowLbls(locale) {
|
||||||
case "de_AT":
|
case "de_AT":
|
||||||
case "de_CH":
|
case "de_CH":
|
||||||
case "de_DE":
|
case "de_DE":
|
||||||
if (settings.startOnSun) {
|
if (startOnSun) {
|
||||||
dowLbls = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"];
|
dowLbls = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"];
|
||||||
} else {
|
} else {
|
||||||
dowLbls = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"];
|
dowLbls = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "nl_NL":
|
case "nl_NL":
|
||||||
if (settings.startOnSun) {
|
if (startOnSun) {
|
||||||
dowLbls = ["zo", "ma", "di", "wo", "do", "vr", "za"];
|
dowLbls = ["zo", "ma", "di", "wo", "do", "vr", "za"];
|
||||||
} else {
|
} else {
|
||||||
dowLbls = ["ma", "di", "wo", "do", "vr", "za", "zo"];
|
dowLbls = ["ma", "di", "wo", "do", "vr", "za", "zo"];
|
||||||
|
|
@ -66,14 +65,14 @@ function getDowLbls(locale) {
|
||||||
case "fr_BE":
|
case "fr_BE":
|
||||||
case "fr_CH":
|
case "fr_CH":
|
||||||
case "fr_FR":
|
case "fr_FR":
|
||||||
if (settings.startOnSun) {
|
if (startOnSun) {
|
||||||
dowLbls = ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"];
|
dowLbls = ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"];
|
||||||
} else {
|
} else {
|
||||||
dowLbls = ["Lu", "Ma", "Me", "Je", "Ve", "Sa", "Di"];
|
dowLbls = ["Lu", "Ma", "Me", "Je", "Ve", "Sa", "Di"];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "sv_SE":
|
case "sv_SE":
|
||||||
if (settings.startOnSun) {
|
if (startOnSun) {
|
||||||
dowLbls = ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"];
|
dowLbls = ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"];
|
||||||
} else {
|
} else {
|
||||||
dowLbls = ["Lu", "Ma", "Me", "Je", "Ve", "Sa", "Di"];
|
dowLbls = ["Lu", "Ma", "Me", "Je", "Ve", "Sa", "Di"];
|
||||||
|
|
@ -81,21 +80,21 @@ function getDowLbls(locale) {
|
||||||
break;
|
break;
|
||||||
case "it_CH":
|
case "it_CH":
|
||||||
case "it_IT":
|
case "it_IT":
|
||||||
if (settings.startOnSun) {
|
if (startOnSun) {
|
||||||
dowLbls = ["Do", "Lu", "Ma", "Me", "Gi", "Ve", "Sa"];
|
dowLbls = ["Do", "Lu", "Ma", "Me", "Gi", "Ve", "Sa"];
|
||||||
} else {
|
} else {
|
||||||
dowLbls = ["Lu", "Ma", "Me", "Gi", "Ve", "Sa", "Do"];
|
dowLbls = ["Lu", "Ma", "Me", "Gi", "Ve", "Sa", "Do"];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "oc_FR":
|
case "oc_FR":
|
||||||
if (settings.startOnSun) {
|
if (startOnSun) {
|
||||||
dowLbls = ["dg", "dl", "dm", "dc", "dj", "dv", "ds"];
|
dowLbls = ["dg", "dl", "dm", "dc", "dj", "dv", "ds"];
|
||||||
} else {
|
} else {
|
||||||
dowLbls = ["dl", "dm", "dc", "dj", "dv", "ds", "dg"];
|
dowLbls = ["dl", "dm", "dc", "dj", "dv", "ds", "dg"];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (settings.startOnSun) {
|
if (startOnSun) {
|
||||||
dowLbls = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
dowLbls = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
||||||
} else {
|
} else {
|
||||||
dowLbls = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"];
|
dowLbls = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"];
|
||||||
|
|
@ -110,7 +109,7 @@ function drawCalendar(date) {
|
||||||
g.clearRect(0, 0, maxX, maxY);
|
g.clearRect(0, 0, maxX, maxY);
|
||||||
g.setBgColor(bgColorMonth);
|
g.setBgColor(bgColorMonth);
|
||||||
g.clearRect(0, 0, maxX, headerH);
|
g.clearRect(0, 0, maxX, headerH);
|
||||||
if (settings.startOnSun){
|
if (startOnSun){
|
||||||
g.setBgColor(bgColorWeekend);
|
g.setBgColor(bgColorWeekend);
|
||||||
g.clearRect(0, headerH + rowH, colW, maxY);
|
g.clearRect(0, headerH + rowH, colW, maxY);
|
||||||
g.setBgColor(bgColorDow);
|
g.setBgColor(bgColorDow);
|
||||||
|
|
@ -150,7 +149,7 @@ function drawCalendar(date) {
|
||||||
});
|
});
|
||||||
|
|
||||||
date.setDate(1);
|
date.setDate(1);
|
||||||
const dow = date.getDay() + (settings.startOnSun ? 1 : 0);
|
const dow = date.getDay() + (startOnSun ? 1 : 0);
|
||||||
const dowNorm = dow === 0 ? 7 : dow;
|
const dowNorm = dow === 0 ? 7 : dow;
|
||||||
|
|
||||||
const monthMaxDayMap = {
|
const monthMaxDayMap = {
|
||||||
|
|
@ -242,5 +241,5 @@ Bangle.on("touch", area => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Show launcher when button pressed
|
// Show launcher when button pressed
|
||||||
Bangle.setUI("clock"); // TODO: ideally don't set 'clock' mode
|
setWatch(() => load(), process.env.HWVERSION === 2 ? BTN : BTN3, { repeat: false, edge: "falling" });
|
||||||
// No space for widgets!
|
// No space for widgets!
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "calendar",
|
"id": "calendar",
|
||||||
"name": "Calendar",
|
"name": "Calendar",
|
||||||
"version": "0.07",
|
"version": "0.08",
|
||||||
"description": "Simple calendar",
|
"description": "Simple calendar",
|
||||||
"icon": "calendar.png",
|
"icon": "calendar.png",
|
||||||
"screenshots": [{"url":"screenshot_calendar.png"}],
|
"screenshots": [{"url":"screenshot_calendar.png"}],
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
(function (back) {
|
(function (back) {
|
||||||
var FILE = "calendar.json";
|
var FILE = "calendar.json";
|
||||||
var settings = require('Storage').readJSON(FILE, true) || {};
|
var settings = require('Storage').readJSON(FILE, true) || {};
|
||||||
if (settings.startOnSun === undefined)
|
|
||||||
settings.startOnSun = false;
|
|
||||||
if (settings.ndColors === undefined)
|
if (settings.ndColors === undefined)
|
||||||
if (process.env.HWVERSION == 2) {
|
if (process.env.HWVERSION == 2) {
|
||||||
settings.ndColors = true;
|
settings.ndColors = true;
|
||||||
|
|
@ -17,14 +15,6 @@
|
||||||
E.showMenu({
|
E.showMenu({
|
||||||
"": { "title": "Calendar" },
|
"": { "title": "Calendar" },
|
||||||
"< Back": () => back(),
|
"< Back": () => back(),
|
||||||
'Start Sunday': {
|
|
||||||
value: settings.startOnSun,
|
|
||||||
format: v => v ? "Yes" : "No",
|
|
||||||
onchange: v => {
|
|
||||||
settings.startOnSun = v;
|
|
||||||
writeSettings();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'B2 Colors': {
|
'B2 Colors': {
|
||||||
value: settings.ndColors,
|
value: settings.ndColors,
|
||||||
format: v => v ? "Yes" : "No",
|
format: v => v ? "Yes" : "No",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
0.01: Launch app.
|
0.01: Launch app.
|
||||||
0.02: 12k steps are 360 degrees - improves readability of steps.
|
0.02: 12k steps are 360 degrees - improves readability of steps.
|
||||||
0.03: Battery improvements through sleep (no minute updates) and partial updates of drawing.
|
0.03: Battery improvements through sleep (no minute updates) and partial updates of drawing.
|
||||||
0.04: Use alarm for timer instead of own alarm implementation.
|
0.04: Use alarm for timer instead of own alarm implementation.
|
||||||
|
0.05: Use internal step counter if no widget is available.
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
"name": "Not Analog",
|
"name": "Not Analog",
|
||||||
"shortName":"Not Analog",
|
"shortName":"Not Analog",
|
||||||
"icon": "notanalog.png",
|
"icon": "notanalog.png",
|
||||||
"version":"0.04",
|
"version":"0.05",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
"supports": ["BANGLEJS2"],
|
"supports": ["BANGLEJS2"],
|
||||||
"description": "An analog watch face for people that can not read analog watch faces.",
|
"description": "An analog watch face for people that can not read analog watch faces.",
|
||||||
|
|
|
||||||
|
|
@ -88,20 +88,22 @@ Graphics.prototype.setNormalFont = function(scale) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getSteps() {
|
function getSteps() {
|
||||||
|
var steps = 0;
|
||||||
try{
|
try{
|
||||||
if (WIDGETS.wpedom !== undefined) {
|
if (WIDGETS.wpedom !== undefined) {
|
||||||
return WIDGETS.wpedom.getSteps();
|
steps = WIDGETS.wpedom.getSteps();
|
||||||
} else if (WIDGETS.activepedom !== undefined) {
|
} else if (WIDGETS.activepedom !== undefined) {
|
||||||
return WIDGETS.activepedom.getSteps();
|
steps = WIDGETS.activepedom.getSteps();
|
||||||
|
} else {
|
||||||
|
steps = Bangle.getHealthStatus("day").steps;
|
||||||
}
|
}
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
// In case we failed, we can only show 0 steps.
|
// In case we failed, we can only show 0 steps.
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function drawBackground() {
|
function drawBackground() {
|
||||||
|
|
@ -289,6 +291,9 @@ function drawSleep(){
|
||||||
|
|
||||||
|
|
||||||
function draw(fastUpdate){
|
function draw(fastUpdate){
|
||||||
|
// Queue draw in one minute
|
||||||
|
queueDraw();
|
||||||
|
|
||||||
// Execute handlers
|
// Execute handlers
|
||||||
handleState(fastUpdate);
|
handleState(fastUpdate);
|
||||||
|
|
||||||
|
|
@ -320,9 +325,6 @@ function draw(fastUpdate){
|
||||||
drawState();
|
drawState();
|
||||||
drawTime();
|
drawTime();
|
||||||
drawData();
|
drawData();
|
||||||
|
|
||||||
// Queue draw in one minute
|
|
||||||
queueDraw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,4 @@
|
||||||
0.06: Refactor some methods to library
|
0.06: Refactor some methods to library
|
||||||
0.07: Update settings
|
0.07: Update settings
|
||||||
Correct `decodeTime(t)` to return a more likely expected time
|
Correct `decodeTime(t)` to return a more likely expected time
|
||||||
|
0.08: add day of week check to getActiveAlarms()
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,12 @@ exports.getActiveAlarms = function(alarms, time) {
|
||||||
if (!time) time = new Date();
|
if (!time) time = new Date();
|
||||||
var currentTime = (time.getHours()*3600000)+(time.getMinutes()*60000)+(time.getSeconds()*1000)
|
var currentTime = (time.getHours()*3600000)+(time.getMinutes()*60000)+(time.getSeconds()*1000)
|
||||||
+10000;// get current time - 10s in future to ensure we alarm if we've started the app a tad early
|
+10000;// get current time - 10s in future to ensure we alarm if we've started the app a tad early
|
||||||
return alarms.filter(a=>a.on&&(a.t<currentTime)&&(a.last!=time.getDate()) && (!a.date || a.date==time.toISOString().substr(0,10))).sort((a,b)=>a.t-b.t);
|
return alarms.filter(a=>a.on
|
||||||
|
&&(a.t<currentTime)
|
||||||
|
&&(a.last!=time.getDate())
|
||||||
|
&& (!a.date || a.date==time.toISOString().substr(0,10))
|
||||||
|
&& a.dow >> (time).getDay() & 1)
|
||||||
|
.sort((a,b)=>a.t-b.t);
|
||||||
}
|
}
|
||||||
// Set an alarm object based on ID. Leave 'alarm' undefined to remove it
|
// Set an alarm object based on ID. Leave 'alarm' undefined to remove it
|
||||||
exports.setAlarm = function(id, alarm) {
|
exports.setAlarm = function(id, alarm) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "sched",
|
"id": "sched",
|
||||||
"name": "Scheduler",
|
"name": "Scheduler",
|
||||||
"version": "0.07",
|
"version": "0.08",
|
||||||
"description": "Scheduling library for alarms and timers",
|
"description": "Scheduling library for alarms and timers",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"type": "scheduler",
|
"type": "scheduler",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue