Update to use Bangle.setUI instead of setWatch
parent
0abc0ae213
commit
03ee6aea83
24
apps.json
24
apps.json
|
|
@ -4,7 +4,7 @@
|
||||||
"tags": "tool,system,b2",
|
"tags": "tool,system,b2",
|
||||||
"type":"bootloader",
|
"type":"bootloader",
|
||||||
"icon": "bootloader.png",
|
"icon": "bootloader.png",
|
||||||
"version":"0.26",
|
"version":"0.27",
|
||||||
"description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
|
"description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
|
||||||
"storage": [
|
"storage": [
|
||||||
{"name":".boot0","url":"boot0.js"},
|
{"name":".boot0","url":"boot0.js"},
|
||||||
|
|
@ -1030,7 +1030,7 @@
|
||||||
{ "id": "bclock",
|
{ "id": "bclock",
|
||||||
"name": "Binary Clock",
|
"name": "Binary Clock",
|
||||||
"icon": "clock-binary.png",
|
"icon": "clock-binary.png",
|
||||||
"version":"0.02",
|
"version":"0.03",
|
||||||
"description": "A simple binary clock watch face",
|
"description": "A simple binary clock watch face",
|
||||||
"tags": "clock",
|
"tags": "clock",
|
||||||
"type":"clock",
|
"type":"clock",
|
||||||
|
|
@ -1106,9 +1106,9 @@
|
||||||
"name": "Large Digit Blob Clock",
|
"name": "Large Digit Blob Clock",
|
||||||
"shortName" : "Blob Clock",
|
"shortName" : "Blob Clock",
|
||||||
"icon": "clock-blob.png",
|
"icon": "clock-blob.png",
|
||||||
"version":"0.05",
|
"version":"0.06",
|
||||||
"description": "A clock with big digits",
|
"description": "A clock with big digits",
|
||||||
"tags": "clock",
|
"tags": "clock,b2",
|
||||||
"type":"clock",
|
"type":"clock",
|
||||||
"allow_emulator":true,
|
"allow_emulator":true,
|
||||||
"storage": [
|
"storage": [
|
||||||
|
|
@ -1155,7 +1155,7 @@
|
||||||
{ "id": "berlinc",
|
{ "id": "berlinc",
|
||||||
"name": "Berlin Clock",
|
"name": "Berlin Clock",
|
||||||
"icon": "berlin-clock.png",
|
"icon": "berlin-clock.png",
|
||||||
"version":"0.03",
|
"version":"0.04",
|
||||||
"description": "Berlin Clock (see https://en.wikipedia.org/wiki/Mengenlehreuhr)",
|
"description": "Berlin Clock (see https://en.wikipedia.org/wiki/Mengenlehreuhr)",
|
||||||
"tags": "clock",
|
"tags": "clock",
|
||||||
"type":"clock",
|
"type":"clock",
|
||||||
|
|
@ -1313,7 +1313,7 @@
|
||||||
{ "id": "barclock",
|
{ "id": "barclock",
|
||||||
"name": "Bar Clock",
|
"name": "Bar Clock",
|
||||||
"icon": "clock-bar.png",
|
"icon": "clock-bar.png",
|
||||||
"version":"0.06",
|
"version":"0.07",
|
||||||
"description": "A simple digital clock showing seconds as a bar",
|
"description": "A simple digital clock showing seconds as a bar",
|
||||||
"tags": "clock",
|
"tags": "clock",
|
||||||
"type":"clock",
|
"type":"clock",
|
||||||
|
|
@ -1572,7 +1572,7 @@
|
||||||
"name": "Numerals Clock",
|
"name": "Numerals Clock",
|
||||||
"shortName": "Numerals Clock",
|
"shortName": "Numerals Clock",
|
||||||
"icon": "numerals.png",
|
"icon": "numerals.png",
|
||||||
"version":"0.08",
|
"version":"0.09",
|
||||||
"description": "A simple big numerals clock",
|
"description": "A simple big numerals clock",
|
||||||
"tags": "numerals,clock",
|
"tags": "numerals,clock",
|
||||||
"type":"clock",
|
"type":"clock",
|
||||||
|
|
@ -1986,7 +1986,7 @@
|
||||||
"id": "beebclock",
|
"id": "beebclock",
|
||||||
"name": "Beeb Clock",
|
"name": "Beeb Clock",
|
||||||
"icon": "beebclock.png",
|
"icon": "beebclock.png",
|
||||||
"version":"0.03",
|
"version":"0.04",
|
||||||
"description": "Clock face that may be coincidentally familiar to BBC viewers",
|
"description": "Clock face that may be coincidentally familiar to BBC viewers",
|
||||||
"tags": "clock",
|
"tags": "clock",
|
||||||
"type": "clock",
|
"type": "clock",
|
||||||
|
|
@ -2114,7 +2114,7 @@
|
||||||
"name": "Binary Clock",
|
"name": "Binary Clock",
|
||||||
"shortName":"Binary Clock",
|
"shortName":"Binary Clock",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"version":"0.02",
|
"version":"0.03",
|
||||||
"description": "A binary clock with hours and minutes. BTN1 toggles a digital clock.",
|
"description": "A binary clock with hours and minutes. BTN1 toggles a digital clock.",
|
||||||
"tags": "clock,binary",
|
"tags": "clock,binary",
|
||||||
"type": "clock",
|
"type": "clock",
|
||||||
|
|
@ -2755,7 +2755,7 @@
|
||||||
{ "id": "astral",
|
{ "id": "astral",
|
||||||
"name": "Astral Clock",
|
"name": "Astral Clock",
|
||||||
"icon": "app-icon.png",
|
"icon": "app-icon.png",
|
||||||
"version":"0.02",
|
"version":"0.03",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
"description": "Clock that calculates and displays Alt Az positions of all planets, Sun as well as several other astronomy targets (customizable) and current Moon phase. Coordinates are calculated by GPS & time and onscreen compass assists orienting. See Readme before using.",
|
"description": "Clock that calculates and displays Alt Az positions of all planets, Sun as well as several other astronomy targets (customizable) and current Moon phase. Coordinates are calculated by GPS & time and onscreen compass assists orienting. See Readme before using.",
|
||||||
"tags": "clock",
|
"tags": "clock",
|
||||||
|
|
@ -3223,7 +3223,7 @@
|
||||||
"name": "Bat Clock",
|
"name": "Bat Clock",
|
||||||
"shortName":"Bat Clock",
|
"shortName":"Bat Clock",
|
||||||
"icon": "bat-clock.png",
|
"icon": "bat-clock.png",
|
||||||
"version":"0.01",
|
"version":"0.02",
|
||||||
"description": "Morphing Clock, with an awesome \"The Dark Knight\" themed logo.",
|
"description": "Morphing Clock, with an awesome \"The Dark Knight\" themed logo.",
|
||||||
"tags": "clock",
|
"tags": "clock",
|
||||||
"type": "clock",
|
"type": "clock",
|
||||||
|
|
@ -3278,7 +3278,7 @@
|
||||||
{ "id": "mysticdock",
|
{ "id": "mysticdock",
|
||||||
"name": "Mystic Dock",
|
"name": "Mystic Dock",
|
||||||
"icon": "mystic-dock.png",
|
"icon": "mystic-dock.png",
|
||||||
"version":"1.0",
|
"version":"1.00",
|
||||||
"description": "A retro-inspired dockface that displays the current time and battery charge while plugged in, and which features an interactive mode that shows the time, date, and a rotating data display line.",
|
"description": "A retro-inspired dockface that displays the current time and battery charge while plugged in, and which features an interactive mode that shows the time, date, and a rotating data display line.",
|
||||||
"tags": "dock",
|
"tags": "dock",
|
||||||
"type":"dock",
|
"type":"dock",
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
0.01: Create astral clock app
|
0.01: Create astral clock app
|
||||||
0.02: Fixed Whirlpool galaxy RA/DA, larger compass display, fixed moonphase overlapping battery widget
|
0.02: Fixed Whirlpool galaxy RA/DA, larger compass display, fixed moonphase overlapping battery widget
|
||||||
|
0.03: Update to use Bangle.setUI instead of setWatch
|
||||||
|
|
|
||||||
|
|
@ -796,10 +796,11 @@ Bangle.on('lcdPower', on => {
|
||||||
Bangle.setCompassPower(1);
|
Bangle.setCompassPower(1);
|
||||||
Bangle.setGPSPower(1);
|
Bangle.setGPSPower(1);
|
||||||
|
|
||||||
// Buttons
|
// Show launcher when button pressed
|
||||||
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" });
|
Bangle.setClockMode();
|
||||||
|
|
||||||
setWatch(function () {
|
Bangle.setUI("clockupdown", btn => {
|
||||||
|
if (btn==0) {
|
||||||
if (!processing) {
|
if (!processing) {
|
||||||
if (!modeswitch) {
|
if (!modeswitch) {
|
||||||
modeswitch = true;
|
modeswitch = true;
|
||||||
|
|
@ -809,12 +810,11 @@ setWatch(function () {
|
||||||
else
|
else
|
||||||
modeswitch = false;
|
modeswitch = false;
|
||||||
}
|
}
|
||||||
}, BTN3, { repeat: true });
|
} else {
|
||||||
|
|
||||||
setWatch(function () {
|
|
||||||
if (!processing)
|
if (!processing)
|
||||||
ready_to_compute = true;
|
ready_to_compute = true;
|
||||||
}, BTN1, { repeat: true });
|
}
|
||||||
|
});
|
||||||
|
|
||||||
setWatch(function () {
|
setWatch(function () {
|
||||||
if (!astral_settings.astral_default) {
|
if (!astral_settings.astral_default) {
|
||||||
|
|
|
||||||
|
|
@ -4,3 +4,4 @@
|
||||||
0.04: Small bugfix
|
0.04: Small bugfix
|
||||||
0.05: Clock does not start if app Languages is not installed
|
0.05: Clock does not start if app Languages is not installed
|
||||||
0.06: Improve accuracy
|
0.06: Improve accuracy
|
||||||
|
0.07: Update to use Bangle.setUI instead of setWatch
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
/**
|
/**
|
||||||
* A simple digital clock showing seconds as a bar
|
* A simple digital clock showing seconds as a bar
|
||||||
**/
|
**/
|
||||||
{
|
|
||||||
// Check settings for what type our clock should be
|
// Check settings for what type our clock should be
|
||||||
const is12Hour = (require('Storage').readJSON('setting.json', 1) || {})['12hour']
|
const is12Hour = (require('Storage').readJSON('setting.json', 1) || {})['12hour']
|
||||||
let locale = require('locale')
|
let locale = require('locale')
|
||||||
|
|
@ -157,8 +156,8 @@
|
||||||
g.clear()
|
g.clear()
|
||||||
Bangle.loadWidgets()
|
Bangle.loadWidgets()
|
||||||
Bangle.drawWidgets()
|
Bangle.drawWidgets()
|
||||||
// Show launcher when middle button pressed
|
// Show launcher when button pressed
|
||||||
setWatch(Bangle.showLauncher, BTN2, {repeat: false, edge: 'falling'})
|
Bangle.setUI("clock");
|
||||||
|
|
||||||
Bangle.on('lcdPower', function (on) {
|
Bangle.on('lcdPower', function (on) {
|
||||||
if (on) {
|
if (on) {
|
||||||
|
|
@ -168,4 +167,3 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
start()
|
start()
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
0.01: App Created!
|
0.01: App Created!
|
||||||
|
0.02: Update to use Bangle.setUI instead of setWatch
|
||||||
|
|
|
||||||
|
|
@ -256,8 +256,5 @@ Bangle.drawWidgets();
|
||||||
timeInterval = setInterval(showTime, 1000);
|
timeInterval = setInterval(showTime, 1000);
|
||||||
showTime();
|
showTime();
|
||||||
|
|
||||||
// Show launcher when middle button pressed
|
// Show launcher when button pressed
|
||||||
setWatch(Bangle.showLauncher, BTN2, {
|
Bangle.setUI("clock");
|
||||||
repeat: false,
|
|
||||||
edge: "falling"
|
|
||||||
});
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
0.02: Modified for use with new bootloader and firmware
|
0.02: Modified for use with new bootloader and firmware
|
||||||
|
0.03: Update to use Bangle.setUI instead of setWatch
|
||||||
|
|
|
||||||
|
|
@ -105,5 +105,5 @@ Bangle.loadWidgets();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
setInterval(() => { drawClock(); }, 1000);
|
setInterval(() => { drawClock(); }, 1000);
|
||||||
drawClock();
|
drawClock();
|
||||||
// Show launcher when middle button pressed
|
// Show launcher when button pressed
|
||||||
setWatch(Bangle.showLauncher, BTN2, {repeat:false,edge:"falling"});
|
Bangle.setUI("clock");
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
0.01: Initial commit. Not very efficient, and widgets not working for some reason.
|
0.01: Initial commit. Not very efficient, and widgets not working for some reason.
|
||||||
0.02: Fixes; widget support
|
0.02: Fixes; widget support
|
||||||
0.03: Remove hardcoded hour buzz (you can install widchime if you miss it)
|
0.03: Remove hardcoded hour buzz (you can install widchime if you miss it)
|
||||||
|
0.04: Update to use Bangle.setUI instead of setWatch
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,6 @@ Graphics.prototype.drawRotLine = function (sina, cosa, cx, cy, r1, r2) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
(function(g) {
|
|
||||||
// Display modes
|
// Display modes
|
||||||
//
|
//
|
||||||
// 0: full-screen
|
// 0: full-screen
|
||||||
|
|
@ -277,16 +275,11 @@ Graphics.prototype.drawRotLine = function (sina, cosa, cx, cy, r1, r2) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const setButtons = () => {
|
const setButtons = () => {
|
||||||
const opts = { repeat: true, edge:'rising', debounce:30};
|
// Show launcher when button pressed
|
||||||
|
Bangle.setUI("clockupdown", btn=> {
|
||||||
// BTN1: enable/disable second hand
|
if (btn==0) changeSeconds();
|
||||||
setWatch(changeSeconds, BTN1, opts);
|
if (btn==1) { ++mode; setMode(); drawAll(true); }
|
||||||
|
});
|
||||||
// BTN2: return to launcher
|
|
||||||
setWatch(Bangle.showLauncher, BTN2, { repeat:false, edge:'falling' });
|
|
||||||
|
|
||||||
// BTN3: change display mode
|
|
||||||
setWatch(function () { ++mode; setMode(); drawAll(true); }, BTN3, opts);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Load display parameters based on `mode`
|
// Load display parameters based on `mode`
|
||||||
|
|
@ -387,5 +380,3 @@ Graphics.prototype.drawRotLine = function (sina, cosa, cx, cy, r1, r2) {
|
||||||
clearTimeout();
|
clearTimeout();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
})(g);
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
0.02: Modified for use with new bootloader and firmware
|
0.02: Modified for use with new bootloader and firmware
|
||||||
0.03: Shrinked size to avoid cut-off edges on the physical device. BTN3: show date. BTN1: show time in decimal.
|
0.03: Shrinked size to avoid cut-off edges on the physical device. BTN3: show date. BTN1: show time in decimal.
|
||||||
|
0.04: Update to use Bangle.setUI instead of setWatch
|
||||||
|
|
|
||||||
|
|
@ -100,9 +100,11 @@ g.clear();
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
drawBerlinClock();
|
drawBerlinClock();
|
||||||
|
if (BTN3) {
|
||||||
// Toggle date display, when BTN3 is pressed
|
// Toggle date display, when BTN3 is pressed
|
||||||
setWatch(toggleTime,BTN1, { repeat : true, edge: "falling"});
|
setWatch(toggleTime,BTN1, { repeat : true, edge: "falling"});
|
||||||
// Toggle date display, when BTN3 is pressed
|
// Toggle date display, when BTN3 is pressed
|
||||||
setWatch(toggleDate,BTN3, { repeat : true, edge: "falling"});
|
setWatch(toggleDate,BTN3, { repeat : true, edge: "falling"});
|
||||||
// Show launcher when middle button pressed
|
}
|
||||||
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" });
|
// Show launcher when button pressed
|
||||||
|
Bangle.setUI("clock");
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
0.01: New App!
|
0.01: New App!
|
||||||
0.02: Fixed bug where screen didn't clear so incorrect time displayed.
|
0.02: Fixed bug where screen didn't clear so incorrect time displayed.
|
||||||
|
0.03: Update to use Bangle.setUI instead of setWatch
|
||||||
|
|
|
||||||
|
|
@ -167,12 +167,12 @@ Bangle.on('lcdPower',on=>{
|
||||||
// Load widgets
|
// Load widgets
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
// Show launcher when middle button pressed
|
// Show launcher when button pressed
|
||||||
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" });
|
Bangle.setUI("clockupdown", btn=>{
|
||||||
setWatch(function() {
|
if (btn!=1) return;
|
||||||
if(displayTime == 0){
|
if(displayTime == 0){
|
||||||
displayTime = 1;
|
displayTime = 1;
|
||||||
} else{
|
} else{
|
||||||
displayTime = 0;
|
displayTime = 0;
|
||||||
}
|
}
|
||||||
}, BTN, {edge:"rising", debounce:50, repeat:true});
|
});
|
||||||
|
|
|
||||||
|
|
@ -4,3 +4,4 @@
|
||||||
0.03: Modified for use with new bootloader and firmware
|
0.03: Modified for use with new bootloader and firmware
|
||||||
0.04: Modified to account for changes in the behavior of Graphics.fillPoly
|
0.04: Modified to account for changes in the behavior of Graphics.fillPoly
|
||||||
0.05: Slight increase to draw speed after LCD on
|
0.05: Slight increase to draw speed after LCD on
|
||||||
|
0.06: Update to use Bangle.setUI instead of setWatch, allow themes and different size screens
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
const buf = Graphics.createArrayBuffer(144,200,1,{msb:true});
|
let big = g.getHeight() > 200;
|
||||||
|
const buf = Graphics.createArrayBuffer(big ? 144 : 120, big ? 180 : 150,1,{msb:true});
|
||||||
|
// TODO: convert these to Polys -> much faster and cleaner!
|
||||||
const NUMBERS = [
|
const NUMBERS = [
|
||||||
[1,1,1,1,3,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1],//0
|
[1,1,1,1,3,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1],//0
|
||||||
[0,1,1,1,3,0,0,1,1,1,0,0,1,1,1,0,0,1,1,1,0,0,1,1,1],//1
|
[0,1,1,1,3,0,0,1,1,1,0,0,1,1,1,0,0,1,1,1,0,0,1,1,1],//1
|
||||||
|
|
@ -14,8 +16,10 @@ const NUMBERS = [
|
||||||
let intervalRef = null;
|
let intervalRef = null;
|
||||||
let digits = [-1,-1,-1,-1,-1,-1];
|
let digits = [-1,-1,-1,-1,-1,-1];
|
||||||
function flip() {
|
function flip() {
|
||||||
g.setColor(1,1,1);
|
g.reset();
|
||||||
g.drawImage({width:buf.getWidth(),height:buf.getHeight(),buffer:buf.buffer},55,26);
|
g.drawImage({width:buf.getWidth(),height:buf.getHeight(),buffer:buf.buffer},
|
||||||
|
(g.getWidth() - buf.getWidth())/2,
|
||||||
|
26 + (g.getHeight() - (buf.getHeight()+24))/2);
|
||||||
}
|
}
|
||||||
function drawPixel(ox,oy,x,y,r,p) {
|
function drawPixel(ox,oy,x,y,r,p) {
|
||||||
let x1 = ox+x*(r*2);
|
let x1 = ox+x*(r*2);
|
||||||
|
|
@ -53,26 +57,31 @@ function redraw() {
|
||||||
|
|
||||||
let newDigits = [Math.floor(hours/10),hours%10,Math.floor(mins/10),mins%10,Math.floor(secs/10),secs%10];
|
let newDigits = [Math.floor(hours/10),hours%10,Math.floor(mins/10),mins%10,Math.floor(secs/10),secs%10];
|
||||||
|
|
||||||
|
let s = big?6:5; // size of main digits
|
||||||
|
let y2 = big?72:55;
|
||||||
|
let y3 = big?144:110;
|
||||||
|
|
||||||
|
|
||||||
for (var p = 0;p<25;p++) {
|
for (var p = 0;p<25;p++) {
|
||||||
var px = p%5;
|
var px = p%5;
|
||||||
var py = Math.floor(p/5);
|
var py = Math.floor(p/5);
|
||||||
if (digits[0] === -1 || NUMBERS[newDigits[0]][p] !== NUMBERS[digits[0]][p] ) {
|
if (digits[0] === -1 || NUMBERS[newDigits[0]][p] !== NUMBERS[digits[0]][p] ) {
|
||||||
drawPixel(0,20,px,py,6,NUMBERS[newDigits[0]][p]);
|
drawPixel(0,0,px,py,s,NUMBERS[newDigits[0]][p]);
|
||||||
}
|
}
|
||||||
if (digits[1] === -1 || NUMBERS[newDigits[1]][p] !== NUMBERS[digits[1]][p] ) {
|
if (digits[1] === -1 || NUMBERS[newDigits[1]][p] !== NUMBERS[digits[1]][p] ) {
|
||||||
drawPixel(78,20,px,py,6,NUMBERS[newDigits[1]][p]);
|
drawPixel(13*s,0,px,py,s,NUMBERS[newDigits[1]][p]);
|
||||||
}
|
}
|
||||||
if (digits[2] === -1 || NUMBERS[newDigits[2]][p] !== NUMBERS[digits[2]][p] ) {
|
if (digits[2] === -1 || NUMBERS[newDigits[2]][p] !== NUMBERS[digits[2]][p] ) {
|
||||||
drawPixel(0,92,px,py,6,NUMBERS[newDigits[2]][p]);
|
drawPixel(0,y2,px,py,s,NUMBERS[newDigits[2]][p]);
|
||||||
}
|
}
|
||||||
if (digits[3] === -1 || NUMBERS[newDigits[3]][p] !== NUMBERS[digits[3]][p] ) {
|
if (digits[3] === -1 || NUMBERS[newDigits[3]][p] !== NUMBERS[digits[3]][p] ) {
|
||||||
drawPixel(78,92,px,py,6,NUMBERS[newDigits[3]][p]);
|
drawPixel(13*s,y2,px,py,s,NUMBERS[newDigits[3]][p]);
|
||||||
}
|
}
|
||||||
if (digits[4] === -1 || NUMBERS[newDigits[4]][p] !== NUMBERS[digits[4]][p] ) {
|
if (digits[4] === -1 || NUMBERS[newDigits[4]][p] !== NUMBERS[digits[4]][p] ) {
|
||||||
drawPixel(69,164,px,py,3,NUMBERS[newDigits[4]][p]);
|
drawPixel(17*s - 3*12,y3,px,py,3,NUMBERS[newDigits[4]][p]);
|
||||||
}
|
}
|
||||||
if (digits[5] === -1 || NUMBERS[newDigits[5]][p] !== NUMBERS[digits[5]][p] ) {
|
if (digits[5] === -1 || NUMBERS[newDigits[5]][p] !== NUMBERS[digits[5]][p] ) {
|
||||||
drawPixel(108,164,px,py,3,NUMBERS[newDigits[5]][p]);
|
drawPixel(17*s,y3,px,py,3,NUMBERS[newDigits[5]][p]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
digits = newDigits;
|
digits = newDigits;
|
||||||
|
|
@ -99,5 +108,5 @@ Bangle.on('lcdPower',function(on) {
|
||||||
clearTimers();
|
clearTimers();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Show launcher when middle button pressed
|
// Show launcher when button pressed
|
||||||
setWatch(Bangle.showLauncher, BTN2, {repeat:false,edge:"falling"});
|
Bangle.setUI("clock");
|
||||||
|
|
|
||||||
|
|
@ -25,3 +25,4 @@
|
||||||
0.24: Add Bangle.setUI polyfill
|
0.24: Add Bangle.setUI polyfill
|
||||||
0.25: Fix error in 'no clock app' message
|
0.25: Fix error in 'no clock app' message
|
||||||
0.26: Remove buzz in setUI polyfill (#750)
|
0.26: Remove buzz in setUI polyfill (#750)
|
||||||
|
0.27: Update polyfill for most recent changes
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ recalculates, but this avoids us doing a whole bunch of reconfiguration most
|
||||||
of the time. */
|
of the time. */
|
||||||
E.showMessage("Updating boot0...");
|
E.showMessage("Updating boot0...");
|
||||||
var s = require('Storage').readJSON('setting.json',1)||{};
|
var s = require('Storage').readJSON('setting.json',1)||{};
|
||||||
|
var isB2 = process.env.HWVERSION; // Is Bangle.js 2
|
||||||
var boot = "";
|
var boot = "";
|
||||||
var CRC = E.CRC32(require('Storage').read('setting.json'))+E.CRC32(require('Storage').list(/\.boot\.js/));
|
var CRC = E.CRC32(require('Storage').read('setting.json'))+E.CRC32(require('Storage').list(/\.boot\.js/));
|
||||||
boot += `if (E.CRC32(require('Storage').read('setting.json'))+E.CRC32(require('Storage').list(/\.boot\.js/))!=${CRC}) { eval(require('Storage').read('bootupdate.js'));} else {\n`;
|
boot += `if (E.CRC32(require('Storage').read('setting.json'))+E.CRC32(require('Storage').list(/\.boot\.js/))!=${CRC}) { eval(require('Storage').read('bootupdate.js'));} else {\n`;
|
||||||
|
|
@ -81,9 +82,9 @@ if (s.passkey!==undefined && s.passkey.length==6) boot+=`NRF.setSecurity({passke
|
||||||
if (s.whitelist) boot+=`NRF.on('connect', function(addr) { if (!(require('Storage').readJSON('setting.json',1)||{}).whitelist.includes(addr)) NRF.disconnect(); });\n`;
|
if (s.whitelist) boot+=`NRF.on('connect', function(addr) { if (!(require('Storage').readJSON('setting.json',1)||{}).whitelist.includes(addr)) NRF.disconnect(); });\n`;
|
||||||
// Pre-2v10 firmwares without a theme/setUI
|
// Pre-2v10 firmwares without a theme/setUI
|
||||||
if (!g.theme) {
|
if (!g.theme) {
|
||||||
boot += `g.theme={fg:-1,bg:0,fg2:-1,bg2:7,fgH:-1,bgH:0x02F7};\n`;
|
boot += `g.theme={fg:-1,bg:0,fg2:-1,bg2:7,fgH:-1,bgH:0x02F7,dark:true};\n`;
|
||||||
}
|
}
|
||||||
if (!Bangle.setUI) {
|
if (!Bangle.setUI) { // assume this is just for F18 - Q3 should already have it
|
||||||
boot += `Bangle.setUI=function(mode, cb) {
|
boot += `Bangle.setUI=function(mode, cb) {
|
||||||
if (Bangle.btnWatches) {
|
if (Bangle.btnWatches) {
|
||||||
Bangle.btnWatches.forEach(clearWatch);
|
Bangle.btnWatches.forEach(clearWatch);
|
||||||
|
|
@ -114,6 +115,18 @@ else if (mode=="updown") {
|
||||||
Bangle.on("swipe", Bangle.swipeHandler);
|
Bangle.on("swipe", Bangle.swipeHandler);
|
||||||
Bangle.touchHandler = d => {cb();};
|
Bangle.touchHandler = d => {cb();};
|
||||||
Bangle.on("touch", Bangle.touchHandler);
|
Bangle.on("touch", Bangle.touchHandler);
|
||||||
|
} else if (mode=="clock") {
|
||||||
|
Bangle.CLOCK=1;
|
||||||
|
Bangle.btnWatches = [
|
||||||
|
setWatch(Bangle.showLauncher, BTN2, {repeat:1,edge:"falling"})
|
||||||
|
];
|
||||||
|
} else if (mode=="clockupdown") {
|
||||||
|
Bangle.CLOCK=1;
|
||||||
|
Bangle.btnWatches = [
|
||||||
|
setWatch(function() { cb(-1); }, BTN1, {repeat:1}),
|
||||||
|
setWatch(function() { cb(1); }, BTN3, {repeat:1}),
|
||||||
|
setWatch(Bangle.showLauncher, BTN2, {repeat:1,edge:"falling"})
|
||||||
|
];
|
||||||
} else
|
} else
|
||||||
throw new Error("Unknown UI mode");
|
throw new Error("Unknown UI mode");
|
||||||
};\n`;
|
};\n`;
|
||||||
|
|
|
||||||
|
|
@ -6,3 +6,4 @@
|
||||||
0.06: Improve rendering of Numeral 1, fix issue with alarms not showing up
|
0.06: Improve rendering of Numeral 1, fix issue with alarms not showing up
|
||||||
0.07: Add date on touch and some improvements (see settings and readme)
|
0.07: Add date on touch and some improvements (see settings and readme)
|
||||||
0.08: Add new draw styles, tidy up draw functionality
|
0.08: Add new draw styles, tidy up draw functionality
|
||||||
|
0.09: Tweak for faster rendering
|
||||||
|
|
|
||||||
|
|
@ -22,16 +22,17 @@ var _12hour = (require("Storage").readJSON("setting.json",1)||{})["12hour"]||fal
|
||||||
var _hCol = ["#ff5555","#ffff00","#FF9901","#2F00FF"];
|
var _hCol = ["#ff5555","#ffff00","#FF9901","#2F00FF"];
|
||||||
var _mCol = ["#55ff55","#ffffff","#00EFEF","#FFBF00"];
|
var _mCol = ["#55ff55","#ffffff","#00EFEF","#FFBF00"];
|
||||||
var _rCol = 0;
|
var _rCol = 0;
|
||||||
|
var scale = g.getWidth()/240;
|
||||||
var interval = 0;
|
var interval = 0;
|
||||||
const REFRESH_RATE = 10E3;
|
const REFRESH_RATE = 10E3;
|
||||||
var drawFuncs = {
|
var drawFuncs = {
|
||||||
fill : function(poly,isHole){
|
fill : function(poly,isHole){
|
||||||
if (isHole) g.setColor(0);
|
if (isHole) g.setColor(g.theme.bg);
|
||||||
g.fillPoly(poly,true);
|
g.fillPoly(poly,true);
|
||||||
},
|
},
|
||||||
framefill : function(poly,isHole){
|
framefill : function(poly,isHole){
|
||||||
var c = g.getColor();
|
var c = g.getColor();
|
||||||
g.setColor(isHole ? 0 : ((c&0b1111011111011110)>>1)); // 16 bit half bright
|
g.setColor(isHole ? g.theme.bg : ((c&0b1111011111011110)>>1)); // 16 bit half bright
|
||||||
g.fillPoly(poly,true);
|
g.fillPoly(poly,true);
|
||||||
g.setColor(c);
|
g.setColor(c);
|
||||||
g.drawPoly(poly,true);
|
g.drawPoly(poly,true);
|
||||||
|
|
@ -48,7 +49,8 @@ var drawFuncs = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function translate(tx, ty, p){
|
function translate(tx, ty, p){
|
||||||
return p.map((x, i)=> x+((i&1)?ty:tx));
|
//return p.map((x, i)=> x+((i&1)?ty:tx));
|
||||||
|
return g.transformVertices(p, {x:tx,y:ty,scale:scale});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -57,15 +59,14 @@ if (!settings) {
|
||||||
settings = {
|
settings = {
|
||||||
color:0,
|
color:0,
|
||||||
drawMode:"fill",
|
drawMode:"fill",
|
||||||
menuButton:24,
|
|
||||||
showDate:0
|
showDate:0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawNum(num,col,x,y,func,funcName){
|
function drawNum(num,col,x,y,func,funcName){
|
||||||
g.setColor(col);
|
g.setColor(col);
|
||||||
let tx = x*100+25;
|
let tx = (x*100+25) * scale;
|
||||||
let ty = y*104+32;
|
let ty = (y*104+32) * scale;
|
||||||
for (let i=0;i<numerals[num].length;i++){
|
for (let i=0;i<numerals[num].length;i++){
|
||||||
g.setColor(col);
|
g.setColor(col);
|
||||||
func(translate(tx,ty,numerals[num][i]), i>0);
|
func(translate(tx,ty,numerals[num][i]), i>0);
|
||||||
|
|
@ -98,9 +99,9 @@ function setUpdateInt(set){
|
||||||
if (set) interval=setInterval(draw, REFRESH_RATE);
|
if (set) interval=setInterval(draw, REFRESH_RATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bangle.setLCDMode();
|
g.clear(1);
|
||||||
g.reset().clear();
|
// Show launcher when button pressed
|
||||||
setWatch(Bangle.showLauncher, settings.menuButton, {repeat:false,edge:"falling"});
|
Bangle.setUI("clock");
|
||||||
if (settings.color>0) _rCol=settings.color-1;
|
if (settings.color>0) _rCol=settings.color-1;
|
||||||
setUpdateInt(1);
|
setUpdateInt(1);
|
||||||
draw();
|
draw();
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,12 @@
|
||||||
numeralsSettings = {
|
numeralsSettings = {
|
||||||
color:0,
|
color:0,
|
||||||
drawMode:"fill",
|
drawMode:"fill",
|
||||||
menuButton:22,
|
|
||||||
showDate:0
|
showDate:0
|
||||||
};
|
};
|
||||||
updateSettings();
|
updateSettings();
|
||||||
}
|
}
|
||||||
let numeralsSettings = storage.readJSON('numerals.json',1);
|
let numeralsSettings = storage.readJSON('numerals.json',1);
|
||||||
if (!numeralsSettings) resetSettings();
|
if (!numeralsSettings) resetSettings();
|
||||||
if (numeralsSettings.menuButton===undefined) numeralsSettings.menuButton=22;
|
|
||||||
let dm = ["fill","frame","framefill","thickframe"];
|
let dm = ["fill","frame","framefill","thickframe"];
|
||||||
let col = ["rnd","r/g","y/w","o/c","b/y"];
|
let col = ["rnd","r/g","y/w","o/c","b/y"];
|
||||||
let btn = [[24,"BTN1"],[22,"BTN2"],[23,"BTN3"],[11,"BTN4"],[16,"BTN5"]];
|
let btn = [[24,"BTN1"],[22,"BTN2"],[23,"BTN3"],[11,"BTN4"],[16,"BTN5"]];
|
||||||
|
|
@ -31,12 +29,6 @@
|
||||||
format: v=>dm[v],
|
format: v=>dm[v],
|
||||||
onchange: v=> { numeralsSettings.drawMode=dm[v]; updateSettings();}
|
onchange: v=> { numeralsSettings.drawMode=dm[v]; updateSettings();}
|
||||||
},
|
},
|
||||||
"Menu button": {
|
|
||||||
value: btn.findIndex(e=>e[0]==numeralsSettings.menuButton),
|
|
||||||
min:0,max:btn.length-1,
|
|
||||||
format: v=>btn[v][1],
|
|
||||||
onchange: v=> { numeralsSettings.menuButton=btn[v][0]; updateSettings();}
|
|
||||||
},
|
|
||||||
"Date on touch": {
|
"Date on touch": {
|
||||||
value: 0|numeralsSettings.showDate,
|
value: 0|numeralsSettings.showDate,
|
||||||
min:0,max:1,
|
min:0,max:1,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue