Merge remote-tracking branch 'upstream/master'
commit
99e1d1a8df
|
|
@ -85,6 +85,7 @@
|
||||||
<label class="chip tooltip" filterid="ram" data-tooltip="Apps that don't save anything to flash memory">Online</label>
|
<label class="chip tooltip" filterid="ram" data-tooltip="Apps that don't save anything to flash memory">Online</label>
|
||||||
<label class="chip tooltip" filterid="clkinfo" data-tooltip="Info displayed on clocks, or clocks with info">Clock Info</label>
|
<label class="chip tooltip" filterid="clkinfo" data-tooltip="Info displayed on clocks, or clocks with info">Clock Info</label>
|
||||||
<label class="chip tooltip" filterid="health" data-tooltip="Apps for your health">Health</label>
|
<label class="chip tooltip" filterid="health" data-tooltip="Apps for your health">Health</label>
|
||||||
|
<label class="chip tooltip" filterid="fonts" data-tooltip="Extra fonts for non-latin languages">Fonts</label>
|
||||||
<label class="chip tooltip" filterid="favourites" data-tooltip="Apps that you've liked ❤️">Favourites</label>
|
<label class="chip tooltip" filterid="favourites" data-tooltip="Apps that you've liked ❤️">Favourites</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="sort-nav hidden">
|
<div class="sort-nav hidden">
|
||||||
|
|
|
||||||
|
|
@ -55,3 +55,4 @@
|
||||||
to select an alarm in the main menu.
|
to select an alarm in the main menu.
|
||||||
0.50: Bangle.js 2: Long touch of alarm in main menu toggle it on/off. Touching the icon on
|
0.50: Bangle.js 2: Long touch of alarm in main menu toggle it on/off. Touching the icon on
|
||||||
the right will do the same.
|
the right will do the same.
|
||||||
|
0.51: Fix long-touch to enable alarm/timer not updating time (fix #3804)
|
||||||
|
|
|
||||||
|
|
@ -87,11 +87,10 @@ function showMainMenu(scroll, group, scrollback) {
|
||||||
};
|
};
|
||||||
const getGroups = settings.showGroup && !group;
|
const getGroups = settings.showGroup && !group;
|
||||||
const groups = getGroups ? {} : undefined;
|
const groups = getGroups ? {} : undefined;
|
||||||
var showAlarm;
|
|
||||||
const getIcon = (e)=>{return e.on ? (e.timer ? iconTimerOn : iconAlarmOn) : (e.timer ? iconTimerOff : iconAlarmOff);};
|
const getIcon = (e)=>{return e.on ? (e.timer ? iconTimerOn : iconAlarmOn) : (e.timer ? iconTimerOff : iconAlarmOff);};
|
||||||
|
|
||||||
alarms.forEach((e, index) => {
|
alarms.forEach((e, index) => {
|
||||||
showAlarm = !settings.showGroup || (group ? e.group === group : !e.group);
|
const showAlarm = !settings.showGroup || (group ? e.group === group : !e.group);
|
||||||
if(showAlarm) {
|
if(showAlarm) {
|
||||||
const label = trimLabel(getLabel(e),40);
|
const label = trimLabel(getLabel(e),40);
|
||||||
menu[label] = {
|
menu[label] = {
|
||||||
|
|
@ -99,6 +98,7 @@ function showMainMenu(scroll, group, scrollback) {
|
||||||
onchange: (v, touch) => {
|
onchange: (v, touch) => {
|
||||||
if (touch && (2==touch.type || 145<touch.x)) { // Long touch or touched icon.
|
if (touch && (2==touch.type || 145<touch.x)) { // Long touch or touched icon.
|
||||||
e.on = v;
|
e.on = v;
|
||||||
|
if (e.on) prepareForSave(e, index);
|
||||||
saveAndReload();
|
saveAndReload();
|
||||||
} else {
|
} else {
|
||||||
setTimeout(e.timer ? showEditTimerMenu : showEditAlarmMenu, 10, e, index, undefined, scroller?scroller.scroll:undefined, group);
|
setTimeout(e.timer ? showEditTimerMenu : showEditAlarmMenu, 10, e, index, undefined, scroller?scroller.scroll:undefined, group);
|
||||||
|
|
@ -328,6 +328,14 @@ function prepareAlarmForSave(alarm, alarmIndex, time, date, temp) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function prepareForSave(alarm, alarmIndex) {
|
||||||
|
if (alarm.timer) {
|
||||||
|
prepareTimerForSave(alarm, alarmIndex, require("time_utils").decodeTime(alarm.timer));
|
||||||
|
} else {
|
||||||
|
prepareAlarmForSave(alarm, alarmIndex, require("time_utils").decodeTime(alarm.t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function saveAndReload() {
|
function saveAndReload() {
|
||||||
// Before saving revert the dow to the standard format (alarms only!)
|
// Before saving revert the dow to the standard format (alarms only!)
|
||||||
alarms.filter(e => e.timer === undefined).forEach(a => a.dow = handleFirstDayOfWeek(a.dow));
|
alarms.filter(e => e.timer === undefined).forEach(a => a.dow = handleFirstDayOfWeek(a.dow));
|
||||||
|
|
@ -574,13 +582,7 @@ function enableAll(on) {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
alarms.forEach((alarm, i) => {
|
alarms.forEach((alarm, i) => {
|
||||||
alarm.on = on;
|
alarm.on = on;
|
||||||
if (on) {
|
if (on) prepareForSave(alarm, i);
|
||||||
if (alarm.timer) {
|
|
||||||
prepareTimerForSave(alarm, i, require("time_utils").decodeTime(alarm.timer));
|
|
||||||
} else {
|
|
||||||
prepareAlarmForSave(alarm, i, require("time_utils").decodeTime(alarm.t));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
saveAndReload();
|
saveAndReload();
|
||||||
showMainMenu();
|
showMainMenu();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "alarm",
|
"id": "alarm",
|
||||||
"name": "Alarms & Timers",
|
"name": "Alarms & Timers",
|
||||||
"shortName": "Alarms",
|
"shortName": "Alarms",
|
||||||
"version": "0.50",
|
"version": "0.51",
|
||||||
"description": "Set alarms and timers on your Bangle",
|
"description": "Set alarms and timers on your Bangle",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"tags": "tool,alarm",
|
"tags": "tool,alarm",
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,5 @@
|
||||||
0.02: Fix reset of progress bars on midnight. Fix display of 100k+ steps.
|
0.02: Fix reset of progress bars on midnight. Fix display of 100k+ steps.
|
||||||
0.03: Added option to display weather.
|
0.03: Added option to display weather.
|
||||||
0.04: Added option to display live updates of step count.
|
0.04: Added option to display live updates of step count.
|
||||||
|
0.05: Reset graphics before initial clearing of the screen. Helps in some
|
||||||
|
situations if using fastload utils.
|
||||||
|
|
|
||||||
|
|
@ -336,7 +336,7 @@
|
||||||
/* Startup Process
|
/* Startup Process
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
g.clear();
|
g.clear(1);
|
||||||
drawAll();
|
drawAll();
|
||||||
startTimers();
|
startTimers();
|
||||||
registerEvents();
|
registerEvents();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "edgeclk",
|
"id": "edgeclk",
|
||||||
"name": "Edge Clock",
|
"name": "Edge Clock",
|
||||||
"shortName": "Edge Clock",
|
"shortName": "Edge Clock",
|
||||||
"version": "0.04",
|
"version": "0.05",
|
||||||
"description": "Crisp clock with perfect readability.",
|
"description": "Crisp clock with perfect readability.",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@
|
||||||
* @param _button 1 for left half, 2 for right half
|
* @param _button 1 for left half, 2 for right half
|
||||||
* @param xy postion on screen
|
* @param xy postion on screen
|
||||||
*/
|
*/
|
||||||
let onTouch = function (_button: number, xy: { x: number, y: number } | undefined) {
|
let onTouch = function (_button, xy) {
|
||||||
// Determine which grid cell was tapped
|
// Determine which grid cell was tapped
|
||||||
let x: number = Math.floor((xy!.x - 12) / ((g.getWidth() - 24) / config.display.rows));
|
let x: number = Math.floor((xy!.x - 12) / ((g.getWidth() - 24) / config.display.rows));
|
||||||
if (x < 0) x = 0;
|
if (x < 0) x = 0;
|
||||||
|
|
@ -206,7 +206,7 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} satisfies TouchCallback;
|
||||||
|
|
||||||
let page: number = 0;
|
let page: number = 0;
|
||||||
let nPages: number; // Set when setting folder
|
let nPages: number; // Set when setting folder
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
0.01: first release
|
0.01: first release
|
||||||
0.02: memory leak fix; color changes to better align with VSCode color scheme; logo is transparent
|
0.02: memory leak fix; color changes to better align with VSCode color scheme; logo is transparent
|
||||||
|
0.03: Fixed redrawing of commas
|
||||||
|
|
|
||||||
|
|
@ -229,6 +229,7 @@ let redraw = function() {
|
||||||
if (!(key in valsArrs)) continue;
|
if (!(key in valsArrs)) continue;
|
||||||
let valsArr = valsArrs[key];
|
let valsArr = valsArrs[key];
|
||||||
if (value === valsArr.text) continue; // No need to update
|
if (value === valsArr.text) continue; // No need to update
|
||||||
|
if (valsArr.endComma) value = value.slice(0, -1);
|
||||||
valsArrs[key].text = value;
|
valsArrs[key].text = value;
|
||||||
|
|
||||||
// Clear prev values
|
// Clear prev values
|
||||||
|
|
@ -239,7 +240,7 @@ let redraw = function() {
|
||||||
g.drawString(value, valsArr.x, valsArr.y);
|
g.drawString(value, valsArr.x, valsArr.y);
|
||||||
if (valsArr.endComma){
|
if (valsArr.endComma){
|
||||||
g.setColor(clrs.brackets);
|
g.setColor(clrs.brackets);
|
||||||
g.drawString(',', valsArr.Banglex + g.stringWidth(value), valsArr.y);
|
g.drawString(',', valsArr.x + g.stringWidth(value), valsArr.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{ "id": "jsonclock",
|
{ "id": "jsonclock",
|
||||||
"name": "JsonClock",
|
"name": "JsonClock",
|
||||||
"version": "0.02",
|
"version": "0.03",
|
||||||
"description": "JSON view of the time, date, steps, battery, and sunrise and sunset times",
|
"description": "JSON view of the time, date, steps, battery, and sunrise and sunset times",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"screenshots": [{"url":"dark.png"}],
|
"screenshots": [{"url":"dark.png"}],
|
||||||
|
|
|
||||||
|
|
@ -475,12 +475,6 @@ module.exports = {
|
||||||
"no-undef"
|
"no-undef"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"apps/warpdrive/app.js": {
|
|
||||||
"hash": "c2f9113c4d298a3021ec4bc0bc5f5d1bcd88267b4fa2acc03ae17d6447ed7d00",
|
|
||||||
"rules": [
|
|
||||||
"no-undef"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"apps/usgs/settings.js": {
|
"apps/usgs/settings.js": {
|
||||||
"hash": "00ee672a6920f5667bfbd2988fd2853cfd579895a843ae036a00028dcb13878d",
|
"hash": "00ee672a6920f5667bfbd2988fd2853cfd579895a843ae036a00028dcb13878d",
|
||||||
"rules": [
|
"rules": [
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,5 @@
|
||||||
0.02: Show elapsed time on pause screen
|
0.02: Show elapsed time on pause screen
|
||||||
0.03: Avoid initial GPS skew and allow reset of time/splits
|
0.03: Avoid initial GPS skew and allow reset of time/splits
|
||||||
0.04: Bump exstats module - show active time, not elapsed
|
0.04: Bump exstats module - show active time, not elapsed
|
||||||
|
0.05: Fix menu display - don't draw over the menu and vice-versa. Require
|
||||||
|
double-tap for menu
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ A running pace app, useful for races. Will also record your splits and display t
|
||||||
Drag up/down on the pause menu to scroll through your splits.
|
Drag up/down on the pause menu to scroll through your splits.
|
||||||
Press the button to pause/resume - when resumed, pressing the button will pause instantly, regardless of whether the screen is locked.
|
Press the button to pause/resume - when resumed, pressing the button will pause instantly, regardless of whether the screen is locked.
|
||||||
|
|
||||||
|
Double tap the pause screen to access a menu for finer control
|
||||||
|
|
||||||
# Todo
|
# Todo
|
||||||
|
|
||||||
- Load splits on app start, button to reset (exs is always reset)
|
- Load splits on app start, button to reset (exs is always reset)
|
||||||
- Show total time on pause screen
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
});
|
});
|
||||||
var S_1 = require("Storage");
|
var S_1 = require("Storage");
|
||||||
var drawTimeout_1;
|
var drawTimeout_1;
|
||||||
|
var menuShown_1 = false;
|
||||||
var splits_1 = [];
|
var splits_1 = [];
|
||||||
var splitOffset_1 = 0, splitOffsetPx_1 = 0;
|
var splitOffset_1 = 0, splitOffsetPx_1 = 0;
|
||||||
var GPS_TIMEOUT_MS_1 = 30000;
|
var GPS_TIMEOUT_MS_1 = 30000;
|
||||||
|
|
@ -113,12 +114,10 @@
|
||||||
};
|
};
|
||||||
var pauseRun_1 = function () {
|
var pauseRun_1 = function () {
|
||||||
exs_1.stop();
|
exs_1.stop();
|
||||||
Bangle.setGPSPower(0, "pace");
|
|
||||||
draw_1();
|
draw_1();
|
||||||
};
|
};
|
||||||
var resumeRun_1 = function () {
|
var resumeRun_1 = function () {
|
||||||
exs_1.resume();
|
exs_1.resume();
|
||||||
Bangle.setGPSPower(1, "pace");
|
|
||||||
g.clearRect(Bangle.appRect);
|
g.clearRect(Bangle.appRect);
|
||||||
layout_1.forgetLazyState();
|
layout_1.forgetLazyState();
|
||||||
draw_1();
|
draw_1();
|
||||||
|
|
@ -129,6 +128,12 @@
|
||||||
else
|
else
|
||||||
resumeRun_1();
|
resumeRun_1();
|
||||||
};
|
};
|
||||||
|
var hideMenu_1 = function () {
|
||||||
|
if (!menuShown_1)
|
||||||
|
return;
|
||||||
|
Bangle.setUI();
|
||||||
|
menuShown_1 = false;
|
||||||
|
};
|
||||||
exs_1.start();
|
exs_1.start();
|
||||||
exs_1.stats.dist.on("notify", function (dist) {
|
exs_1.stats.dist.on("notify", function (dist) {
|
||||||
var prev = { time: 0, dist: 0 };
|
var prev = { time: 0, dist: 0 };
|
||||||
|
|
@ -156,7 +161,7 @@
|
||||||
});
|
});
|
||||||
setWatch(function () { return onButton_1(); }, BTN1, { repeat: true });
|
setWatch(function () { return onButton_1(); }, BTN1, { repeat: true });
|
||||||
Bangle.on('drag', function (e) {
|
Bangle.on('drag', function (e) {
|
||||||
if (exs_1.state.active || e.b === 0)
|
if (exs_1.state.active || e.b === 0 || menuShown_1)
|
||||||
return;
|
return;
|
||||||
splitOffsetPx_1 -= e.dy;
|
splitOffsetPx_1 -= e.dy;
|
||||||
if (splitOffsetPx_1 > 20) {
|
if (splitOffsetPx_1 > 20) {
|
||||||
|
|
@ -174,9 +179,10 @@
|
||||||
Bangle.on('twist', function () {
|
Bangle.on('twist', function () {
|
||||||
Bangle.setBacklight(1);
|
Bangle.setBacklight(1);
|
||||||
});
|
});
|
||||||
Bangle.on('tap', function (_e) {
|
Bangle.on('tap', function (e) {
|
||||||
if (exs_1.state.active)
|
if (exs_1.state.active || menuShown_1 || !e.double)
|
||||||
return;
|
return;
|
||||||
|
menuShown_1 = true;
|
||||||
var menu = {
|
var menu = {
|
||||||
"": {
|
"": {
|
||||||
remove: function () {
|
remove: function () {
|
||||||
|
|
@ -184,22 +190,23 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"< Back": function () {
|
"< Back": function () {
|
||||||
Bangle.setUI();
|
hideMenu_1();
|
||||||
},
|
},
|
||||||
"Zero time": function () {
|
"Zero time": function () {
|
||||||
exs_1.start();
|
exs_1.start();
|
||||||
exs_1.stop();
|
exs_1.stop();
|
||||||
Bangle.setUI();
|
hideMenu_1();
|
||||||
},
|
},
|
||||||
"Clear splits": function () {
|
"Clear splits": function () {
|
||||||
splits_1.splice(0, splits_1.length);
|
splits_1.splice(0, splits_1.length);
|
||||||
Bangle.setUI();
|
hideMenu_1();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
E.showMenu(menu);
|
E.showMenu(menu);
|
||||||
});
|
});
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
|
Bangle.setGPSPower(1, "pace");
|
||||||
g.clearRect(Bangle.appRect);
|
g.clearRect(Bangle.appRect);
|
||||||
draw_1();
|
draw_1();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ const exs = require("exstats").getStats(
|
||||||
const S = require("Storage");
|
const S = require("Storage");
|
||||||
|
|
||||||
let drawTimeout: TimeoutId | undefined;
|
let drawTimeout: TimeoutId | undefined;
|
||||||
|
let menuShown = false;
|
||||||
|
|
||||||
type Dist = number & { brand: 'dist' };
|
type Dist = number & { brand: 'dist' };
|
||||||
type Time = number & { brand: 'time' };
|
type Time = number & { brand: 'time' };
|
||||||
|
|
@ -151,13 +152,11 @@ const drawSplit = (i: number, y: number, pace: number | string) =>
|
||||||
|
|
||||||
const pauseRun = () => {
|
const pauseRun = () => {
|
||||||
exs.stop();
|
exs.stop();
|
||||||
Bangle.setGPSPower(0, "pace")
|
|
||||||
draw();
|
draw();
|
||||||
};
|
};
|
||||||
|
|
||||||
const resumeRun = () => {
|
const resumeRun = () => {
|
||||||
exs.resume();
|
exs.resume();
|
||||||
Bangle.setGPSPower(1, "pace");
|
|
||||||
|
|
||||||
g.clearRect(Bangle.appRect); // splits -> layout, clear. layout -> splits, fine
|
g.clearRect(Bangle.appRect); // splits -> layout, clear. layout -> splits, fine
|
||||||
layout.forgetLazyState();
|
layout.forgetLazyState();
|
||||||
|
|
@ -171,6 +170,12 @@ const onButton = () => {
|
||||||
resumeRun();
|
resumeRun();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const hideMenu = () => {
|
||||||
|
if (!menuShown) return;
|
||||||
|
Bangle.setUI(); // calls `remove`, which handles redrawing
|
||||||
|
menuShown = false;
|
||||||
|
}
|
||||||
|
|
||||||
exs.start(); // aka reset
|
exs.start(); // aka reset
|
||||||
|
|
||||||
exs.stats.dist.on("notify", (dist) => {
|
exs.stats.dist.on("notify", (dist) => {
|
||||||
|
|
@ -209,7 +214,7 @@ Bangle.on('lock', locked => {
|
||||||
setWatch(() => onButton(), BTN1, { repeat: true });
|
setWatch(() => onButton(), BTN1, { repeat: true });
|
||||||
|
|
||||||
Bangle.on('drag', e => {
|
Bangle.on('drag', e => {
|
||||||
if (exs.state.active || e.b === 0) return;
|
if (exs.state.active || e.b === 0 || menuShown) return;
|
||||||
|
|
||||||
splitOffsetPx -= e.dy;
|
splitOffsetPx -= e.dy;
|
||||||
if (splitOffsetPx > 20) {
|
if (splitOffsetPx > 20) {
|
||||||
|
|
@ -226,9 +231,11 @@ Bangle.on('twist', () => {
|
||||||
Bangle.setBacklight(1);
|
Bangle.setBacklight(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
Bangle.on('tap', _e => {
|
Bangle.on('tap', e => {
|
||||||
if(exs.state.active) return;
|
// require a double tap, to avoid picking up menu "< Back" taps
|
||||||
|
if(exs.state.active || menuShown || !e.double) return;
|
||||||
|
|
||||||
|
menuShown = true;
|
||||||
const menu: Menu = {
|
const menu: Menu = {
|
||||||
"": {
|
"": {
|
||||||
remove: () => {
|
remove: () => {
|
||||||
|
|
@ -236,16 +243,16 @@ Bangle.on('tap', _e => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"< Back": () => {
|
"< Back": () => {
|
||||||
Bangle.setUI(); // calls `remove`, which handles redrawing
|
hideMenu();
|
||||||
},
|
},
|
||||||
"Zero time": () => {
|
"Zero time": () => {
|
||||||
exs.start(); // calls reset
|
exs.start(); // calls reset
|
||||||
exs.stop(); // re-pauses
|
exs.stop(); // re-pauses
|
||||||
Bangle.setUI();
|
hideMenu();
|
||||||
},
|
},
|
||||||
"Clear splits": () => {
|
"Clear splits": () => {
|
||||||
splits.splice(0, splits.length);
|
splits.splice(0, splits.length);
|
||||||
Bangle.setUI();
|
hideMenu();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -254,6 +261,7 @@ Bangle.on('tap', _e => {
|
||||||
|
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
|
Bangle.setGPSPower(1, "pace");
|
||||||
|
|
||||||
g.clearRect(Bangle.appRect);
|
g.clearRect(Bangle.appRect);
|
||||||
draw();
|
draw();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "pace",
|
"id": "pace",
|
||||||
"name": "Pace",
|
"name": "Pace",
|
||||||
"version": "0.04",
|
"version": "0.05",
|
||||||
"description": "Show pace and time running splits",
|
"description": "Show pace and time running splits",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"tags": "run,running,fitness,outdoors",
|
"tags": "run,running,fitness,outdoors",
|
||||||
|
|
|
||||||
|
|
@ -14,3 +14,5 @@
|
||||||
0.10: Trigger `remove` callbacks when ending the menu
|
0.10: Trigger `remove` callbacks when ending the menu
|
||||||
0.11: Add options for natural scroll and disabling wrap-around
|
0.11: Add options for natural scroll and disabling wrap-around
|
||||||
0.12: Fix bug where settings would behave as if all were set to false
|
0.12: Fix bug where settings would behave as if all were set to false
|
||||||
|
0.13: Update to new touch-event handling
|
||||||
|
0.14: Fix bug in handling changes to `Bangle.appRect`
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
var _a, _b;
|
var _a, _b;
|
||||||
var S = (require("Storage").readJSON("promenu.settings.json", true) || {});
|
var prosettings = (require("Storage").readJSON("promenu.settings.json", true) || {});
|
||||||
(_a = S.naturalScroll) !== null && _a !== void 0 ? _a : (S.naturalScroll = false);
|
(_a = prosettings.naturalScroll) !== null && _a !== void 0 ? _a : (prosettings.naturalScroll = false);
|
||||||
(_b = S.wrapAround) !== null && _b !== void 0 ? _b : (S.wrapAround = true);
|
(_b = prosettings.wrapAround) !== null && _b !== void 0 ? _b : (prosettings.wrapAround = true);
|
||||||
E.showMenu = function (items) {
|
E.showMenu = function (items) {
|
||||||
var RectRnd = function (x1, y1, x2, y2, r) {
|
var RectRnd = function (x1, y1, x2, y2, r) {
|
||||||
var pp = [];
|
var pp = [];
|
||||||
|
|
@ -20,14 +20,7 @@ E.showMenu = function (items) {
|
||||||
var menuItems = Object.keys(items).filter(function (x) { return x.length; });
|
var menuItems = Object.keys(items).filter(function (x) { return x.length; });
|
||||||
var fontHeight = options.fontHeight || 25;
|
var fontHeight = options.fontHeight || 25;
|
||||||
var selected = options.scroll || options.selected || 0;
|
var selected = options.scroll || options.selected || 0;
|
||||||
var ar = Bangle.appRect;
|
g.reset().clearRect(Bangle.appRect);
|
||||||
g.reset().clearRect(ar);
|
|
||||||
var x = ar.x;
|
|
||||||
var x2 = ar.x2;
|
|
||||||
var y = ar.y;
|
|
||||||
var y2 = ar.y2 - 12;
|
|
||||||
if (options.title)
|
|
||||||
y += 22;
|
|
||||||
var lastIdx = 0;
|
var lastIdx = 0;
|
||||||
var selectEdit = undefined;
|
var selectEdit = undefined;
|
||||||
var scroller = {
|
var scroller = {
|
||||||
|
|
@ -36,6 +29,7 @@ E.showMenu = function (items) {
|
||||||
var nameScroller = null;
|
var nameScroller = null;
|
||||||
var drawLine = function (name, v, item, idx, x, y, nameScroll) {
|
var drawLine = function (name, v, item, idx, x, y, nameScroll) {
|
||||||
if (nameScroll === void 0) { nameScroll = 0; }
|
if (nameScroll === void 0) { nameScroll = 0; }
|
||||||
|
var x2 = Bangle.appRect.x2;
|
||||||
var hl = (idx === selected && !selectEdit);
|
var hl = (idx === selected && !selectEdit);
|
||||||
if (g.theme.dark) {
|
if (g.theme.dark) {
|
||||||
fillRectRnd(x, y, x2, y + fontHeight - 3, 7, hl ? g.theme.bgH : g.theme.bg + 40);
|
fillRectRnd(x, y, x2, y + fontHeight - 3, 7, hl ? g.theme.bgH : g.theme.bg + 40);
|
||||||
|
|
@ -74,6 +68,12 @@ E.showMenu = function (items) {
|
||||||
};
|
};
|
||||||
var l = {
|
var l = {
|
||||||
draw: function (rowmin, rowmax) {
|
draw: function (rowmin, rowmax) {
|
||||||
|
var _a = Bangle.appRect, x = _a.x, x2 = _a.x2, y = _a.y, y2 = _a.y2;
|
||||||
|
if (y === 0)
|
||||||
|
y = 24;
|
||||||
|
if (options.title)
|
||||||
|
y += 22;
|
||||||
|
y2 -= 12;
|
||||||
if (nameScroller)
|
if (nameScroller)
|
||||||
clearInterval(nameScroller), nameScroller = null;
|
clearInterval(nameScroller), nameScroller = null;
|
||||||
var rows = 0 | Math.min((y2 - y) / fontHeight, menuItems.length);
|
var rows = 0 | Math.min((y2 - y) / fontHeight, menuItems.length);
|
||||||
|
|
@ -133,10 +133,10 @@ E.showMenu = function (items) {
|
||||||
g.setColor((idx < menuItems.length) ? g.theme.fg : g.theme.bg).fillPoly([72, 166, 104, 166, 88, 174]);
|
g.setColor((idx < menuItems.length) ? g.theme.fg : g.theme.bg).fillPoly([72, 166, 104, 166, 88, 174]);
|
||||||
g.flip();
|
g.flip();
|
||||||
},
|
},
|
||||||
select: function () {
|
select: function (evt) {
|
||||||
var item = items[menuItems[selected]];
|
var item = items[menuItems[selected]];
|
||||||
if (typeof item === "function") {
|
if (typeof item === "function") {
|
||||||
item();
|
item(evt);
|
||||||
}
|
}
|
||||||
else if (typeof item === "object") {
|
else if (typeof item === "object") {
|
||||||
if (typeof item.value === "number") {
|
if (typeof item.value === "number") {
|
||||||
|
|
@ -146,12 +146,12 @@ E.showMenu = function (items) {
|
||||||
if (typeof item.value === "boolean")
|
if (typeof item.value === "boolean")
|
||||||
item.value = !item.value;
|
item.value = !item.value;
|
||||||
if (item.onchange)
|
if (item.onchange)
|
||||||
item.onchange(item.value);
|
item.onchange(item.value, evt);
|
||||||
}
|
}
|
||||||
l.draw();
|
l.draw();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
move: function (dir) {
|
move: function (dir, evt) {
|
||||||
var item = selectEdit;
|
var item = selectEdit;
|
||||||
if (typeof item === "object" && typeof item.value === "number") {
|
if (typeof item === "object" && typeof item.value === "number") {
|
||||||
var orig = item.value;
|
var orig = item.value;
|
||||||
|
|
@ -162,13 +162,13 @@ E.showMenu = function (items) {
|
||||||
item.value = item.wrap ? item.min : item.max;
|
item.value = item.wrap ? item.min : item.max;
|
||||||
if (item.value !== orig) {
|
if (item.value !== orig) {
|
||||||
if (item.onchange)
|
if (item.onchange)
|
||||||
item.onchange(item.value);
|
item.onchange(item.value, evt);
|
||||||
l.draw(selected, selected);
|
l.draw(selected, selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var lastSelected = selected;
|
var lastSelected = selected;
|
||||||
if (S.wrapAround) {
|
if (prosettings.wrapAround) {
|
||||||
selected = (selected + dir + menuItems.length) % menuItems.length;
|
selected = (selected + dir + menuItems.length) % menuItems.length;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -198,6 +198,12 @@ E.showMenu = function (items) {
|
||||||
};
|
};
|
||||||
Bangle.on('swipe', onSwipe);
|
Bangle.on('swipe', onSwipe);
|
||||||
}
|
}
|
||||||
|
var cb = function (dir, evt) {
|
||||||
|
if (dir)
|
||||||
|
l.move(prosettings.naturalScroll ? -dir : dir, evt);
|
||||||
|
else
|
||||||
|
l.select(evt);
|
||||||
|
};
|
||||||
Bangle.setUI({
|
Bangle.setUI({
|
||||||
mode: "updown",
|
mode: "updown",
|
||||||
back: back,
|
back: back,
|
||||||
|
|
@ -208,11 +214,9 @@ E.showMenu = function (items) {
|
||||||
Bangle.removeListener("swipe", onSwipe);
|
Bangle.removeListener("swipe", onSwipe);
|
||||||
(_a = options.remove) === null || _a === void 0 ? void 0 : _a.call(options);
|
(_a = options.remove) === null || _a === void 0 ? void 0 : _a.call(options);
|
||||||
},
|
},
|
||||||
}, function (dir) {
|
touch: (function (_button, xy) {
|
||||||
if (dir)
|
cb(void 0, xy);
|
||||||
l.move(S.naturalScroll ? -dir : dir);
|
}),
|
||||||
else
|
}, cb);
|
||||||
l.select();
|
|
||||||
});
|
|
||||||
return l;
|
return l;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ const enum Consts {
|
||||||
NAME_SCROLL_PAD = 5,
|
NAME_SCROLL_PAD = 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
const S = (require("Storage").readJSON("promenu.settings.json", true) || {}) as PromenuSettings;
|
const prosettings = (require("Storage").readJSON("promenu.settings.json", true) || {}) as PromenuSettings;
|
||||||
S.naturalScroll ??= false;
|
prosettings.naturalScroll ??= false;
|
||||||
S.wrapAround ??= true;
|
prosettings.wrapAround ??= true;
|
||||||
|
|
||||||
E.showMenu = (items?: Menu): MenuInstance => {
|
E.showMenu = (items?: Menu): MenuInstance => {
|
||||||
const RectRnd = (x1: number, y1: number, x2: number, y2: number, r: number) => {
|
const RectRnd = (x1: number, y1: number, x2: number, y2: number, r: number) => {
|
||||||
|
|
@ -34,15 +34,7 @@ E.showMenu = (items?: Menu): MenuInstance => {
|
||||||
|
|
||||||
let selected = options.scroll || options.selected || 0;
|
let selected = options.scroll || options.selected || 0;
|
||||||
|
|
||||||
const ar = Bangle.appRect;
|
g.reset().clearRect(Bangle.appRect);
|
||||||
g.reset().clearRect(ar);
|
|
||||||
|
|
||||||
const x = ar.x;
|
|
||||||
const x2 = ar.x2;
|
|
||||||
let y = ar.y;
|
|
||||||
const y2 = ar.y2 - 12; // padding at end for arrow
|
|
||||||
if (options.title)
|
|
||||||
y += 22;
|
|
||||||
|
|
||||||
let lastIdx = 0;
|
let lastIdx = 0;
|
||||||
let selectEdit: undefined | ActualMenuItem = undefined;
|
let selectEdit: undefined | ActualMenuItem = undefined;
|
||||||
|
|
@ -61,6 +53,7 @@ E.showMenu = (items?: Menu): MenuInstance => {
|
||||||
y: number,
|
y: number,
|
||||||
nameScroll: number = 0,
|
nameScroll: number = 0,
|
||||||
) => {
|
) => {
|
||||||
|
const { x2 } = Bangle.appRect;
|
||||||
const hl = (idx === selected && !selectEdit);
|
const hl = (idx === selected && !selectEdit);
|
||||||
if(g.theme.dark){
|
if(g.theme.dark){
|
||||||
fillRectRnd(x, y, x2, y + fontHeight - 3, 7, hl ? g.theme.bgH : g.theme.bg + 40);
|
fillRectRnd(x, y, x2, y + fontHeight - 3, 7, hl ? g.theme.bgH : g.theme.bg + 40);
|
||||||
|
|
@ -114,6 +107,13 @@ E.showMenu = (items?: Menu): MenuInstance => {
|
||||||
|
|
||||||
const l = {
|
const l = {
|
||||||
draw: (rowmin?: number, rowmax?: number) => {
|
draw: (rowmin?: number, rowmax?: number) => {
|
||||||
|
// always refresh appRect, a back button may have appeared
|
||||||
|
let { x, x2, y, y2 } = Bangle.appRect;
|
||||||
|
if(y === 0) y = 24; // always bump down for widgets/back button
|
||||||
|
|
||||||
|
if (options.title) y += 22;
|
||||||
|
y2 -= 12; // padding at end for arrow
|
||||||
|
|
||||||
if (nameScroller) clearInterval(nameScroller), nameScroller = null;
|
if (nameScroller) clearInterval(nameScroller), nameScroller = null;
|
||||||
let rows = 0|Math.min((y2 - y) / fontHeight, menuItems.length);
|
let rows = 0|Math.min((y2 - y) / fontHeight, menuItems.length);
|
||||||
let idx = E.clip(selected - (rows>>1), 0, menuItems.length - rows);
|
let idx = E.clip(selected - (rows>>1), 0, menuItems.length - rows);
|
||||||
|
|
@ -175,11 +175,11 @@ E.showMenu = (items?: Menu): MenuInstance => {
|
||||||
g.setColor((idx < menuItems.length)?g.theme.fg:g.theme.bg).fillPoly([72, 166, 104, 166, 88, 174]);
|
g.setColor((idx < menuItems.length)?g.theme.fg:g.theme.bg).fillPoly([72, 166, 104, 166, 88, 174]);
|
||||||
g.flip();
|
g.flip();
|
||||||
},
|
},
|
||||||
select: () => {
|
select: (evt: TouchCallbackXY | undefined) => {
|
||||||
const item = items![menuItems[selected]] as ActualMenuItem;
|
const item = items![menuItems[selected]] as ActualMenuItem;
|
||||||
|
|
||||||
if (typeof item === "function") {
|
if (typeof item === "function") {
|
||||||
item();
|
item(evt);
|
||||||
} else if (typeof item === "object") {
|
} else if (typeof item === "object") {
|
||||||
if (typeof item.value === "number") {
|
if (typeof item.value === "number") {
|
||||||
selectEdit = selectEdit ? undefined : item;
|
selectEdit = selectEdit ? undefined : item;
|
||||||
|
|
@ -188,12 +188,12 @@ E.showMenu = (items?: Menu): MenuInstance => {
|
||||||
item.value = !item.value;
|
item.value = !item.value;
|
||||||
|
|
||||||
if (item.onchange)
|
if (item.onchange)
|
||||||
item.onchange(item.value as boolean);
|
item.onchange(item.value as boolean, evt);
|
||||||
}
|
}
|
||||||
l.draw();
|
l.draw();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
move: (dir: number) => {
|
move: (dir: number, evt: TouchCallbackXY | undefined) => {
|
||||||
const item = selectEdit;
|
const item = selectEdit;
|
||||||
|
|
||||||
if (typeof item === "object" && typeof item.value === "number") {
|
if (typeof item === "object" && typeof item.value === "number") {
|
||||||
|
|
@ -209,14 +209,14 @@ E.showMenu = (items?: Menu): MenuInstance => {
|
||||||
|
|
||||||
if (item.value !== orig) {
|
if (item.value !== orig) {
|
||||||
if (item.onchange)
|
if (item.onchange)
|
||||||
item.onchange(item.value);
|
item.onchange(item.value, evt);
|
||||||
|
|
||||||
l.draw(selected, selected);
|
l.draw(selected, selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const lastSelected = selected;
|
const lastSelected = selected;
|
||||||
if (S.wrapAround) {
|
if (prosettings.wrapAround) {
|
||||||
selected = (selected + dir + /*keep +ve*/menuItems.length) % menuItems.length;
|
selected = (selected + dir + /*keep +ve*/menuItems.length) % menuItems.length;
|
||||||
} else {
|
} else {
|
||||||
selected = E.clip(selected + dir, 0, menuItems.length - 1);
|
selected = E.clip(selected + dir, 0, menuItems.length - 1);
|
||||||
|
|
@ -247,6 +247,11 @@ E.showMenu = (items?: Menu): MenuInstance => {
|
||||||
Bangle.on('swipe', onSwipe);
|
Bangle.on('swipe', onSwipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cb = (dir?: 1 | -1, evt?: TouchCallbackXY) => {
|
||||||
|
if (dir) l.move(prosettings.naturalScroll ? -dir : dir, evt);
|
||||||
|
else l.select(evt);
|
||||||
|
};
|
||||||
|
|
||||||
Bangle.setUI({
|
Bangle.setUI({
|
||||||
mode: "updown",
|
mode: "updown",
|
||||||
back,
|
back,
|
||||||
|
|
@ -255,11 +260,13 @@ E.showMenu = (items?: Menu): MenuInstance => {
|
||||||
Bangle.removeListener("swipe", onSwipe);
|
Bangle.removeListener("swipe", onSwipe);
|
||||||
options.remove?.();
|
options.remove?.();
|
||||||
},
|
},
|
||||||
} as SetUIArg<"updown">,
|
touch: ((_button, xy) => {
|
||||||
dir => {
|
// since we've specified options.touch,
|
||||||
if (dir) l.move(S.naturalScroll ? -dir : dir);
|
// we need to pass through all taps since the default
|
||||||
else l.select();
|
// touchHandler isn't installed in setUI
|
||||||
});
|
cb(void 0, xy);
|
||||||
|
}) satisfies TouchCallback,
|
||||||
|
} as SetUIArg<"updown">, cb);
|
||||||
|
|
||||||
return l;
|
return l;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "promenu",
|
"id": "promenu",
|
||||||
"name": "Pro Menu",
|
"name": "Pro Menu",
|
||||||
"version": "0.12",
|
"version": "0.14",
|
||||||
"description": "Replace the built in menu function. Supports Bangle.js 1 and Bangle.js 2.",
|
"description": "Replace the built in menu function. Supports Bangle.js 1 and Bangle.js 2.",
|
||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
"type": "bootloader",
|
"type": "bootloader",
|
||||||
|
|
|
||||||
|
|
@ -4,3 +4,4 @@
|
||||||
0.04: Allow scanning of QR codes from camera or file
|
0.04: Allow scanning of QR codes from camera or file
|
||||||
0.05: Change brightness on touch
|
0.05: Change brightness on touch
|
||||||
0.06: Add ability to generate contact info (MeCard format) QR code
|
0.06: Add ability to generate contact info (MeCard format) QR code
|
||||||
|
0.07: Add custom appname (for storing multiple QR codes)
|
||||||
|
|
|
||||||
|
|
@ -101,8 +101,9 @@
|
||||||
<option value="2">H - High - 30%</option>
|
<option value="2">H - High - 30%</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<p>Click <button id="upload" class="btn btn-primary">Upload</button></p>
|
<label for="appname">App name</label>
|
||||||
|
<input type="text" id="appname" class="form-input" value="qrcode">
|
||||||
|
<button id="upload" class="btn btn-primary">Upload</button>
|
||||||
|
|
||||||
<script src="../../core/lib/customize.js"></script>
|
<script src="../../core/lib/customize.js"></script>
|
||||||
<script src="../../core/lib/qrcode.min.js"></script><!-- https://davidshimjs.github.io/qrcodejs/ -->
|
<script src="../../core/lib/qrcode.min.js"></script><!-- https://davidshimjs.github.io/qrcodejs/ -->
|
||||||
|
|
@ -263,8 +264,6 @@
|
||||||
qrText = document.getElementById("text").value;
|
qrText = document.getElementById("text").value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.info("Given qrtext was: " + qrText);
|
console.info("Given qrtext was: " + qrText);
|
||||||
qrcode._htOption.text = qrText;
|
qrcode._htOption.text = qrText;
|
||||||
qrcode._htOption.correctLevel = parseInt(document.getElementById("correction").value);
|
qrcode._htOption.correctLevel = parseInt(document.getElementById("correction").value);
|
||||||
|
|
@ -273,6 +272,7 @@
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
document.getElementById("errors").innerText="Error: QR could not be created.";
|
document.getElementById("errors").innerText="Error: QR could not be created.";
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
targetSize = Math.min(deviceWidth - border, deviceHeight - border);
|
targetSize = Math.min(deviceWidth - border, deviceHeight - border);
|
||||||
|
|
@ -303,6 +303,7 @@
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
document.getElementById("errors").innerText="Error: QR could not be created.";
|
document.getElementById("errors").innerText="Error: QR could not be created.";
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -336,12 +337,13 @@
|
||||||
document.getElementById("useWIFI").addEventListener("change",refreshQRCode);
|
document.getElementById("useWIFI").addEventListener("change",refreshQRCode);
|
||||||
document.getElementById("preventIntegerScaling").addEventListener("change",refreshQRCode);
|
document.getElementById("preventIntegerScaling").addEventListener("change",refreshQRCode);
|
||||||
document.getElementById("correction").addEventListener("change",refreshQRCode);
|
document.getElementById("correction").addEventListener("change",refreshQRCode);
|
||||||
|
|
||||||
document.getElementById("upload").addEventListener("click", function() {
|
document.getElementById("upload").addEventListener("click", function() {
|
||||||
var content = document.getElementById("text").value;
|
var content = document.getElementById("text").value;
|
||||||
if(document.getElementById("useWIFI").checked){
|
if(document.getElementById("useWIFI").checked){
|
||||||
content = document.getElementById("ssid").value
|
content = document.getElementById("ssid").value
|
||||||
}
|
}
|
||||||
if(!(document.getElementById("description").value === "")){
|
if(document.getElementById("description").value !== ""){
|
||||||
content = document.getElementById("description").value;
|
content = document.getElementById("description").value;
|
||||||
}
|
}
|
||||||
var img = imageconverter.canvastoString(document.getElementsByTagName("canvas")[0],{mode:"1bit",output:"string",compression:true});
|
var img = imageconverter.canvastoString(document.getElementsByTagName("canvas")[0],{mode:"1bit",output:"string",compression:true});
|
||||||
|
|
@ -365,8 +367,10 @@ g.drawString(content,g.getWidth()/2,g.getHeight()-(g.getHeight()-img[1])/4);
|
||||||
`}
|
`}
|
||||||
g.setColor(1,1,1);
|
g.setColor(1,1,1);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
var appname = document.getElementById("appname").value.trim() || "qrcode";
|
||||||
sendCustomizedApp({
|
sendCustomizedApp({
|
||||||
storage:[{name:"qrcode.app.js", url:"app.js", content:app},]
|
storage:[{name:`${appname}.app.js`, url:"app.js", content:app}]
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "qrcode",
|
"id": "qrcode",
|
||||||
"name": "Custom QR Code",
|
"name": "Custom QR Code",
|
||||||
"shortName": "QR Code",
|
"shortName": "QR Code",
|
||||||
"version": "0.06",
|
"version": "0.07",
|
||||||
"description": "Use this to upload a customised QR code to Bangle.js",
|
"description": "Use this to upload a customised QR code to Bangle.js",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"tags": "qrcode",
|
"tags": "qrcode",
|
||||||
|
|
|
||||||
|
|
@ -32,3 +32,4 @@
|
||||||
0.29: Improve clkinfo startup time by 10ms
|
0.29: Improve clkinfo startup time by 10ms
|
||||||
0.30: Fix possible bug in toggling an alarm to on, from clkinfo
|
0.30: Fix possible bug in toggling an alarm to on, from clkinfo
|
||||||
0.31: Ensure we reschedule alarms after setTimeZone has been called (fix #3791)
|
0.31: Ensure we reschedule alarms after setTimeZone has been called (fix #3791)
|
||||||
|
0.32: clkinfo ensures an alarm won't trigger immediately (copying `alarm`'s behaviour)
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,9 @@ exports.resetTimer = function(alarm, time) {
|
||||||
time = time || new Date();
|
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);
|
||||||
alarm.t = (currentTime + alarm.timer) % 86400000;
|
alarm.t = (currentTime + alarm.timer) % 86400000;
|
||||||
|
alarm.last = "timer" in alarm || alarm.t >= require("time_utils").getCurrentTimeMillis()
|
||||||
|
? 0
|
||||||
|
: new Date().getDate();
|
||||||
};
|
};
|
||||||
/// Get time until the given alarm (object). Return undefined if alarm not enabled, or if 86400000 or more, alarm could be *more* than a day in the future
|
/// Get time until the given alarm (object). Return undefined if alarm not enabled, or if 86400000 or more, alarm could be *more* than a day in the future
|
||||||
exports.getTimeToAlarm = function(alarm, time) {
|
exports.getTimeToAlarm = function(alarm, time) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "sched",
|
"id": "sched",
|
||||||
"name": "Scheduler",
|
"name": "Scheduler",
|
||||||
"version": "0.31",
|
"version": "0.32",
|
||||||
"description": "Scheduling library for alarms and timers",
|
"description": "Scheduling library for alarms and timers",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"type": "scheduler",
|
"type": "scheduler",
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
0.01: New App!
|
0.01: New App!
|
||||||
0.02: Minor code improvements
|
0.02: Minor code improvements
|
||||||
0.03: Bug fixes and some usability and performance improvements
|
0.03: Bug fixes and some usability and performance improvements
|
||||||
|
0.04: Add squash preset, simplify logic, fix compatibility with BangleJS 2
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,7 @@ In this mode any score increments will be decrements. To move back a set, reduce
|
||||||
| `Sets per page` | How many sets should be shown in the app. Further sets will be available by scrolling (ignored if higher than `Sets to win`) |
|
| `Sets per page` | How many sets should be shown in the app. Further sets will be available by scrolling (ignored if higher than `Sets to win`) |
|
||||||
| `Score to win` | What score ends a given set |
|
| `Score to win` | What score ends a given set |
|
||||||
| `2-point lead` | Does winning a set require a two-point lead |
|
| `2-point lead` | Does winning a set require a two-point lead |
|
||||||
| `Maximum score?` | Should there be a maximum score, at which point the two-point lead rule falls away |
|
| `Maximum score` | Should there be a maximum score, at which point the two-point lead rule falls away (ignored if lower than Sets to win) |
|
||||||
| `Maximum score` | At which score should the two-point lead rule fall away (ignored if lower than Sets to win) |
|
|
||||||
| `Tennis scoring` | If enabled, each point in a set will require a full tennis game |
|
| `Tennis scoring` | If enabled, each point in a set will require a full tennis game |
|
||||||
| `TB sets?` | Should sets that have reached `(maxScore-1):(maxScore-1)` be decided with a tiebreak |
|
| `TB sets?` | Should sets that have reached `(maxScore-1):(maxScore-1)` be decided with a tiebreak |
|
||||||
| All other options starting with TB | Equivalent to option with same name but applied to tiebreaks |
|
| All other options starting with TB | Equivalent to option with same name but applied to tiebreaks |
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "score",
|
"id": "score",
|
||||||
"name": "Score Tracker",
|
"name": "Score Tracker",
|
||||||
"version": "0.03",
|
"version": "0.04",
|
||||||
"description": "Score Tracker for sports that use plain numbers (e.g. Badminton, Volleyball, Soccer, Table Tennis, ...). Also supports tennis scoring.",
|
"description": "Score Tracker for sports that use plain numbers (e.g. Badminton, Volleyball, Soccer, Table Tennis, ...). Also supports tennis scoring.",
|
||||||
"icon": "score.app.png",
|
"icon": "score.app.png",
|
||||||
"screenshots": [{"url":"screenshot_score.png"}],
|
"screenshots": [{"url":"screenshot_score.png"}],
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,12 @@ require('Font5x9Numeric7Seg').add(Graphics);
|
||||||
require('Font7x11Numeric7Seg').add(Graphics);
|
require('Font7x11Numeric7Seg').add(Graphics);
|
||||||
require('FontTeletext5x9Ascii').add(Graphics);
|
require('FontTeletext5x9Ascii').add(Graphics);
|
||||||
|
|
||||||
|
const KEY_SCORE_L = 0;
|
||||||
|
const KEY_SCORE_R = 1;
|
||||||
|
const KEY_MENU = 2;
|
||||||
|
const KEY_TENNIS_H = 3;
|
||||||
|
const KEY_TENNIS_L = 4;
|
||||||
|
|
||||||
let settingsMenu = eval(require('Storage').read('score.settings.js'));
|
let settingsMenu = eval(require('Storage').read('score.settings.js'));
|
||||||
let settings = settingsMenu(null, null, true);
|
let settings = settingsMenu(null, null, true);
|
||||||
|
|
||||||
|
|
@ -44,39 +50,49 @@ function setupDisplay() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupInputWatchers(init) {
|
function setupInputWatchers(init) {
|
||||||
Bangle.setUI('updown', v => {
|
Bangle.setUI('updown',
|
||||||
|
isBangle1
|
||||||
|
? (v => {
|
||||||
if (v) {
|
if (v) {
|
||||||
if (isBangle1) {
|
|
||||||
let i = settings.mirrorScoreButtons ? v : v * -1;
|
let i = settings.mirrorScoreButtons ? v : v * -1;
|
||||||
handleInput(Math.floor((i+2)/2));
|
handleInput(Math.floor((i+2)/2));
|
||||||
} else {
|
}
|
||||||
|
})
|
||||||
|
: (v => {
|
||||||
|
if (v) {
|
||||||
|
// +1 -> 4
|
||||||
|
// -1 -> 3
|
||||||
handleInput(Math.floor((v+2)/2)+3);
|
handleInput(Math.floor((v+2)/2)+3);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
);
|
||||||
if (init) {
|
if (init) {
|
||||||
if (isBangle1) {
|
setWatch(
|
||||||
setWatch(() => handleInput(2), BTN2, { repeat: true });
|
() => handleInput(KEY_MENU),
|
||||||
}
|
isBangle1 ? BTN2 : BTN,
|
||||||
Bangle.on('touch', (b, e) => {
|
{ repeat: true },
|
||||||
if (isBangle1) {
|
);
|
||||||
|
Bangle.on('touch',
|
||||||
|
isBangle1
|
||||||
|
? ((b, e) => {
|
||||||
if (b === 1) {
|
if (b === 1) {
|
||||||
handleInput(3);
|
handleInput(KEY_TENNIS_H);
|
||||||
} else {
|
} else {
|
||||||
handleInput(4);
|
handleInput(KEY_TENNIS_L);
|
||||||
}
|
}
|
||||||
} else {
|
})
|
||||||
|
: ((b, e) => {
|
||||||
if (e.y > 18) {
|
if (e.y > 18) {
|
||||||
if (e.x < getXCoord(w => w/2)) {
|
if (e.x < getXCoord(w => w/2)) {
|
||||||
handleInput(0);
|
handleInput(KEY_SCORE_L);
|
||||||
} else {
|
} else {
|
||||||
handleInput(1);
|
handleInput(KEY_SCORE_R);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// long press except if we have the menu opened or we are in the emulator (that doesn't
|
// long press except if we have the menu opened or we are in the emulator (that doesn't
|
||||||
// seem to support long press events)
|
// seem to support long press events)
|
||||||
if (e.type === 2 || settingsMenuOpened || process.env.BOARD === 'EMSCRIPTEN2') {
|
if (e.type === 2 || settingsMenuOpened || process.env.BOARD === 'EMSCRIPTEN2') {
|
||||||
handleInput(2);
|
handleInput(KEY_MENU);
|
||||||
} else {
|
} else {
|
||||||
let p = null;
|
let p = null;
|
||||||
|
|
||||||
|
|
@ -97,8 +113,8 @@ function setupInputWatchers(init) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,14 +153,13 @@ function showSettingsMenu() {
|
||||||
if (reset) {
|
if (reset) {
|
||||||
setupMatch();
|
setupMatch();
|
||||||
}
|
}
|
||||||
if (isBangle1 || (!isBangle1 && back)) {
|
|
||||||
settingsMenuOpened = null;
|
settingsMenuOpened = null;
|
||||||
|
|
||||||
draw();
|
draw();
|
||||||
|
|
||||||
setupDisplay();
|
setupDisplay();
|
||||||
setupInputWatchers();
|
setupInputWatchers();
|
||||||
}
|
|
||||||
}, function (msg) {
|
}, function (msg) {
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case 'end_set':
|
case 'end_set':
|
||||||
|
|
@ -344,7 +359,7 @@ function handleInput(button) {
|
||||||
// console.log('button:', button);
|
// console.log('button:', button);
|
||||||
if (settingsMenuOpened) {
|
if (settingsMenuOpened) {
|
||||||
|
|
||||||
if (!isBangle1 && button == 2) {
|
if (!isBangle1 && button == KEY_MENU) { // Bangle2 long press, hide menu
|
||||||
E.showMenu();
|
E.showMenu();
|
||||||
|
|
||||||
settingsMenuOpened = null;
|
settingsMenuOpened = null;
|
||||||
|
|
@ -359,15 +374,15 @@ function handleInput(button) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case 0:
|
case KEY_SCORE_L:
|
||||||
case 1:
|
case KEY_SCORE_R:
|
||||||
score(button);
|
score(button);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case KEY_MENU:
|
||||||
showSettingsMenu();
|
showSettingsMenu();
|
||||||
return;
|
return;
|
||||||
case 3:
|
case KEY_TENNIS_H:
|
||||||
case 4: {
|
case KEY_TENNIS_L: {
|
||||||
let hLimit = currentSet() - setsPerPage() + 1;
|
let hLimit = currentSet() - setsPerPage() + 1;
|
||||||
let lLimit = 0;
|
let lLimit = 0;
|
||||||
let val = (button * 2 - 7);
|
let val = (button * 2 - 7);
|
||||||
|
|
@ -382,8 +397,7 @@ function handleInput(button) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function draw() {
|
function draw() {
|
||||||
g.setFontAlign(0,0);
|
g.reset().setFontAlign(0,0).clear();
|
||||||
g.clear();
|
|
||||||
|
|
||||||
for (let p = 0; p < 2; p++) {
|
for (let p = 0; p < 2; p++) {
|
||||||
if (matchWon(p)) {
|
if (matchWon(p)) {
|
||||||
|
|
|
||||||
|
|
@ -26,5 +26,10 @@
|
||||||
"winScore": 11,
|
"winScore": 11,
|
||||||
"enableTwoAhead": true,
|
"enableTwoAhead": true,
|
||||||
"enableMaxScore": false
|
"enableMaxScore": false
|
||||||
|
},
|
||||||
|
"Squash": {
|
||||||
|
"winScore": 9,
|
||||||
|
"enableTwoAhead": true,
|
||||||
|
"enableMaxScore": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,52 +1,28 @@
|
||||||
(function () {
|
(function (back, inApp, ret) {
|
||||||
return (function (back, inApp, ret) {
|
|
||||||
const isBangle1 = process.env.BOARD === 'BANGLEJS'
|
const isBangle1 = process.env.BOARD === 'BANGLEJS'
|
||||||
|
|
||||||
function fillSettingsWithDefaults(settings) {
|
function fillSettingsWithDefaults(settings) {
|
||||||
if (isBangle1) {
|
settings = Object.assign({
|
||||||
if (settings.mirrorScoreButtons == null) {
|
winSets: 2,
|
||||||
settings.mirrorScoreButtons = false;
|
setsPerPage: 5,
|
||||||
}
|
winScore: 21,
|
||||||
if (settings.keepDisplayOn == null) {
|
enableTwoAhead: true,
|
||||||
settings.keepDisplayOn = true;
|
enableMaxScore: true,
|
||||||
}
|
maxScore: 30,
|
||||||
}
|
enableTennisScoring: false,
|
||||||
if (settings.winSets == null) {
|
|
||||||
settings.winSets = 2;
|
|
||||||
}
|
|
||||||
if (settings.setsPerPage == null) {
|
|
||||||
settings.setsPerPage = 5;
|
|
||||||
}
|
|
||||||
if (settings.winScore == null) {
|
|
||||||
settings.winScore = 21;
|
|
||||||
}
|
|
||||||
if (settings.enableTwoAhead == null) {
|
|
||||||
settings.enableTwoAhead = true;
|
|
||||||
}
|
|
||||||
if (settings.enableMaxScore == null) {
|
|
||||||
settings.enableMaxScore = true;
|
|
||||||
}
|
|
||||||
if (settings.maxScore == null) {
|
|
||||||
settings.maxScore = 30;
|
|
||||||
}
|
|
||||||
if (settings.enableTennisScoring == null) {
|
|
||||||
settings.enableTennisScoring = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (settings.enableMaxScoreTiebreak == null) {
|
enableMaxScoreTiebreak: false,
|
||||||
settings.enableMaxScoreTiebreak = false;
|
maxScoreTiebreakWinScore: 6,
|
||||||
}
|
maxScoreTiebreakEnableTwoAhead: true,
|
||||||
if (settings.maxScoreTiebreakWinScore == null) {
|
maxScoreTiebreakEnableMaxScore: false,
|
||||||
settings.maxScoreTiebreakWinScore = 6;
|
maxScoreTiebreakMaxScore: 15,
|
||||||
}
|
}, settings);
|
||||||
if (settings.maxScoreTiebreakEnableTwoAhead == null) {
|
|
||||||
settings.maxScoreTiebreakEnableTwoAhead = true;
|
if (isBangle1) {
|
||||||
}
|
settings = Object.assign({
|
||||||
if (settings.maxScoreTiebreakEnableMaxScore == null) {
|
mirrorScoreButtons: false,
|
||||||
settings.maxScoreTiebreakEnableMaxScore = false;
|
keepDisplayOn: true,
|
||||||
}
|
}, settings);
|
||||||
if (settings.maxScoreTiebreakMaxScore == null) {
|
|
||||||
settings.maxScoreTiebreakMaxScore = 15;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return settings;
|
return settings;
|
||||||
|
|
@ -198,10 +174,10 @@
|
||||||
const inAppMenu = function () {
|
const inAppMenu = function () {
|
||||||
let m = {
|
let m = {
|
||||||
'': {'title': 'Score Menu'},
|
'': {'title': 'Score Menu'},
|
||||||
'< Back': function () { back(settings, changed, false); },
|
'< Back': function () { back(settings, changed); },
|
||||||
'Correct mode': function () { inApp('correct_mode'); back(settings, false, true); },
|
'Correct mode': function () { inApp('correct_mode'); back(settings, false); },
|
||||||
'Reset match': function () { back(settings, true, true); },
|
'Reset match': function () { back(settings, true); },
|
||||||
'End current set': function () { inApp('end_set'); back(settings, changed, true); },
|
'End current set': function () { inApp('end_set'); back(settings, changed); },
|
||||||
'Configuration': function () { E.showMenu(appMenu(function () {
|
'Configuration': function () { E.showMenu(appMenu(function () {
|
||||||
E.showMenu(inAppMenu());
|
E.showMenu(inAppMenu());
|
||||||
})); },
|
})); },
|
||||||
|
|
@ -215,6 +191,4 @@
|
||||||
} else {
|
} else {
|
||||||
E.showMenu(appMenu(back));
|
E.showMenu(appMenu(back));
|
||||||
}
|
}
|
||||||
|
})
|
||||||
});
|
|
||||||
})()
|
|
||||||
|
|
|
||||||
|
|
@ -86,3 +86,4 @@ of 'Select Clock'
|
||||||
0.75: Restore previous menu's scroll positions
|
0.75: Restore previous menu's scroll positions
|
||||||
0.76: Add altitude calibration menu (and update README after menu changed)
|
0.76: Add altitude calibration menu (and update README after menu changed)
|
||||||
0.77: Save altitude calibration when user exits via reset
|
0.77: Save altitude calibration when user exits via reset
|
||||||
|
0.78: Fix menu scroll restore on BangleJS1
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "setting",
|
"id": "setting",
|
||||||
"name": "Settings",
|
"name": "Settings",
|
||||||
"version": "0.77",
|
"version": "0.78",
|
||||||
"description": "A menu for setting up Bangle.js",
|
"description": "A menu for setting up Bangle.js",
|
||||||
"icon": "settings.png",
|
"icon": "settings.png",
|
||||||
"tags": "tool,system",
|
"tags": "tool,system",
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ function pushMenu(menu) {
|
||||||
function restoreMenu(menu) {
|
function restoreMenu(menu) {
|
||||||
// equivalent to pushMenu(null); popMenu(menu);
|
// equivalent to pushMenu(null); popMenu(menu);
|
||||||
if(!menu[""]) menu[""] = {};
|
if(!menu[""]) menu[""] = {};
|
||||||
|
if(menuScroller) // may be undefined on BangleJS1
|
||||||
menu[""].scroll = menuScroller.scroll;
|
menu[""].scroll = menuScroller.scroll;
|
||||||
menuScroller = E.showMenu(menu).scroller;
|
menuScroller = E.showMenu(menu).scroller;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
0.01: New app!
|
0.01: New app!
|
||||||
0.02: Minor code improvements
|
0.02: Minor code improvements
|
||||||
0.03: Minor code improvements
|
0.03: Minor code improvements
|
||||||
|
0.04: Remove buffer finding code (which fails if screen rotated) and make dependent on fw 2v21's Bangle.getOptions().lcdBufferPtr (fix #3818)
|
||||||
|
|
@ -618,10 +618,7 @@ var fontNum = atob("AAAAAAAAAAAAAA//8D//g//8P/+I//8//44//w//j4//A/+P4/8A/4/4AAAA
|
||||||
const sintable = new Uint8Array(256);
|
const sintable = new Uint8Array(256);
|
||||||
let bgColor = 0;
|
let bgColor = 0;
|
||||||
const BLACK = g.setColor.bind(g, 0);
|
const BLACK = g.setColor.bind(g, 0);
|
||||||
const WHITE = g.setColor.bind(g, 0xFFFF);
|
let lcdBuffer = 0;
|
||||||
let lcdBuffer = 0,
|
|
||||||
start = 0;
|
|
||||||
|
|
||||||
let locked = false;
|
let locked = false;
|
||||||
let charging = false;
|
let charging = false;
|
||||||
let stopped = true;
|
let stopped = true;
|
||||||
|
|
@ -641,75 +638,6 @@ function setupInterval(force) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function test(addr, y) {
|
|
||||||
BLACK().fillRect(0, y, 176, y);
|
|
||||||
if (peek8(addr)) return false;
|
|
||||||
WHITE().fillRect(0, y, 176, y);
|
|
||||||
let b = peek8(addr);
|
|
||||||
BLACK().fillRect(0, y, 176, y);
|
|
||||||
if (!b) return false;
|
|
||||||
return !peek8(addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
function probe() {
|
|
||||||
if (!start) {
|
|
||||||
start = 0x20000000;
|
|
||||||
if (test(Bangle.getOptions().lcdBufferPtr, 0))
|
|
||||||
start = Bangle.getOptions().lcdBufferPtr; // FW=2v21
|
|
||||||
else if (test(0x2002d3fe, 0)) // try to skip loading if possible
|
|
||||||
start = 0x2002d3fe; // FW=2v20
|
|
||||||
}
|
|
||||||
const end = Math.min(start + 0x800, 0x20038000);
|
|
||||||
|
|
||||||
if (start >= end) {
|
|
||||||
print("Could not find framebuffer");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BLACK().fillRect(0, 0, 176, 0);
|
|
||||||
// sampling every 64 bytes since a 176-pixel row is 66 bytes at 3bpp
|
|
||||||
for (; start < end; start += 64) {
|
|
||||||
if (peek8(start)) continue;
|
|
||||||
WHITE().fillRect(0, 0, 176, 0);
|
|
||||||
let b = peek8(start);
|
|
||||||
BLACK().fillRect(0, 0, 176, 0);
|
|
||||||
if (!b) continue;
|
|
||||||
if (!peek8(start)) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (start >= end) {
|
|
||||||
setTimeout(probe, 1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find the beginning of the row
|
|
||||||
while (test(start - 1, 0))
|
|
||||||
start--;
|
|
||||||
|
|
||||||
/*
|
|
||||||
let stride = (176 * 3 + 7) >> 3,
|
|
||||||
padding = 0;
|
|
||||||
for (let i = 0; i < 20; ++i, ++padding) {
|
|
||||||
if (test(start + stride + padding, 1)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stride += padding;
|
|
||||||
if (padding == 20) {
|
|
||||||
print("Warning: Could not calculate padding");
|
|
||||||
stride = 68;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
let stride = 68;
|
|
||||||
|
|
||||||
lcdBuffer = start;
|
|
||||||
print('Found lcdBuffer at ' + lcdBuffer.toString(16) + ' stride=' + stride);
|
|
||||||
gfx.init(start, stride, E.getAddressOf(sintable, true));
|
|
||||||
gfx.setCamera(0, 0, 0);
|
|
||||||
setupInterval(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
require("Font5x9Numeric7Seg").add(Graphics);
|
require("Font5x9Numeric7Seg").add(Graphics);
|
||||||
g.setFont("5x9Numeric7Seg");
|
g.setFont("5x9Numeric7Seg");
|
||||||
|
|
@ -723,7 +651,23 @@ function init() {
|
||||||
// setup sin/cos table
|
// setup sin/cos table
|
||||||
for (let i = 0; i < sintable.length; ++i)
|
for (let i = 0; i < sintable.length; ++i)
|
||||||
sintable[i] = Math.sin((i * Math.PI * 0.5) / sintable.length) * ((1 << 8) - 1);
|
sintable[i] = Math.sin((i * Math.PI * 0.5) / sintable.length) * ((1 << 8) - 1);
|
||||||
setTimeout(probe, 1);
|
|
||||||
|
lcdBuffer = Bangle.getOptions().lcdBufferPtr;
|
||||||
|
if (!lcdBuffer) {
|
||||||
|
E.showMessage("Needs firmwave 2v21 or newer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let stride = 68;
|
||||||
|
//print('Found lcdBuffer at ' + lcdBuffer.toString(16) + ' stride=' + stride);
|
||||||
|
var sintablePtr = E.getAddressOf(sintable, true);
|
||||||
|
if (!sintablePtr) {
|
||||||
|
lcdBuffer = 0;
|
||||||
|
E.showMessage("Not enough memory");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
gfx.init(lcdBuffer, stride, sintablePtr);
|
||||||
|
gfx.setCamera(0, 0, 0);
|
||||||
|
setupInterval(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tick(locked) {
|
function tick(locked) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "synthwave",
|
"id": "synthwave",
|
||||||
"name": "synthwave clock",
|
"name": "synthwave clock",
|
||||||
"version": "0.03",
|
"version": "0.04",
|
||||||
"description": "A watchface with an animated 3D scene.",
|
"description": "A watchface with an animated 3D scene.",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
0.01: New app!
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
# Tally
|
||||||
|
|
||||||
|
An app that lets you keep a tally - when events happen, etc.
|
||||||
|
|
||||||
|
Use the clock info to add to the tally. The app can be used to review/edit/delete tallies
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Navigate to the tally clock info, then swipe up/down to select one of the tallies to enter. Tap on it to add to the tally.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
require("heatshrink").decompress(atob("mEwwInkgf/AAXAg4FD8EPAofwAowcDAqkD4AFW4fAAqYEBAtp3XTZStFXIsAh/gD4cPBAIFDwAFEbAkOAokMAokIApQAKA=="))
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
var storage = require("Storage");
|
||||||
|
function readTallies() {
|
||||||
|
var tallies = [];
|
||||||
|
var f = storage.open("tallies.csv", "r");
|
||||||
|
var line;
|
||||||
|
while ((line = f.readLine()) !== undefined) {
|
||||||
|
var parts = line.replace("\n", "").split(",");
|
||||||
|
tallies.push({ date: new Date(parts[0]), name: parts[1] });
|
||||||
|
}
|
||||||
|
return tallies;
|
||||||
|
}
|
||||||
|
function saveTallies(tallies) {
|
||||||
|
var f = storage.open("tallies.csv", "w");
|
||||||
|
for (var _i = 0, tallies_1 = tallies; _i < tallies_1.length; _i++) {
|
||||||
|
var tally = tallies_1[_i];
|
||||||
|
f.write([tally.date.toISOString(), tally.name].join(",") + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var dayEq = function (a, b) {
|
||||||
|
return a.getFullYear() === b.getFullYear()
|
||||||
|
&& a.getMonth() === b.getMonth()
|
||||||
|
&& a.getDate() === b.getDate();
|
||||||
|
};
|
||||||
|
function showTallies(tallies) {
|
||||||
|
var menu = {
|
||||||
|
"": { title: "Tallies" },
|
||||||
|
"< Back": function () { return load(); },
|
||||||
|
};
|
||||||
|
var today = new Date;
|
||||||
|
var day;
|
||||||
|
tallies.forEach(function (tally, i) {
|
||||||
|
var td = tally.date;
|
||||||
|
if (!dayEq(day !== null && day !== void 0 ? day : today, td)) {
|
||||||
|
var s = "".concat(td.getFullYear(), "-").concat(pad2(td.getMonth() + 1), "-").concat(pad2(td.getDate()));
|
||||||
|
menu[s] = function () { };
|
||||||
|
day = td;
|
||||||
|
}
|
||||||
|
menu["".concat(tfmt(tally), ": ").concat(tally.name)] = function () { return editTally(tallies, i); };
|
||||||
|
});
|
||||||
|
E.showMenu(menu);
|
||||||
|
}
|
||||||
|
function editTally(tallies, i) {
|
||||||
|
var tally = tallies[i];
|
||||||
|
var onback = function () {
|
||||||
|
saveTallies(tallies);
|
||||||
|
E.removeListener("kill", onback);
|
||||||
|
};
|
||||||
|
E.on("kill", onback);
|
||||||
|
var menu = {
|
||||||
|
"": { title: "Edit ".concat(tally.name) },
|
||||||
|
"< Back": function () {
|
||||||
|
onback();
|
||||||
|
showTallies(tallies);
|
||||||
|
},
|
||||||
|
"Name": {
|
||||||
|
value: tally.name,
|
||||||
|
onchange: function () {
|
||||||
|
setTimeout(function () {
|
||||||
|
require("textinput")
|
||||||
|
.input({ text: tally.name })
|
||||||
|
.then(function (text) {
|
||||||
|
if (text) {
|
||||||
|
tally.name = text;
|
||||||
|
}
|
||||||
|
editTally(tallies, i);
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"Time": {
|
||||||
|
value: tally.date.getTime(),
|
||||||
|
format: function (_tm) { return tfmt(tally); },
|
||||||
|
onchange: function (v) {
|
||||||
|
tally.date = new Date(v);
|
||||||
|
},
|
||||||
|
step: 60000,
|
||||||
|
},
|
||||||
|
"Delete": function () {
|
||||||
|
E.showPrompt("Delete \"".concat(tally.name, "\"?"), {
|
||||||
|
title: "Delete",
|
||||||
|
buttons: { Yes: true, No: false },
|
||||||
|
}).then(function (confirm) {
|
||||||
|
if (confirm) {
|
||||||
|
tallies.splice(i, 1);
|
||||||
|
saveTallies(tallies);
|
||||||
|
showTallies(tallies);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
editTally(tallies, i);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
E.showMenu(menu);
|
||||||
|
}
|
||||||
|
function tfmt(tally) {
|
||||||
|
var d = tally.date;
|
||||||
|
return "".concat(d.getHours(), ":").concat(pad2(d.getMinutes()));
|
||||||
|
}
|
||||||
|
var pad2 = function (s) { return ("0" + s.toFixed(0)).slice(-2); };
|
||||||
|
showTallies(readTallies());
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 296 B |
|
|
@ -0,0 +1,120 @@
|
||||||
|
const storage = require("Storage");
|
||||||
|
|
||||||
|
type Tally = {
|
||||||
|
date: Date,
|
||||||
|
name: string,
|
||||||
|
};
|
||||||
|
|
||||||
|
function readTallies() {
|
||||||
|
const tallies: Tally[] = [];
|
||||||
|
const f = storage.open("tallies.csv", "r");
|
||||||
|
let line;
|
||||||
|
while ((line = f.readLine()) !== undefined) {
|
||||||
|
const parts = line.replace("\n", "").split(",");
|
||||||
|
tallies.push({ date: new Date(parts[0]), name: parts[1] });
|
||||||
|
}
|
||||||
|
return tallies;
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveTallies(tallies: Tally[]) {
|
||||||
|
const f = storage.open("tallies.csv", "w");
|
||||||
|
for(const tally of tallies){
|
||||||
|
f.write([tally.date.toISOString(), tally.name].join(",") + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const dayEq = (a: Date, b: Date) =>
|
||||||
|
a.getFullYear() === b.getFullYear()
|
||||||
|
&& a.getMonth() === b.getMonth()
|
||||||
|
&& a.getDate() === b.getDate();
|
||||||
|
|
||||||
|
function showTallies(tallies: Tally[]) {
|
||||||
|
const menu: Menu = {
|
||||||
|
"": { title: "Tallies" },
|
||||||
|
"< Back": () => load(),
|
||||||
|
};
|
||||||
|
|
||||||
|
const today = new Date;
|
||||||
|
let day: undefined | Date;
|
||||||
|
|
||||||
|
tallies.forEach((tally, i) => {
|
||||||
|
const td = tally.date;
|
||||||
|
if(!dayEq(day ?? today, td)){
|
||||||
|
const s = `${td.getFullYear()}-${pad2(td.getMonth() + 1)}-${pad2(td.getDate())}`;
|
||||||
|
menu[s] = () => {};
|
||||||
|
day = td;
|
||||||
|
}
|
||||||
|
|
||||||
|
menu[`${tfmt(tally)}: ${tally.name}`] = () => editTally(tallies, i);
|
||||||
|
});
|
||||||
|
|
||||||
|
E.showMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
function editTally(tallies: Tally[], i: number) {
|
||||||
|
const tally = tallies[i]!;
|
||||||
|
|
||||||
|
const onback = () => {
|
||||||
|
saveTallies(tallies);
|
||||||
|
E.removeListener("kill", onback);
|
||||||
|
};
|
||||||
|
E.on("kill", onback);
|
||||||
|
|
||||||
|
const menu: Menu = {
|
||||||
|
"": { title: `Edit ${tally.name}` },
|
||||||
|
"< Back": () => {
|
||||||
|
onback();
|
||||||
|
showTallies(tallies)
|
||||||
|
},
|
||||||
|
"Name": {
|
||||||
|
value: tally.name,
|
||||||
|
onchange: () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
require("textinput")
|
||||||
|
.input({ text: tally.name })
|
||||||
|
.then(text => {
|
||||||
|
if (text) {
|
||||||
|
tally.name = text;
|
||||||
|
}
|
||||||
|
editTally(tallies, i);
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"Time": {
|
||||||
|
value: tally.date.getTime(),
|
||||||
|
format: (_tm: number) => tfmt(tally),
|
||||||
|
onchange: (v: number) => {
|
||||||
|
tally.date = new Date(v);
|
||||||
|
},
|
||||||
|
step: 60000, // 1 min
|
||||||
|
},
|
||||||
|
"Delete": () => {
|
||||||
|
E.showPrompt(`Delete "${tally.name}"?`, {
|
||||||
|
title: "Delete",
|
||||||
|
buttons: { Yes: true, No: false },
|
||||||
|
}).then(confirm => {
|
||||||
|
if (confirm) {
|
||||||
|
tallies.splice(i, 1);
|
||||||
|
saveTallies(tallies);
|
||||||
|
showTallies(tallies);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// need to regrab ui, can't `m.draw()`
|
||||||
|
editTally(tallies, i);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
E.showMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
function tfmt(tally: Tally) {
|
||||||
|
const d = tally.date;
|
||||||
|
return `${d.getHours()}:${pad2(d.getMinutes())}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pad2 = (s: number) => ("0" + s.toFixed(0)).slice(-2);
|
||||||
|
|
||||||
|
showTallies(readTallies());
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
(function () {
|
||||||
|
var storage = require("Storage");
|
||||||
|
var tallyEntries = storage.readJSON("tallycfg.json", 1) || [];
|
||||||
|
var img = atob("GBiBAAAAAAAAAAAAAB//+D///DAADDAADDAYDDAYDDAZjDAZjDGZjDGZjDGZjDGZjDAADDAADD///B//+APAAAMAAAIAAAAAAAAAAA==");
|
||||||
|
return {
|
||||||
|
name: "Tally",
|
||||||
|
img: img,
|
||||||
|
items: tallyEntries.map(function (ent) { return ({
|
||||||
|
name: ent.name,
|
||||||
|
img: img,
|
||||||
|
get: function () {
|
||||||
|
return { text: this.name, img: img };
|
||||||
|
},
|
||||||
|
run: function () {
|
||||||
|
var f = storage.open("tallies.csv", "a");
|
||||||
|
f.write([
|
||||||
|
new Date().toISOString(),
|
||||||
|
this.name,
|
||||||
|
].join(",") + "\n");
|
||||||
|
},
|
||||||
|
show: function () { },
|
||||||
|
hide: function () { },
|
||||||
|
}); }),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
(function() {
|
||||||
|
const storage = require("Storage");
|
||||||
|
const tallyEntries = storage.readJSON("tallycfg.json", 1) as TallySettings || [];
|
||||||
|
|
||||||
|
// transparent
|
||||||
|
const img = atob("GBiBAAAAAAAAAAAAAB//+D///DAADDAADDAYDDAYDDAZjDAZjDGZjDGZjDGZjDGZjDAADDAADD///B//+APAAAMAAAIAAAAAAAAAAA==")
|
||||||
|
// non-transparent
|
||||||
|
//const img = atob("GBgBAAAAAAAAAAAAH//4P//8MAAMMAAMMBgMMBgMMBmMMBmMMZmMMZmMMZmMMZmMMAAMMAAMP//8H//4A4AAAwAAAgAAAAAAAAAA")
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: "Tally",
|
||||||
|
img,
|
||||||
|
items: tallyEntries.map(ent => ({
|
||||||
|
name: ent.name,
|
||||||
|
img,
|
||||||
|
get: function() {
|
||||||
|
return { text: this.name, img };
|
||||||
|
},
|
||||||
|
run: function() {
|
||||||
|
const f = storage.open("tallies.csv", "a");
|
||||||
|
f.write([
|
||||||
|
new Date().toISOString(),
|
||||||
|
this.name,
|
||||||
|
].join(",") + "\n");
|
||||||
|
},
|
||||||
|
show: function(){},
|
||||||
|
hide: function(){},
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
}) satisfies ClockInfoFunc
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 760 B |
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"id": "tally",
|
||||||
|
"name": "Tally Keeper",
|
||||||
|
"shortName": "Tally",
|
||||||
|
"version": "0.01",
|
||||||
|
"description": "Add to a tally from clock info",
|
||||||
|
"icon": "app.png",
|
||||||
|
"tags": "clkinfo",
|
||||||
|
"supports": ["BANGLEJS2"],
|
||||||
|
"readme": "README.md",
|
||||||
|
"storage": [
|
||||||
|
{ "name": "tally.settings.js", "url": "settings.js" },
|
||||||
|
{ "name": "tally.img", "url": "app-icon.js", "evaluate": true },
|
||||||
|
{ "name": "tally.clkinfo.js", "url": "clkinfo.js" },
|
||||||
|
{ "name": "tally.app.js", "url": "app.js" }
|
||||||
|
],
|
||||||
|
"data": [
|
||||||
|
{ "name": "tallycfg.json" },
|
||||||
|
{ "name": "tallies.csv" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
(function (back) {
|
||||||
|
var storage = require("Storage");
|
||||||
|
var SETTINGS_FILE = "tallycfg.json";
|
||||||
|
var tallycfg = storage.readJSON(SETTINGS_FILE, 1) || [];
|
||||||
|
function saveSettings() {
|
||||||
|
storage.writeJSON(SETTINGS_FILE, tallycfg);
|
||||||
|
}
|
||||||
|
function showMainMenu() {
|
||||||
|
var menu = {
|
||||||
|
"": { "title": "Tally Configs" },
|
||||||
|
"< Back": back,
|
||||||
|
"Add New": function () { return showEditMenu(); },
|
||||||
|
};
|
||||||
|
tallycfg.forEach(function (tally, index) {
|
||||||
|
menu[tally.name] = function () { return showEditMenu(tally, index); };
|
||||||
|
});
|
||||||
|
E.showMenu(menu);
|
||||||
|
}
|
||||||
|
function showEditMenu(tally, index) {
|
||||||
|
var isNew = tally == null;
|
||||||
|
if (tally == null) {
|
||||||
|
tally = { name: "" };
|
||||||
|
index = tallycfg.length;
|
||||||
|
tallycfg.push(tally);
|
||||||
|
}
|
||||||
|
var menu = {
|
||||||
|
"": { "title": isNew ? "New Tally" : "Edit Tally" },
|
||||||
|
"< Back": function () {
|
||||||
|
saveSettings();
|
||||||
|
showMainMenu();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
menu[tally.name || "<set name>"] = function () {
|
||||||
|
require("textinput")
|
||||||
|
.input({ text: tally.name })
|
||||||
|
.then(function (text) {
|
||||||
|
tally.name = text;
|
||||||
|
showEditMenu(tally, index);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
if (!isNew) {
|
||||||
|
menu["Delete"] = function () {
|
||||||
|
tallycfg.splice(index, 1);
|
||||||
|
saveSettings();
|
||||||
|
showMainMenu();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
E.showMenu(menu);
|
||||||
|
}
|
||||||
|
showMainMenu();
|
||||||
|
})
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
type TallySettings = TallySetting[];
|
||||||
|
type TallySetting = { name: string };
|
||||||
|
|
||||||
|
(function(back) {
|
||||||
|
const storage = require("Storage");
|
||||||
|
const SETTINGS_FILE = "tallycfg.json";
|
||||||
|
|
||||||
|
const tallycfg = storage.readJSON(SETTINGS_FILE, 1) as TallySettings || [];
|
||||||
|
|
||||||
|
function saveSettings() {
|
||||||
|
storage.writeJSON(SETTINGS_FILE, tallycfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
function showMainMenu() {
|
||||||
|
const menu: Menu = {
|
||||||
|
"": { "title": "Tally Configs" },
|
||||||
|
"< Back": back,
|
||||||
|
"Add New": () => showEditMenu(),
|
||||||
|
};
|
||||||
|
|
||||||
|
tallycfg.forEach((tally, index) => {
|
||||||
|
menu[tally.name] = () => showEditMenu(tally, index);
|
||||||
|
});
|
||||||
|
|
||||||
|
E.showMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
function showEditMenu(tally?: TallySetting, index?: number) {
|
||||||
|
const isNew = tally == null;
|
||||||
|
if (tally == null) {
|
||||||
|
tally = { name: "" };
|
||||||
|
index = tallycfg.length;
|
||||||
|
tallycfg.push(tally);
|
||||||
|
}
|
||||||
|
|
||||||
|
const menu: Menu = {
|
||||||
|
"": { "title": isNew ? "New Tally" : "Edit Tally" },
|
||||||
|
"< Back": () => {
|
||||||
|
saveSettings();
|
||||||
|
showMainMenu();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
menu[tally.name || "<set name>"] = () => {
|
||||||
|
require("textinput")
|
||||||
|
.input({ text: tally.name })
|
||||||
|
.then(text => {
|
||||||
|
tally.name = text;
|
||||||
|
|
||||||
|
showEditMenu(tally, index);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!isNew) {
|
||||||
|
menu["Delete"] = () => {
|
||||||
|
tallycfg.splice(index!, 1);
|
||||||
|
saveSettings();
|
||||||
|
showMainMenu();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
E.showMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
showMainMenu();
|
||||||
|
}) satisfies SettingsFunc;
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
0.01: New app!
|
0.01: New app!
|
||||||
0.02: Minor code improvements
|
0.02: Minor code improvements
|
||||||
0.03: Minor code improvements
|
0.03: Minor code improvements
|
||||||
|
0.04: Remove buffer finding code (which fails if screen rotated) and make dependent on fw 2v21's Bangle.getOptions().lcdBufferPtr (fix #3818)
|
||||||
|
|
@ -480,7 +480,6 @@ void render(int* n, const unsigned char* m){
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
`);
|
`);
|
||||||
|
|
||||||
const nodeCount = 4;
|
const nodeCount = 4;
|
||||||
|
|
@ -489,10 +488,7 @@ const sintable = new Uint8Array(256);
|
||||||
const translation = new Uint32Array(10);
|
const translation = new Uint32Array(10);
|
||||||
let bgColor = 0;
|
let bgColor = 0;
|
||||||
const BLACK = g.setColor.bind(g, 0);
|
const BLACK = g.setColor.bind(g, 0);
|
||||||
const WHITE = g.setColor.bind(g, 0xFFFF);
|
let lcdBuffer = 0;
|
||||||
let lcdBuffer = 0,
|
|
||||||
start = 0;
|
|
||||||
|
|
||||||
let locked = false;
|
let locked = false;
|
||||||
let charging = false;
|
let charging = false;
|
||||||
let stopped = true;
|
let stopped = true;
|
||||||
|
|
@ -512,75 +508,6 @@ function setupInterval(force) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function test(addr, y) {
|
|
||||||
BLACK().fillRect(0, y, 176, y);
|
|
||||||
if (peek8(addr)) return false;
|
|
||||||
WHITE().fillRect(0, y, 176, y);
|
|
||||||
let b = peek8(addr);
|
|
||||||
BLACK().fillRect(0, y, 176, y);
|
|
||||||
if (!b) return false;
|
|
||||||
return !peek8(addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
function probe() {
|
|
||||||
if (!start) {
|
|
||||||
start = 0x20000000;
|
|
||||||
if (test(Bangle.getOptions().lcdBufferPtr, 0))
|
|
||||||
start = Bangle.getOptions().lcdBufferPtr; // FW=2v21
|
|
||||||
else if (test(0x2002d3fe, 0)) // try to skip loading if possible
|
|
||||||
start = 0x2002d3fe; // FW=2v20
|
|
||||||
}
|
|
||||||
const end = Math.min(start + 0x800, 0x20038000);
|
|
||||||
|
|
||||||
if (start >= end) {
|
|
||||||
print("Could not find framebuffer");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BLACK().fillRect(0, 0, 176, 0);
|
|
||||||
// sampling every 64 bytes since a 176-pixel row is 66 bytes at 3bpp
|
|
||||||
for (; start < end; start += 64) {
|
|
||||||
if (peek8(start)) continue;
|
|
||||||
WHITE().fillRect(0, 0, 176, 0);
|
|
||||||
let b = peek8(start);
|
|
||||||
BLACK().fillRect(0, 0, 176, 0);
|
|
||||||
if (!b) continue;
|
|
||||||
if (!peek8(start)) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (start >= end) {
|
|
||||||
setTimeout(probe, 1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find the beginning of the row
|
|
||||||
while (test(start - 1, 0))
|
|
||||||
start--;
|
|
||||||
|
|
||||||
/*
|
|
||||||
let stride = (176 * 3 + 7) >> 3,
|
|
||||||
padding = 0;
|
|
||||||
for (let i = 0; i < 20; ++i, ++padding) {
|
|
||||||
if (test(start + stride + padding, 1)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stride += padding;
|
|
||||||
if (padding == 20) {
|
|
||||||
print("Warning: Could not calculate padding");
|
|
||||||
stride = 68;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
let stride = 68;
|
|
||||||
|
|
||||||
lcdBuffer = start;
|
|
||||||
print('Found lcdBuffer at ' + lcdBuffer.toString(16) + ' stride=' + stride);
|
|
||||||
gfx.init(start, stride, E.getAddressOf(sintable, true));
|
|
||||||
gfx.setCamera(0, 0, -300 << 8);
|
|
||||||
setupInterval(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
bgColor = g.theme.bg & 0x8410;
|
bgColor = g.theme.bg & 0x8410;
|
||||||
bgColor = ((bgColor >> 15) | (bgColor >> 9) | (bgColor >> 2));
|
bgColor = ((bgColor >> 15) | (bgColor >> 9) | (bgColor >> 2));
|
||||||
|
|
@ -612,7 +539,22 @@ function init() {
|
||||||
c: i
|
c: i
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
setTimeout(probe, 1);
|
lcdBuffer = Bangle.getOptions().lcdBufferPtr;
|
||||||
|
if (!lcdBuffer) {
|
||||||
|
E.showMessage("Needs firmwave 2v21 or newer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let stride = 68;
|
||||||
|
//print('Found lcdBuffer at ' + lcdBuffer.toString(16) + ' stride=' + stride);
|
||||||
|
var sintablePtr = E.getAddressOf(sintable, true);
|
||||||
|
if (!sintablePtr) {
|
||||||
|
lcdBuffer = 0;
|
||||||
|
E.showMessage("Not enough memory");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
gfx.init(lcdBuffer, stride, sintablePtr);
|
||||||
|
gfx.setCamera(0, 0, -300 << 8);
|
||||||
|
setupInterval(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateNode(index) {
|
function updateNode(index) {
|
||||||
|
|
@ -657,12 +599,17 @@ function drawNode(index) {
|
||||||
translation[i++] = o.y * 256;
|
translation[i++] = o.y * 256;
|
||||||
translation[i++] = o.z * 256;
|
translation[i++] = o.z * 256;
|
||||||
translation[i++] = o.c;
|
translation[i++] = o.c;
|
||||||
gfx.render(E.getAddressOf(translation, true));
|
let translationPtr = E.getAddressOf(translation, true);
|
||||||
|
if (!translationPtr) {
|
||||||
|
lcdBuffer = 0;
|
||||||
|
E.showMessage("Not enough memory");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
gfx.render(translationPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tick(locked) {
|
function tick(locked) {
|
||||||
g.reset();
|
g.reset();
|
||||||
|
|
||||||
if (lcdBuffer && !locked) {
|
if (lcdBuffer && !locked) {
|
||||||
BLACK().drawRect(-1, -1, 0, 177); // dirty all the rows
|
BLACK().drawRect(-1, -1, 0, 177); // dirty all the rows
|
||||||
gfx.clear(bgColor);
|
gfx.clear(bgColor);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "warpdrive",
|
"id": "warpdrive",
|
||||||
"name": "warpdrive clock",
|
"name": "warpdrive clock",
|
||||||
"version": "0.03",
|
"version": "0.04",
|
||||||
"description": "A watchface with an animated 3D scene.",
|
"description": "A watchface with an animated 3D scene.",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
|
|
|
||||||
|
|
@ -4,3 +4,4 @@
|
||||||
0.04: Remove library stub
|
0.04: Remove library stub
|
||||||
0.05: Don't turn on LCD
|
0.05: Don't turn on LCD
|
||||||
0.06: Don't draw outside of widget field
|
0.06: Don't draw outside of widget field
|
||||||
|
0.07: Don't leave clipRect modified, as per [this comment](https://github.com/espruino/BangleApps/pull/3813#issuecomment-2826952155).
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "widmsggrid",
|
"id": "widmsggrid",
|
||||||
"name": "Messages Grid Widget",
|
"name": "Messages Grid Widget",
|
||||||
"version": "0.06",
|
"version": "0.07",
|
||||||
"description": "Widget that displays notification icons in a grid",
|
"description": "Widget that displays notification icons in a grid",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@
|
||||||
r++;
|
r++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
g.reset(); // Make sure we don't leave clipRect set to some smaller rectangle.
|
||||||
if (w.total > 1) {
|
if (w.total > 1) {
|
||||||
// show total number of messages in bottom-right corner
|
// show total number of messages in bottom-right corner
|
||||||
g.reset();
|
g.reset();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
require("heatshrink").decompress(atob("mEw4UA/4AB31H//A/hL/ABfABRMD+ALJh5kKn//BRCBCP4ILT/WrBZOq1W/BY/+BYOvBY0DBYZhGh/6BYOrMI0/BYf5qpGGBYWVqtQC4+qqtVqgvF1NVAIIABI4ogBAAdAL4gKEBZg8E/oLiBQpUEgILHJAUFBY4kCioLHQoQKHGAYL4I4RTLNZaDLGA78EAH4AR"))
|
||||||
|
|
@ -0,0 +1,247 @@
|
||||||
|
/**
|
||||||
|
* https://web.archive.org/web/20110610213848/http://www.meteormetrics.com/zambretti.htm
|
||||||
|
*/
|
||||||
|
|
||||||
|
const storage = require('Storage');
|
||||||
|
const Layout = require("Layout");
|
||||||
|
|
||||||
|
let height;
|
||||||
|
let mainScreen = false;
|
||||||
|
|
||||||
|
const ZAMBRETTI_FORECAST = {
|
||||||
|
A: /*LANG*/'Settled Fine',
|
||||||
|
B: /*LANG*/'Fine Weather',
|
||||||
|
C: /*LANG*/'Becoming Fine',
|
||||||
|
D: /*LANG*/'Fine Becoming Less Settled',
|
||||||
|
E: /*LANG*/'Fine, Possibly showers',
|
||||||
|
F: /*LANG*/'Fairly Fine, Improving',
|
||||||
|
G: /*LANG*/'Fairly Fine, Possibly showers, early',
|
||||||
|
H: /*LANG*/'Fairly Fine Showery Later',
|
||||||
|
I: /*LANG*/'Showery Early, Improving',
|
||||||
|
J: /*LANG*/'Changeable Mending',
|
||||||
|
K: /*LANG*/'Fairly Fine, Showers likely',
|
||||||
|
L: /*LANG*/'Rather Unsettled Clearing Later',
|
||||||
|
M: /*LANG*/'Unsettled, Probably Improving',
|
||||||
|
N: /*LANG*/'Showery Bright Intervals',
|
||||||
|
O: /*LANG*/'Showery Becoming more unsettled',
|
||||||
|
P: /*LANG*/'Changeable some rain',
|
||||||
|
Q: /*LANG*/'Unsettled, short fine Intervals',
|
||||||
|
R: /*LANG*/'Unsettled, Rain later',
|
||||||
|
S: /*LANG*/'Unsettled, rain at times',
|
||||||
|
T: /*LANG*/'Very Unsettled, Finer at times',
|
||||||
|
U: /*LANG*/'Rain at times, worse later.',
|
||||||
|
V: /*LANG*/'Rain at times, becoming very unsettled',
|
||||||
|
W: /*LANG*/'Rain at Frequent Intervals',
|
||||||
|
X: /*LANG*/'Very Unsettled, Rain',
|
||||||
|
Y: /*LANG*/'Stormy, possibly improving',
|
||||||
|
Z: /*LANG*/'Stormy, much rain',
|
||||||
|
};
|
||||||
|
|
||||||
|
const ZAMBRETTI_FALLING = {
|
||||||
|
1050: 'A',
|
||||||
|
1040: 'B',
|
||||||
|
1024: 'C',
|
||||||
|
1018: 'H',
|
||||||
|
1010: 'O',
|
||||||
|
1004: 'R',
|
||||||
|
998: 'U',
|
||||||
|
991: 'V',
|
||||||
|
985: 'X',
|
||||||
|
};
|
||||||
|
|
||||||
|
const ZAMBRETTI_STEADY = {
|
||||||
|
1033: 'A',
|
||||||
|
1023: 'B',
|
||||||
|
1014: 'E',
|
||||||
|
1008: 'K',
|
||||||
|
1000: 'N',
|
||||||
|
994: 'P',
|
||||||
|
989: 'S',
|
||||||
|
981: 'W',
|
||||||
|
974: 'X',
|
||||||
|
960: 'Z',
|
||||||
|
};
|
||||||
|
|
||||||
|
const ZAMBRETTI_RISING = {
|
||||||
|
1030: 'A',
|
||||||
|
1022: 'B',
|
||||||
|
1012: 'C',
|
||||||
|
1007: 'F',
|
||||||
|
1000: 'G',
|
||||||
|
995: 'I',
|
||||||
|
990: 'J',
|
||||||
|
984: 'L',
|
||||||
|
978: 'M',
|
||||||
|
970: 'Q',
|
||||||
|
965: 'T',
|
||||||
|
959: 'Y',
|
||||||
|
947: 'Z',
|
||||||
|
};
|
||||||
|
|
||||||
|
function correct_season(letter, dir) {
|
||||||
|
const month = new Date().getMonth() + 1;
|
||||||
|
const location = require("Storage").readJSON("mylocation.json",1)||{"lat":51.5072,"lon":0.1276,"location":"London"};
|
||||||
|
const northern_hemisphere = location.lat > 0;
|
||||||
|
const summer = northern_hemisphere ? (month >= 4 && month <= 9) : (month >= 10 || month <= 3);
|
||||||
|
|
||||||
|
let corr = 0;
|
||||||
|
if (dir < 0 && !summer) { // Winter falling
|
||||||
|
corr = +1;
|
||||||
|
} else if (dir > 0 && summer) { // Summer rising
|
||||||
|
corr = -1;
|
||||||
|
}
|
||||||
|
return letter == 'A' || letter == 'Z' ? letter : String.fromCharCode(letter.charCodeAt(0)+corr);
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_zambretti_letter(pressure, dir) {
|
||||||
|
let table = (() => {
|
||||||
|
if (dir < 0) { // Barometer Falling
|
||||||
|
return ZAMBRETTI_FALLING;
|
||||||
|
} else if (dir == 0) { // Barometer Steady
|
||||||
|
return ZAMBRETTI_STEADY;
|
||||||
|
} else { // Barometer Rising
|
||||||
|
return ZAMBRETTI_RISING;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
const closest = Object.keys(table).reduce(function(prev, curr) {
|
||||||
|
return (Math.abs(curr - pressure) < Math.abs(prev - pressure) ? curr : prev);
|
||||||
|
});
|
||||||
|
|
||||||
|
return correct_season(table[closest], dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadSettings() {
|
||||||
|
const settings = require('Storage').readJSON("zambretti.json", true) || {};
|
||||||
|
height = settings.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
function showMenu() {
|
||||||
|
const menu = {
|
||||||
|
"" : {
|
||||||
|
title : "Zambretti Forecast",
|
||||||
|
},
|
||||||
|
"< Back": () => {
|
||||||
|
E.showMenu();
|
||||||
|
layout.forgetLazyState();
|
||||||
|
show();
|
||||||
|
},
|
||||||
|
/*LANG*/"Exit": () => load(),
|
||||||
|
/*LANG*/"Settings": () =>
|
||||||
|
eval(require('Storage').read('zambretti.settings.js'))(() => {
|
||||||
|
loadSettings();
|
||||||
|
showMenu();
|
||||||
|
}),
|
||||||
|
'Plot history': () => {E.showMenu(); plot();},
|
||||||
|
};
|
||||||
|
E.showMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
const layout = new Layout({
|
||||||
|
type:"v", c: [
|
||||||
|
{type:"txt", font:"9%", label:/*LANG*/"Zambretti Forecast", bgCol:g.theme.bgH, fillx: true, pad: 1},
|
||||||
|
{type:"txt", font:"12%", id:"forecast", filly: 1, wrap: 1, width: Bangle.appRect.w, pad: 1},
|
||||||
|
{type:"h", c:[
|
||||||
|
{type: 'v', c:[
|
||||||
|
{type:"txt", font:"9%", label:/*LANG*/"Pressure", pad: 3, halign: -1},
|
||||||
|
{type:"txt", font:"9%", label:/*LANG*/"Difference", pad: 3, halign: -1},
|
||||||
|
{type:"txt", font:"9%", label:/*LANG*/"Temperature", pad: 3, halign: -1},
|
||||||
|
]},
|
||||||
|
{type: 'v', c:[
|
||||||
|
{type:"txt", font:"9%", id:"pressure", pad: 3, halign: -1},
|
||||||
|
{type:"txt", font:"9%", id:"diff", pad: 3, halign: -1},
|
||||||
|
{type:"txt", font:"9%", id:"temp", pad: 3, halign: -1},
|
||||||
|
]}
|
||||||
|
]},
|
||||||
|
]
|
||||||
|
}, {lazy:true});
|
||||||
|
|
||||||
|
function draw(temperature) {
|
||||||
|
const history3 = storage.readJSON("zambretti.log.json", true) || []; // history of recent 3 hours
|
||||||
|
const pressure_cur = history3[history3.length-1].p;
|
||||||
|
const pressure_last = history3[0].p;
|
||||||
|
const diff = pressure_cur - pressure_last;
|
||||||
|
const pressure_sea = pressure_cur * Math.pow(1 - (0.0065 * height) / (temperature + (0.0065 * height) + 273.15),-5.257);
|
||||||
|
|
||||||
|
layout.forecast.label = ZAMBRETTI_FORECAST[get_zambretti_letter(pressure_sea, diff)];
|
||||||
|
layout.pressure.label = Math.round(pressure_sea);
|
||||||
|
layout.diff.label = diff;
|
||||||
|
layout.temp.label = require("locale").number(temperature,1);
|
||||||
|
layout.render();
|
||||||
|
//layout.debug();
|
||||||
|
|
||||||
|
mainScreen = true;
|
||||||
|
Bangle.setUI({
|
||||||
|
mode: "custom",
|
||||||
|
btn: (n) => {mainScreen = false; showMenu();},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function show() {
|
||||||
|
Bangle.getPressure().then(p =>{if (p) draw(p.temperature);});
|
||||||
|
}
|
||||||
|
|
||||||
|
function plot() {
|
||||||
|
const interval = 15; // minutes
|
||||||
|
const history3 = require('Storage').readJSON("zambretti.log.json", true) || []; // history of recent 3 hours
|
||||||
|
|
||||||
|
const now = new Date()/(1000);
|
||||||
|
let curtime = now-3*60*60; // 3h ago
|
||||||
|
const data = [];
|
||||||
|
while (curtime <= now) {
|
||||||
|
// find closest value in history for this timestamp
|
||||||
|
const closest = history3.reduce((prev, curr) => {
|
||||||
|
return (Math.abs(curr.ts - curtime) < Math.abs(prev.ts - curtime) ? curr : prev);
|
||||||
|
});
|
||||||
|
data.push(closest.p);
|
||||||
|
curtime += interval*60;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bangle.setUI({
|
||||||
|
mode: "custom",
|
||||||
|
back: () => showMenu(),
|
||||||
|
});
|
||||||
|
|
||||||
|
g.reset().setFont("6x8",1);
|
||||||
|
require("graph").drawLine(g, data, {
|
||||||
|
axes: true,
|
||||||
|
x: 4,
|
||||||
|
y: Bangle.appRect.y+8,
|
||||||
|
height: Bangle.appRect.h-20,
|
||||||
|
gridx: 1,
|
||||||
|
gridy: 1,
|
||||||
|
miny: Math.min.apply(null, data)-1,
|
||||||
|
maxy: Math.max.apply(null, data)+1,
|
||||||
|
title: /*LANG*/"Barometer history (mBar)",
|
||||||
|
ylabel: y => y,
|
||||||
|
xlabel: i => {
|
||||||
|
const t = -3*60 + interval*i;
|
||||||
|
if (t % 60 === 0) {
|
||||||
|
return "-" + t/60 + "h";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
g.reset().clear();
|
||||||
|
loadSettings();
|
||||||
|
Bangle.loadWidgets();
|
||||||
|
|
||||||
|
if (height === undefined) {
|
||||||
|
// setting of height required
|
||||||
|
eval(require('Storage').read('zambretti.settings.js'))(() => {
|
||||||
|
loadSettings();
|
||||||
|
show();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
Bangle.drawWidgets();
|
||||||
|
|
||||||
|
// Update every 15 minutes
|
||||||
|
setInterval(() => {
|
||||||
|
if (mainScreen) {
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
}, 15*60*1000);
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 716 B |
|
|
@ -0,0 +1,92 @@
|
||||||
|
{
|
||||||
|
// Copied from widbaroalarm
|
||||||
|
const LOG_FILE = "zambretti.log.json";
|
||||||
|
const history3 = require('Storage').readJSON(LOG_FILE, true) || []; // history of recent 3 hours
|
||||||
|
let currentPressures = [];
|
||||||
|
|
||||||
|
const isValidPressureValue = (pressure) => {
|
||||||
|
return !(pressure == undefined || pressure <= 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePressureValue = (pressure) => {
|
||||||
|
if (pressure == undefined || pressure <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ts = Math.round(Date.now() / 1000); // seconds
|
||||||
|
const d = {"ts" : ts, "p" : pressure};
|
||||||
|
|
||||||
|
history3.push(d);
|
||||||
|
|
||||||
|
// delete oldest entries until we have max 50
|
||||||
|
while (history3.length > 50) {
|
||||||
|
history3.shift();
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete entries older than 3h
|
||||||
|
for (let i = 0; i < history3.length; i++) {
|
||||||
|
if (history3[i].ts < ts - (3 * 60 * 60)) {
|
||||||
|
history3.shift();
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// write data to storage
|
||||||
|
require('Storage').writeJSON(LOG_FILE, history3);
|
||||||
|
};
|
||||||
|
|
||||||
|
const barometerPressureHandler = (e) => {
|
||||||
|
const MEDIANLENGTH = 20;
|
||||||
|
while (currentPressures.length > MEDIANLENGTH)
|
||||||
|
currentPressures.pop();
|
||||||
|
|
||||||
|
const pressure = e.pressure;
|
||||||
|
if (isValidPressureValue(pressure)) {
|
||||||
|
currentPressures.unshift(pressure);
|
||||||
|
let median = currentPressures.slice().sort();
|
||||||
|
|
||||||
|
if (median.length > 10) {
|
||||||
|
var mid = median.length >> 1;
|
||||||
|
let medianPressure = Math.round(E.sum(median.slice(mid - 4, mid + 5)) / 9);
|
||||||
|
if (medianPressure > 0) {
|
||||||
|
turnOff();
|
||||||
|
handlePressureValue(medianPressure);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
turn on barometer power
|
||||||
|
take multiple measurements
|
||||||
|
sort the results
|
||||||
|
take the middle one (median)
|
||||||
|
turn off barometer power
|
||||||
|
*/
|
||||||
|
const getPressureValue = () => {
|
||||||
|
Bangle.setBarometerPower(true, "zambretti");
|
||||||
|
Bangle.on('pressure', barometerPressureHandler);
|
||||||
|
setTimeout(turnOff, 30000);
|
||||||
|
};
|
||||||
|
|
||||||
|
const turnOff = () => {
|
||||||
|
Bangle.removeListener('pressure', barometerPressureHandler);
|
||||||
|
Bangle.setBarometerPower(false, "zambretti");
|
||||||
|
};
|
||||||
|
|
||||||
|
// delay pressure measurement by interval-lastrun
|
||||||
|
const interval = 15; // minutes
|
||||||
|
const lastRun = history3.length > 0 ? history3[history3.length-1].ts : 0;
|
||||||
|
const lastRunAgo = Math.round(Date.now() / 1000) - lastRun;
|
||||||
|
let diffNextRun = interval*60-lastRunAgo;
|
||||||
|
if (diffNextRun < 0) {
|
||||||
|
diffNextRun = 0; // run asap
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
if (interval > 0) {
|
||||||
|
setInterval(getPressureValue, interval * 60000);
|
||||||
|
}
|
||||||
|
getPressureValue();
|
||||||
|
}, diffNextRun*1000);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"id": "zambretti",
|
||||||
|
"name": "Zambretti Weather Forecaster",
|
||||||
|
"shortName": "Zn. Weather",
|
||||||
|
"version": "0.01",
|
||||||
|
"description": "Zambretti Forecaster by Negretti and Zambra, uses the Barometer for empirical weather forecast in the Northern Hemisphere (see https://web.archive.org/web/20110610213848/http://www.meteormetrics.com/zambretti.htm), similar to weather stations. Watch must be stationary and its height above sea level set.",
|
||||||
|
"icon": "app.png",
|
||||||
|
"tags": "outdoors,weather",
|
||||||
|
"supports": ["BANGLEJS2"],
|
||||||
|
"dependencies": {"mylocation":"app"},
|
||||||
|
"screenshots": [ {"url":"screenshot.png"} ],
|
||||||
|
"storage": [
|
||||||
|
{"name":"zambretti.app.js","url":"app.js"},
|
||||||
|
{"name":"zambretti.settings.js","url":"settings.js"},
|
||||||
|
{"name":"zambretti.boot.js","url":"boot.js"},
|
||||||
|
{"name":"zambretti.img","url":"app-icon.js","evaluate":true}
|
||||||
|
],
|
||||||
|
"data": [{"name":"zambretti.json"}, {"name":"zambretti.log.json"}]
|
||||||
|
}
|
||||||
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
|
|
@ -0,0 +1,25 @@
|
||||||
|
(function(back) {
|
||||||
|
const FILE = "zambretti.json";
|
||||||
|
// Load settings
|
||||||
|
const settings = Object.assign({
|
||||||
|
height: 0,
|
||||||
|
}, require('Storage').readJSON(FILE, true) || {});
|
||||||
|
|
||||||
|
function writeSettings() {
|
||||||
|
require('Storage').writeJSON(FILE, settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show the menu
|
||||||
|
E.showMenu({
|
||||||
|
"" : { "title" : "Zambretti Forecast" },
|
||||||
|
"< Back" : () => back(),
|
||||||
|
'Height above sea level (m)': {
|
||||||
|
value: settings.height,
|
||||||
|
min: 0, max: 1000,
|
||||||
|
onchange: v => {
|
||||||
|
settings.height = v;
|
||||||
|
writeSettings();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
})
|
||||||
2
core
2
core
|
|
@ -1 +1 @@
|
||||||
Subproject commit 76b887dd6fc5693786fc1e63b97f3e4ab4306ed7
|
Subproject commit ef99424a9fbd01be504841a6c759ba4292a542f7
|
||||||
|
|
@ -85,6 +85,7 @@
|
||||||
<label class="chip tooltip" filterid="ram" data-tooltip="Apps that don't save anything to flash memory">Online</label>
|
<label class="chip tooltip" filterid="ram" data-tooltip="Apps that don't save anything to flash memory">Online</label>
|
||||||
<label class="chip tooltip" filterid="clkinfo" data-tooltip="Info displayed on clocks, or clocks with info">Clock Info</label>
|
<label class="chip tooltip" filterid="clkinfo" data-tooltip="Info displayed on clocks, or clocks with info">Clock Info</label>
|
||||||
<label class="chip tooltip" filterid="health" data-tooltip="Apps for your health">Health</label>
|
<label class="chip tooltip" filterid="health" data-tooltip="Apps for your health">Health</label>
|
||||||
|
<label class="chip tooltip" filterid="fonts" data-tooltip="Extra fonts for non-latin languages">Fonts</label>
|
||||||
<label class="chip tooltip" filterid="favourites" data-tooltip="Apps that you've liked ❤️">Favourites</label>
|
<label class="chip tooltip" filterid="favourites" data-tooltip="Apps that you've liked ❤️">Favourites</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="sort-nav hidden">
|
<div class="sort-nav hidden">
|
||||||
|
|
|
||||||
|
|
@ -228,5 +228,34 @@
|
||||||
"quarter to *$2": "viertel vor *$2",
|
"quarter to *$2": "viertel vor *$2",
|
||||||
"ten to *$2": "zehn vor *$2",
|
"ten to *$2": "zehn vor *$2",
|
||||||
"five to *$2": "fünf vor *$2"
|
"five to *$2": "fünf vor *$2"
|
||||||
|
},
|
||||||
|
"zambretti": {
|
||||||
|
"//": "App-specific overrides",
|
||||||
|
"Settled Fine": "Beständig sonnig",
|
||||||
|
"Fine Weather": "Sonniges Wetter",
|
||||||
|
"Becoming Fine": "Es wird schöner",
|
||||||
|
"Fine Becoming Less Settled": "Sonnig, Tendenz unbeständiger",
|
||||||
|
"Fine, Possibly showers": "Sonnig, eventuell Schauer",
|
||||||
|
"Fairly Fine, Improving": "Heiter bis wolkig, Besserung zu erwarten",
|
||||||
|
"Fairly Fine, Possibly showers, early": "Heiter bis wolkig, anfangs evtl. Schauer",
|
||||||
|
"Fairly Fine Showery Later": "Heiter bis wolkig, später Regen",
|
||||||
|
"Showery Early, Improving": "Anfangs noch Schauer, dann Besserung",
|
||||||
|
"Changeable Mending": "Wechselhaft mit Schauern",
|
||||||
|
"Fairly Fine, Showers likely": "Heiter bis wolkig, vereinzelt Regen",
|
||||||
|
"Rather Unsettled Clearing Later": "Unbeständig, spaeter Aufklarung",
|
||||||
|
"Unsettled, Probably Improving": "Unbeständig, evtl. Besserung.",
|
||||||
|
"Showery Bright Intervals": "Regnerisch mit heiteren Phasen",
|
||||||
|
"Showery Becoming more unsettled": "Regnerisch, wird unbeständiger",
|
||||||
|
"Changeable some rain": "Wechselhaft mit etwas Regen",
|
||||||
|
"Unsettled, short fine Intervals": "Unbeständig mit heiteren Phasen",
|
||||||
|
"Unsettled, Rain later": "Unbeständig, später Regen",
|
||||||
|
"Unsettled, rain at times": "Unbeständig mit etwas Regen",
|
||||||
|
"Very Unsettled, Finer at times": "Wechselhaft und regnerisch",
|
||||||
|
"Rain at times, worse later.": "Gelegentlich Regen, Verschlechterung",
|
||||||
|
"Rain at times, becoming very unsettled": "Zuweilen Regen, sehr unbeständig",
|
||||||
|
"Rain at Frequent Intervals": "Häufiger Regen",
|
||||||
|
"Very Unsettled, Rain": "Regen, sehr unbeständig",
|
||||||
|
"Stormy, possibly improving": "Stürmisch, evtl. Besserung",
|
||||||
|
"Stormy, much rain": "Stürmisch mit viel Regen"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -30,7 +30,7 @@ exports.show = function() {
|
||||||
/// Remove anything not needed if the overlay was removed
|
/// Remove anything not needed if the overlay was removed
|
||||||
exports.cleanupOverlay = function() {
|
exports.cleanupOverlay = function() {
|
||||||
exports.offset = -24;
|
exports.offset = -24;
|
||||||
Bangle.setLCDOverlay(undefined, {id: "widget_utils"});
|
Bangle.setLCDOverlay && Bangle.setLCDOverlay(undefined, {id: "widget_utils"});
|
||||||
delete exports.autohide;
|
delete exports.autohide;
|
||||||
delete Bangle.appRect;
|
delete Bangle.appRect;
|
||||||
if (exports.animInterval) {
|
if (exports.animInterval) {
|
||||||
|
|
@ -92,6 +92,7 @@ exports.swipeOn = function(autohide) {
|
||||||
const o = exports.offset;
|
const o = exports.offset;
|
||||||
Bangle.appRect.y = o+24;
|
Bangle.appRect.y = o+24;
|
||||||
Bangle.appRect.h = 1 + Bangle.appRect.y2 - Bangle.appRect.y;
|
Bangle.appRect.h = 1 + Bangle.appRect.y2 - Bangle.appRect.y;
|
||||||
|
if (Bangle.setLCDOverlay) {
|
||||||
if (o>-24) {
|
if (o>-24) {
|
||||||
Bangle.setLCDOverlay(og, 0, o, {
|
Bangle.setLCDOverlay(og, 0, o, {
|
||||||
id:"widget_utils",
|
id:"widget_utils",
|
||||||
|
|
@ -103,6 +104,7 @@ exports.swipeOn = function(autohide) {
|
||||||
Bangle.setLCDOverlay(undefined, {id: "widget_utils"});
|
Bangle.setLCDOverlay(undefined, {id: "widget_utils"});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (var w of global.WIDGETS) if (!w._draw) { // already hidden
|
for (var w of global.WIDGETS) if (!w._draw) { // already hidden
|
||||||
w._draw = w.draw;
|
w._draw = w.draw;
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -8,3 +8,4 @@ declare function require(moduleName: "Layout"): typeof Layout.Layout;
|
||||||
declare function require(moduleName: "power_usage"): PowerUsageModule;
|
declare function require(moduleName: "power_usage"): PowerUsageModule;
|
||||||
declare function require(moduleName: "exstats"): typeof ExStats;
|
declare function require(moduleName: "exstats"): typeof ExStats;
|
||||||
declare function require(moduleName: "time_utils"): typeof TimeUtils;
|
declare function require(moduleName: "time_utils"): typeof TimeUtils;
|
||||||
|
declare function require(moduleName: "textinput"): typeof TextInput;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
declare module TextInput {
|
||||||
|
function input(options: { text: string }): Promise<string>;
|
||||||
|
}
|
||||||
2
webtools
2
webtools
|
|
@ -1 +1 @@
|
||||||
Subproject commit 4dc22df5fd9af2f8fc41a626cc7d8d5456b8e614
|
Subproject commit 8b02a5932f88c652a9d59a947b7a2e14afe5d8f2
|
||||||
Loading…
Reference in New Issue