Merge branch 'espruino:master' into master

pull/3185/head
Logan B 2024-02-19 14:12:52 -06:00 committed by GitHub
commit 8ccc7fbe15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 114 additions and 75 deletions

View File

@ -142,13 +142,11 @@
"SwitchCase": 1 "SwitchCase": 1
} }
], ],
"no-case-declarations": "off",
"no-constant-condition": "off", "no-constant-condition": "off",
"no-delete-var": "off", "no-delete-var": "off",
"no-empty": "off", "no-empty": "off",
"no-global-assign": "off", "no-global-assign": "off",
"no-inner-declarations": "off", "no-inner-declarations": "off",
"no-octal": "off",
"no-prototype-builtins": "off", "no-prototype-builtins": "off",
"no-redeclare": "off", "no-redeclare": "off",
"no-unreachable": "warn", "no-unreachable": "warn",

View File

@ -369,7 +369,7 @@ function buttonPress(val) {
} }
hasPressedNumber = false; hasPressedNumber = false;
break; break;
default: default: {
specials.R.val = 'C'; specials.R.val = 'C';
if (!swipeEnabled) drawKey('R', specials.R); if (!swipeEnabled) drawKey('R', specials.R);
const is0Negative = (currNumber === 0 && 1/currNumber === -Infinity); const is0Negative = (currNumber === 0 && 1/currNumber === -Infinity);
@ -387,6 +387,7 @@ function buttonPress(val) {
break; break;
} }
} }
}
function moveDirection(d) { function moveDirection(d) {
drawKey(selected, screen[selected]); drawKey(selected, screen[selected]);

View File

@ -99,7 +99,7 @@ const sameDay = function(d1, d2) {
const drawEvent = function(ev, curDay, x1, y1, x2, y2) { const drawEvent = function(ev, curDay, x1, y1, x2, y2) {
"ram"; "ram";
switch(ev.type) { switch(ev.type) {
case "e": // alarm/event case "e": { // alarm/event
const hour = 0|ev.date.getHours() + 0|ev.date.getMinutes()/60.0; const hour = 0|ev.date.getHours() + 0|ev.date.getMinutes()/60.0;
const slice = hour/24*(eventsPerDay-1); // slice 0 for 0:00 up to eventsPerDay for 23:59 const slice = hour/24*(eventsPerDay-1); // slice 0 for 0:00 up to eventsPerDay for 23:59
const height = (y2-2) - (y1+2); // height of a cell const height = (y2-2) - (y1+2); // height of a cell
@ -107,6 +107,7 @@ const drawEvent = function(ev, curDay, x1, y1, x2, y2) {
const ystart = (y1+2) + slice*sliceHeight; const ystart = (y1+2) + slice*sliceHeight;
g.setColor(bgEvent).fillRect(x1+1, ystart, x2-2, ystart+sliceHeight); g.setColor(bgEvent).fillRect(x1+1, ystart, x2-2, ystart+sliceHeight);
break; break;
}
case "h": // holiday case "h": // holiday
g.setColor(bgColorWeekend).fillRect(x1+1, y1+1, x2-1, y2-1); g.setColor(bgColorWeekend).fillRect(x1+1, y1+1, x2-1, y2-1);
break; break;

View File

@ -1,3 +1,4 @@
0.01: New App! 0.01: New App!
0.02: Bugfixes 0.02: Bugfixes
0.03: Use Bangle.setBacklight() 0.03: Use Bangle.setBacklight()
0.04: Add option to buzz after computer move

View File

@ -7,16 +7,17 @@ const FIELD_WIDTH = Bangle.appRect.w/8;
const FIELD_HEIGHT = Bangle.appRect.h/8; const FIELD_HEIGHT = Bangle.appRect.h/8;
const SETTINGS_FILE = "chess.json"; const SETTINGS_FILE = "chess.json";
const ICON_SIZE=45; const ICON_SIZE=45;
const ICON_BISHOP = require("heatshrink").decompress(atob("lstwMB/4Ac/wFE4IED/kPAofgn4FDGon8j4QEBQgQE4EHBQcACwfAgF/BQYWD8EAHAX+NgI4C+AQEwAQDDYIhDDYMDCAQKBGQQsHHogKDCAJODCAI3CHoQKCHoIQDHoIQCFgoQBFgfgIQYmBEIQECKgIrCBYQKDC4OBg/8iCvEAC+AA=")); const get_icon_bishop = () => require("heatshrink").decompress(atob("lstwMB/4Ac/wFE4IED/kPAofgn4FDGon8j4QEBQgQE4EHBQcACwfAgF/BQYWD8EAHAX+NgI4C+AQEwAQDDYIhDDYMDCAQKBGQQsHHogKDCAJODCAI3CHoQKCHoIQDHoIQCFgoQBFgfgIQYmBEIQECKgIrCBYQKDC4OBg/8iCvEAC+AA="));
const ICON_PAWN = require("heatshrink").decompress(atob("lstwMB/4At/AFEGon4h4FDwE/AgX8CAngCAkAv4bDgYbECAf4gAhD4AhD/kAg4mDCAkACAYbBEIYQBG4gbDEII9DFhXAgEfBQYWDEwJUC/wKBGQXwCAgEBE4RCBCAYmBCAQmCCAQmBCAbdCCAIbCQ4gAYwA=")); const get_icon_pawn = () => require("heatshrink").decompress(atob("lstwMB/4At/AFEGon4h4FDwE/AgX8CAngCAkAv4bDgYbECAf4gAhD4AhD/kAg4mDCAkACAYbBEIYQBG4gbDEII9DFhXAgEfBQYWDEwJUC/wKBGQXwCAgEBE4RCBCAYmBCAQmCCAQmBCAbdCCAIbCQ4gAYwA="));
const ICON_KING = require("heatshrink").decompress(atob("lstwMB/4Ac/wFE+4KEh4FD+F/AofvCwgKE+IKEg4bEj4FDwADC/k8g+HAoJhCC4PwAoQXBNod//AECgYfBAoUP/gQE8AQEBQcfCAaLBCAZmBEIZuBBQgyDJAIWCPgXAEAQWDBQRUCPgQnBHgJqBLwYhDOwRvDGQc/EIaSDCwLedwAA==")); const get_icon_king = () => require("heatshrink").decompress(atob("lstwMB/4Ac/wFE+4KEh4FD+F/AofvCwgKE+IKEg4bEj4FDwADC/k8g+HAoJhCC4PwAoQXBNod//AECgYfBAoUP/gQE8AQEBQcfCAaLBCAZmBEIZuBBQgyDJAIWCPgXAEAQWDBQRUCPgQnBHgJqBLwYhDOwRvDGQc/EIaSDCwLedwAA=="));
const ICON_QUEEN = require("heatshrink").decompress(atob("lstwMB/4Ac/l/AgXn4PzAgP+j0Ph4FB8FwuE///PgeDwPn/k8n0+j0f4Hz+Px8F+g/Px+fgf4vgACn/jAAf/x8Pj0en/8vAsB+P/+PBwcHj//w0MjEwJgMwsHBw5CBwMEhBDBPoR6B/gFCDYPgAoRZBAgUH//4AoQbB4AbDCAYbBCAZ1CAgJ7CwAKDGQQmBCAYmBEIQmC+AQEDYQQBDYQQCFgo3CXQIsFBYIEDACmAA=")); const get_icon_queen = () => require("heatshrink").decompress(atob("lstwMB/4Ac/l/AgXn4PzAgP+j0Ph4FB8FwuE///PgeDwPn/k8n0+j0f4Hz+Px8F+g/Px+fgf4vgACn/jAAf/x8Pj0en/8vAsB+P/+PBwcHj//w0MjEwJgMwsHBw5CBwMEhBDBPoR6B/gFCDYPgAoRZBAgUH//4AoQbB4AbDCAYbBCAZ1CAgJ7CwAKDGQQmBCAYmBEIQmC+AQEDYQQBDYQQCFgo3CXQIsFBYIEDACmAA="));
const ICON_ROOK = require("heatshrink").decompress(atob("lstwMB/4Ax/0HgPAAoPwnEOg4FBwBFBn///gEBI4XgAoMPAoJWCv4QDDYXwBQf/4AKD/wmDCARuDGQImCEIQbCGQMDCAQKBj4EB/AFBBQQsgDYQQCNQQhCOog3CCAQ3BEIRvCAoSRCE4IxCKgQmCKgYAZwA=")); const get_icon_rook = () => require("heatshrink").decompress(atob("lstwMB/4Ax/0HgPAAoPwnEOg4FBwBFBn///gEBI4XgAoMPAoJWCv4QDDYXwBQf/4AKD/wmDCARuDGQImCEIQbCGQMDCAQKBj4EB/AFBBQQsgDYQQCNQQhCOog3CCAQ3BEIRvCAoSRCE4IxCKgQmCKgYAZwA="));
const ICON_KNIGHT = require("heatshrink").decompress(atob("lstwMB/4Ann1/AgX48IKD4UPAgX+gEHAoXwgALDJQMfDYQFBEQWAgBSCBQQcC4AFBn///hnCBQPgAgMDGIQnDGIIQDAgQQBEwQQCGIIQCEwMECAQxBsAQBEwMPCAQmBAIJDB4EPDoM/CAIoBKgP4BQQQB/AzCKgJlIPgQ+COwJlCHoJlDJwJlDS4aBDDYQsCADOA")); const get_icon_knight = () => require("heatshrink").decompress(atob("lstwMB/4Ann1/AgX48IKD4UPAgX+gEHAoXwgALDJQMfDYQFBEQWAgBSCBQQcC4AFBn///hnCBQPgAgMDGIQnDGIIQDAgQQBEwQQCGIIQCEwMECAQxBsAQBEwMPCAQmBAIJDB4EPDoM/CAIoBKgP4BQQQB/AzCKgJlIPgQ+COwJlCHoJlDJwJlDS4aBDDYQsCADOA"));
const settings = Object.assign({ const settings = Object.assign({
state: engine.P4_INITIAL_BOARD, state: engine.P4_INITIAL_BOARD,
computer_level: 0, // default to "stupid" which is the fastest computer_level: 0, // default to "stupid" which is the fastest
buzz: false, // Buzz when computer move is done
}, require("Storage").readJSON(SETTINGS_FILE,1) || {}); }, require("Storage").readJSON(SETTINGS_FILE,1) || {});
const ovr = Graphics.createArrayBuffer(Bangle.appRect.w,Bangle.appRect.h,2,{msb:true}); const ovr = Graphics.createArrayBuffer(Bangle.appRect.w,Bangle.appRect.h,2,{msb:true});
@ -56,22 +57,22 @@ const drawPiece = (buf, x, y, piece) => {
switch(piece & ~0x1) { switch(piece & ~0x1) {
case engine.P4_PAWN: case engine.P4_PAWN:
icon = ICON_PAWN; icon = get_icon_pawn();
break; break;
case engine.P4_BISHOP: case engine.P4_BISHOP:
icon = ICON_BISHOP; icon = get_icon_bishop();
break; break;
case engine.P4_KING: case engine.P4_KING:
icon = ICON_KING; icon = get_icon_king();
break; break;
case engine.P4_QUEEN: case engine.P4_QUEEN:
icon = ICON_QUEEN; icon = get_icon_queen();
break; break;
case engine.P4_ROOK: case engine.P4_ROOK:
icon = ICON_ROOK; icon = get_icon_rook();
break; break;
case engine.P4_KNIGHT: case engine.P4_KNIGHT:
icon = ICON_KNIGHT; icon = get_icon_knight();
break; break;
} }
@ -177,7 +178,7 @@ const move = (from,to,cbok) => {
}; };
const showMessage = (msg) => { const showMessage = (msg) => {
g.setColor("#f00").setFont("4x6:2").setFontAlign(-1,1).drawString(msg, 10, Bangle.appRect.y2-10); g.setColor("#f00").setFont("4x6:2").setFontAlign(-1,1).drawString(msg, 10, Bangle.appRect.y2-10).flip();
}; };
// Run // Run
@ -223,7 +224,6 @@ Bangle.on('touch', (button, xy) => {
showMessage(/*LANG*/"Moving.."); showMessage(/*LANG*/"Moving..");
const posFrom = idx2Pos(startfield[0]/FIELD_WIDTH, startfield[1]/FIELD_HEIGHT); const posFrom = idx2Pos(startfield[0]/FIELD_WIDTH, startfield[1]/FIELD_HEIGHT);
const posTo = idx2Pos(colTo/FIELD_WIDTH, rowTo/FIELD_HEIGHT); const posTo = idx2Pos(colTo/FIELD_WIDTH, rowTo/FIELD_HEIGHT);
setTimeout(() => {
const cb = () => { const cb = () => {
// human move ok, update // human move ok, update
drawBoard(); drawBoard();
@ -232,7 +232,6 @@ Bangle.on('touch', (button, xy) => {
// do computer move // do computer move
Bangle.setBacklight(false); // this can take some time, turn off to save power Bangle.setBacklight(false); // this can take some time, turn off to save power
showMessage(/*LANG*/"Calculating.."); showMessage(/*LANG*/"Calculating..");
setTimeout(() => {
const compMove = state.findmove(settings.computer_level+1); const compMove = state.findmove(settings.computer_level+1);
const result = move(compMove[0], compMove[1]); const result = move(compMove[0], compMove[1]);
if (result.ok) { if (result.ok) {
@ -241,14 +240,15 @@ Bangle.on('touch', (button, xy) => {
Bangle.setLCDPower(true); Bangle.setLCDPower(true);
Bangle.setLocked(false); Bangle.setLocked(false);
Bangle.setBacklight(true); Bangle.setBacklight(true);
if (settings.buzz) {
Bangle.buzz(500);
}
if (!showmenu) { if (!showmenu) {
showAlert(result.string); showAlert(result.string);
} }
}, 300); // execute after display update
} }
}; };
move(posFrom, posTo,cb); move(posFrom, posTo,cb);
}, 100); // execute after display update
} // piece_sel === 0 } // piece_sel === 0
startfield[0] = startfield[1] = undefined; startfield[0] = startfield[1] = undefined;
piece_sel = 0; piece_sel = 0;
@ -298,5 +298,12 @@ setWatch(() => {
writeSettings(); writeSettings();
} }
}, },
/*LANG*/'Buzz on next turn': {
value: !!settings.buzz,
onchange: v => {
settings.buzz = v;
writeSettings();
}
},
}); });
}, BTN, { repeat: true, edge: "falling" }); }, BTN, { repeat: true, edge: "falling" });

View File

@ -2,7 +2,7 @@
"id": "chess", "id": "chess",
"name": "Chess", "name": "Chess",
"shortName": "Chess", "shortName": "Chess",
"version": "0.03", "version": "0.04",
"description": "Chess game based on the [p4wn engine](https://p4wn.sourceforge.net/). Drag on the touchscreen to move the green cursor onto a piece, select it with a single touch and drag the now red cursor around. Release the piece with another touch to finish the move. The button opens a menu.", "description": "Chess game based on the [p4wn engine](https://p4wn.sourceforge.net/). Drag on the touchscreen to move the green cursor onto a piece, select it with a single touch and drag the now red cursor around. Release the piece with another touch to finish the move. The button opens a menu.",
"icon": "app.png", "icon": "app.png",
"tags": "game", "tags": "game",

View File

@ -64,7 +64,7 @@
switch (true) { switch (true) {
case (Radius > outerRadius): Color = '#000000'; break; case (Radius > outerRadius): Color = '#000000'; break;
case (Radius < innerRadius): Color = '#FFFFFF'; break; case (Radius < innerRadius): Color = '#FFFFFF'; break;
default: default: {
let Phi = Math.atan2(dy,dx) + halfPi; let Phi = Math.atan2(dy,dx) + halfPi;
if (Phi < 0) { Phi += twoPi; } if (Phi < 0) { Phi += twoPi; }
if (Phi > twoPi) { Phi -= twoPi; } if (Phi > twoPi) { Phi -= twoPi; }
@ -72,6 +72,7 @@
let Index = Math.floor(12*Phi/twoPi); let Index = Math.floor(12*Phi/twoPi);
Color = ColorList[Index]; Color = ColorList[Index];
} }
}
g.setColor(1,1,1); g.setColor(1,1,1);
g.fillCircle(CenterX,CenterY, innerRadius); g.fillCircle(CenterX,CenterY, innerRadius);

View File

@ -894,7 +894,7 @@
g.setFontAlign(-1,0); g.setFontAlign(-1,0);
g.drawString('9', CenterX-outerRadius,CenterY); g.drawString('9', CenterX-outerRadius,CenterY);
break; break;
case '1-12': case '1-12': {
let innerRadius = outerRadius * 0.9 - 10; let innerRadius = outerRadius * 0.9 - 10;
let dark = g.theme.dark; let dark = g.theme.dark;
@ -943,6 +943,7 @@
g.drawString(i == 0 ? '12' : '' + i, x,y); g.drawString(i == 0 ? '12' : '' + i, x,y);
} }
} }
}
let now = new Date(); let now = new Date();

View File

@ -70,7 +70,7 @@ function drawSimpleClock() {
var dom = new Date(d.getFullYear(), d.getMonth()+1, 0).getDate(); var dom = new Date(d.getFullYear(), d.getMonth()+1, 0).getDate();
//Days since full moon //Days since full moon
var knownnew = new Date(2020,02,24,09,28,0); var knownnew = new Date(2020,2,24,9,28,0);
// Get millisecond difference and divide down to cycles // Get millisecond difference and divide down to cycles
var cycles = (d.getTime()-knownnew.getTime())/1000/60/60/24/29.53; var cycles = (d.getTime()-knownnew.getTime())/1000/60/60/24/29.53;

View File

@ -136,19 +136,21 @@ function rIcon(l) {
const x2 = l.x+l.w-1, const x2 = l.x+l.w-1,
y2 = l.y+l.h-1; y2 = l.y+l.h-1;
switch(l.icon) { switch(l.icon) {
case "pause": case "pause": {
const w13 = l.w/3; const w13 = l.w/3;
g.drawRect(l.x, l.y, l.x+w13, y2); g.drawRect(l.x, l.y, l.x+w13, y2);
g.drawRect(l.x+l.w-w13, l.y, x2, y2); g.drawRect(l.x+l.w-w13, l.y, x2, y2);
break; break;
case "play": }
case "play": {
g.drawPoly([ g.drawPoly([
l.x, l.y, l.x, l.y,
x2, l.y+l.h/2, x2, l.y+l.h/2,
l.x, y2, l.x, y2,
], true); ], true);
break; break;
case "previous": }
case "previous": {
const w15 = l.w*1/5; const w15 = l.w*1/5;
g.drawPoly([ g.drawPoly([
x2, l.y, x2, l.y,
@ -157,7 +159,8 @@ function rIcon(l) {
], true); ], true);
g.drawRect(l.x, l.y, l.x+w15, y2); g.drawRect(l.x, l.y, l.x+w15, y2);
break; break;
case "next": }
case "next": {
const w45 = l.w*4/5; const w45 = l.w*4/5;
g.drawPoly([ g.drawPoly([
l.x, l.y, l.x, l.y,
@ -166,7 +169,8 @@ function rIcon(l) {
], true); ], true);
g.drawRect(l.x+w45, l.y, x2, y2); g.drawRect(l.x+w45, l.y, x2, y2);
break; break;
default: // red X }
default: { // red X
console.log(`Unknown icon: ${l.icon}`); console.log(`Unknown icon: ${l.icon}`);
g.setColor("#f00") g.setColor("#f00")
.drawRect(l.x, l.y, x2, y2) .drawRect(l.x, l.y, x2, y2)
@ -174,6 +178,7 @@ function rIcon(l) {
.drawLine(l.x, y2, x2, l.y); .drawLine(l.x, y2, x2, l.y);
} }
} }
}
let layout; let layout;
function makeUI() { function makeUI() {
Bangle.loadWidgets(); Bangle.loadWidgets();

View File

@ -4,7 +4,7 @@ Logs health data to a file in a defined interval, and provides an app to view it
## Usage ## Usage
Once installed, health data is logged automatically. Once installed, health data is logged automatically. Entries are stored with a 10 minute interval.
To view data, run the `Health` app from your watch. To view data, run the `Health` app from your watch.
@ -40,6 +40,8 @@ minifier used in the App Loader, so we use the closure compiler to pre-minify th
The easiest way to use it is to install `https://github.com/espruino/EspruinoDocs` The easiest way to use it is to install `https://github.com/espruino/EspruinoDocs`
and run `EspruinoDocs/bin/minify.js lib.js lib.min.js` and run `EspruinoDocs/bin/minify.js lib.js lib.min.js`
HRM data is stored as a number representing the best/average value from a 10 minute period.
## TODO ## TODO
* `interface` page for desktop to allow data to be viewed and exported in common formats * `interface` page for desktop to allow data to be viewed and exported in common formats

View File

@ -20,17 +20,17 @@ const allWords = [
const timeOfDay = { const timeOfDay = {
0: ["", 0, 0], 0: ["", 0, 0],
1: ["EARLYMORNING", 10, 20, 30, 40, 50, 02, 12, 22, 32, 42, 52, 62], 1: ["EARLYMORNING", 10, 20, 30, 40, 50, 2, 12, 22, 32, 42, 52, 62],
2: ["MORNING", 02, 12, 22, 32, 42, 52, 62], 2: ["MORNING", 2, 12, 22, 32, 42, 52, 62],
3: ["LATEMORNING", 01, 11, 21, 31, 02, 12, 22, 32, 42, 52, 62], 3: ["LATEMORNING", 1, 11, 21, 31, 2, 12, 22, 32, 42, 52, 62],
4: ["MIDDAY", 13, 23, 33, 54, 64, 74], 4: ["MIDDAY", 13, 23, 33, 54, 64, 74],
5: ["EARLYAFTERNOON", 10, 20, 30, 40, 50, 04, 14, 24, 34, 44, 70, 71, 72, 73], 5: ["EARLYAFTERNOON", 10, 20, 30, 40, 50, 4, 14, 24, 34, 44, 70, 71, 72, 73],
6: ["AFTERNOON", 04, 14, 24, 34, 44, 70, 71, 72, 73], 6: ["AFTERNOON", 4, 14, 24, 34, 44, 70, 71, 72, 73],
7: ["LATEAFTERNOON", 01, 11, 21, 31, 04, 14, 24, 34, 44, 70, 71, 72, 73], 7: ["LATEAFTERNOON", 1, 11, 21, 31, 4, 14, 24, 34, 44, 70, 71, 72, 73],
8: ["EARLYEVENING", 10, 20, 30, 40, 50, 06, 16, 26, 36, 46, 56, 66], 8: ["EARLYEVENING", 10, 20, 30, 40, 50, 6, 16, 26, 36, 46, 56, 66],
9: ["EVENING", 06, 16, 26, 36, 46, 56, 66], 9: ["EVENING", 6, 16, 26, 36, 46, 56, 66],
10: ["NIGHT", 37, 47, 57, 67, 77], 10: ["NIGHT", 37, 47, 57, 67, 77],
11: ["MIDDLEOFTHENIGHT", 13, 23, 33, 43, 53, 63, 05, 15, 45, 55, 65, 37,47,57,67,77 ], 11: ["MIDDLEOFTHENIGHT", 13, 23, 33, 43, 53, 63, 5, 15, 45, 55, 65, 37,47,57,67,77 ],
}; };

View File

@ -789,6 +789,25 @@ var locales = {
day: "Søndag,Mandag,Tirsdag,Onsdag,Torsdag,Fredag,Lørdag", day: "Søndag,Mandag,Tirsdag,Onsdag,Torsdag,Fredag,Lørdag",
trans: { yes: "ja", Yes: "Ja", no: "nei", No: "Nei", ok: "ok", on: "på", off: "av", "< Back": "< Tilbake", "Delete": "Slett", "Mark Unread": "Merk som ulest" } trans: { yes: "ja", Yes: "Ja", no: "nei", No: "Nei", ok: "ok", on: "på", off: "av", "< Back": "< Tilbake", "Delete": "Slett", "Mark Unread": "Merk som ulest" }
}, },
"ca_ES": {
lang: "es_ES",
decimal_point: ",",
thousands_sep: ".",
currency_symbol: "€",
int_curr_symbol: "EUR",
speed: "kmh",
distance: { 0: "m", 1: "km" },
temperature: "°C",
ampm: { 0: "", 1: "" },
timePattern: { 0: "%HH:%MM:%SS", 1: "%HH:%MM" },
datePattern: { 0: "%A, %d de %B %Y", "1": "%d/%m/%y" },
abmonth: "gen.,febr.,març,abr.,maig,juny,jul.,ag.,set.,oct.,nov.,des.",
month: "gener,febrer,març,abril,maig,juny,juliol,agost,setembre,octobre,novembre,desembre",
abday: "dg.,dl.,dt.,dc.,dj.,dv.,ds.",
day: "diumenge,dilluns,dimarts,dimecres,dijous,divendres,dissabte",
trans: { yes: "sí", Yes: "Sí", no: "no", No: "No", ok: "d'acord", on: "on", off: "off",
"< Back": "< Enrere", "Delete": "Esborra", "Mark Unread": "Marca com a no llegit" }
},
/*, /*,
"he_IL": { // This won't work until we get a font - see https://github.com/espruino/BangleApps/issues/399 "he_IL": { // This won't work until we get a font - see https://github.com/espruino/BangleApps/issues/399
codePage : "ISO8859-8", codePage : "ISO8859-8",

View File

@ -134,11 +134,12 @@ function truncStr(str, max) {
function phoneInbound(evt) { function phoneInbound(evt) {
switch (evt.t) { switch (evt.t) {
case 'notify': case 'notify': {
const sender = truncStr(evt.sender, 10); const sender = truncStr(evt.sender, 10);
const subject = truncStr(evt.subject, 15); const subject = truncStr(evt.subject, 15);
phoneNewMessage("notify", `${sender} - '${subject}'`); phoneNewMessage("notify", `${sender} - '${subject}'`);
break; break;
}
case 'call': case 'call':
if (evt.cmd === "accept") { if (evt.cmd === "accept") {
let nameOrNumber = "Unknown"; let nameOrNumber = "Unknown";

View File

@ -54,7 +54,7 @@ let manageEvent = function(ovr, event) {
showMessage(ovr, event); showMessage(ovr, event);
break; break;
case "modify": case "modify": {
let find = false; let find = false;
eventQueue.forEach(element => { eventQueue.forEach(element => {
if (element.id == event.id) { if (element.id == event.id) {
@ -68,7 +68,7 @@ let manageEvent = function(ovr, event) {
if (!callInProgress) if (!callInProgress)
showMessage(ovr, event); showMessage(ovr, event);
break; break;
}
case "remove": case "remove":
if (eventQueue.length == 0 && !callInProgress) if (eventQueue.length == 0 && !callInProgress)
next(ovr); next(ovr);

View File

@ -248,7 +248,7 @@ function handleState(fastUpdate){
*/ */
var minutes = state.currentDate.getMinutes(); var minutes = state.currentDate.getMinutes();
var hours = state.currentDate.getHours(); var hours = state.currentDate.getHours();
if(!isAlarmEnabled() && fastUpdate && hours == 00 && minutes == 01){ if(!isAlarmEnabled() && fastUpdate && hours == 0 && minutes == 1){
state.sleep = true; state.sleep = true;
return; return;
} }

View File

@ -318,7 +318,7 @@ function handleInput(button) {
showSettingsMenu(); showSettingsMenu();
return; return;
case 3: case 3:
case 4: case 4: {
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);
@ -327,6 +327,7 @@ function handleInput(button) {
if (firstShownSet < lLimit) firstShownSet = lLimit; if (firstShownSet < lLimit) firstShownSet = lLimit;
break; break;
} }
}
draw(); draw();
} }

View File

@ -1391,7 +1391,7 @@ function initLevel(aRandomSeed, noLoading) {
boardWidth = 10; boardWidth = 10;
boardHeight = 8; boardHeight = 8;
break; break;
case DIFFRANDOM: case DIFFRANDOM: {
let rnd = random(255); let rnd = random(255);
boardWidth = 5 + (rnd % (MAXBOARDWIDTH - 5 + 1)); //5 is smallest level width from very easy boardWidth = 5 + (rnd % (MAXBOARDWIDTH - 5 + 1)); //5 is smallest level width from very easy
rnd = random(255); rnd = random(255);
@ -1399,6 +1399,7 @@ function initLevel(aRandomSeed, noLoading) {
maxLevel = 0; //special value with random maxLevel = 0; //special value with random
break; break;
} }
}
//add space for arrows based on same posadd value (1 or 0 depending if sliding is allowed) //add space for arrows based on same posadd value (1 or 0 depending if sliding is allowed)
boardWidth -= posAdd + posAdd; boardWidth -= posAdd + posAdd;
boardHeight -= posAdd + posAdd; boardHeight -= posAdd + posAdd;

View File

@ -12,24 +12,24 @@ const allWords = [
const hours = { const hours = {
0: ["", 0, 0], 0: ["", 0, 0],
1: ["ONE", 17, 47, 77], 1: ["ONE", 17, 47, 77],
2: ["TWO", 06, 16, 17], 2: ["TWO", 6, 16, 17],
3: ["THREE", 35, 45, 55, 65, 75], 3: ["THREE", 35, 45, 55, 65, 75],
4: ["FOUR", 07, 17, 27, 37], 4: ["FOUR", 7, 17, 27, 37],
5: ["FIVE", 04, 14, 24, 34], 5: ["FIVE", 4, 14, 24, 34],
6: ["SIX", 05, 15, 25], 6: ["SIX", 5, 15, 25],
7: ["SEVEN", 05, 46, 56, 66, 67], 7: ["SEVEN", 5, 46, 56, 66, 67],
8: ["EIGHT", 34, 44, 54, 64, 74], 8: ["EIGHT", 34, 44, 54, 64, 74],
9: ["NINE", 47, 57, 67, 77], 9: ["NINE", 47, 57, 67, 77],
10: ["TEN", 74, 75, 76], 10: ["TEN", 74, 75, 76],
11: ["ELEVEN", 26, 36, 46, 56, 66, 76], 11: ["ELEVEN", 26, 36, 46, 56, 66, 76],
12: ["TWELVE", 06, 16, 26, 36, 56, 66] 12: ["TWELVE", 6, 16, 26, 36, 56, 66]
}; };
const mins = { const mins = {
0: ["A", 0, 0], 0: ["A", 0, 0],
1: ["FIVE", 02, 12, 22, 32], 1: ["FIVE", 2, 12, 22, 32],
2: ["TEN", 10, 30, 40], 2: ["TEN", 10, 30, 40],
3: ["QUARTER", 01, 11, 21, 31, 41, 51, 61], 3: ["QUARTER", 1, 11, 21, 31, 41, 51, 61],
4: ["TWENTY", 10, 20, 30, 40, 50, 60], 4: ["TWENTY", 10, 20, 30, 40, 50, 60],
5: ["HALF", 42, 52, 62, 72], 5: ["HALF", 42, 52, 62, 72],
6: ["PAST", 13, 23, 33, 43], 6: ["PAST", 13, 23, 33, 43],