Skip to content

Commit ad54f17

Browse files
authored
Merge branch 'espruino:master' into master
2 parents 9b9a17a + d0e4d34 commit ad54f17

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+452
-191
lines changed

apps/agenda/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@
1818
0.16: Correct date for all day events in negative timezones, improve locale display
1919
0.17: Fixed "Today" and "Tomorrow" labels displaying in non-current weeks
2020
0.18: Correct date in clockinfo for all-day events in negative timezones
21+
0.19: Change clockinfo title truncation to preserve images

apps/agenda/agenda.clkinfo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464

6565
agenda.forEach((entry, i) => {
6666

67-
var title = entry.title.slice(0,12);
67+
var title = g.setFont("6x8").wrapString(entry.title,100)[0];
6868
// All day events are always in UTC and always start at 00:00:00, so we
6969
// need to "undo" the timezone offsetting to make sure that the day is
7070
// correct.

apps/agenda/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "agenda",
33
"name": "Agenda",
4-
"version": "0.18",
4+
"version": "0.19",
55
"description": "Simple agenda",
66
"icon": "agenda.png",
77
"screenshots": [{"url":"screenshot_agenda_overview.png"}, {"url":"screenshot_agenda_event1.png"}, {"url":"screenshot_agenda_event2.png"}],

apps/altimeter/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
0.02: Actually upload correct code
33
0.03: Display sea-level pressure, too, and allow calibration
44
0.04: Switch to using system code for pressure calibration
5+
0.05: Prompt before resetting calibration (stops long-press of button resetting calibration)

apps/altimeter/app.js

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var R = Bangle.appRect;
77
var y = R.y + R.h/2;
88
var MEDIANLENGTH = 20;
99
var avr = [];
10+
var updateDisplay = true;
1011

1112
function fmt(t) {
1213
if ((t > -100) && (t < 1000))
@@ -19,48 +20,57 @@ function fmt(t) {
1920
Bangle.on('pressure', function(e) {
2021
while (avr.length>MEDIANLENGTH) avr.pop();
2122
avr.unshift(e.altitude);
22-
let median = avr.slice().sort();
23+
if (!updateDisplay) return;
24+
let median = avr.slice().sort(), value;
2325
g.reset().clearRect(0,y-30,g.getWidth()-10,R.h);
2426
if (median.length>10) {
2527
var mid = median.length>>1;
26-
var value = E.sum(median.slice(mid-4,mid+5)) / 9;
28+
value = E.sum(median.slice(mid-4,mid+5)) / 9;
2729
} else {
28-
var value = median[median.length>>1];
30+
value = median[median.length>>1];
2931
}
30-
t = fmt(value);
32+
var t = fmt(value);
3133

3234
g.setFont("Vector",50).setFontAlign(0,0).drawString(t, g.getWidth()/2, y);
3335

3436
let o = Bangle.getOptions();
3537
let sea = o.seaLevelPressure;
3638
t = sea.toFixed(1) + " " + e.temperature.toFixed(1);
37-
if (0) {
39+
/*if (0) {
3840
print("alt raw:", value.toFixed(1));
3941
print("temperature:", e.temperature);
4042
print("pressure:", e.pressure);
4143
print("sea pressure:", sea);
42-
}
44+
}*/
4345
g.setFont("Vector",25).setFontAlign(-1,0).drawString(t, 10, R.y+R.h - 35);
4446
});
4547

4648
function setPressure(m, a) {
47-
o = Bangle.getOptions();
48-
print(o);
49+
var o = Bangle.getOptions();
50+
//print(o);
4951
o.seaLevelPressure = o.seaLevelPressure * m + a;
5052
Bangle.setOptions(o);
5153
avr = [];
5254
}
5355

54-
print(g.getFonts());
55-
g.reset();
56-
g.setFont("Vector:15");
57-
g.setFontAlign(0,0);
58-
g.drawString(/*LANG*/"ALTITUDE (m)", g.getWidth()/2, y-40);
59-
g.drawString(/*LANG*/"SEA L (hPa) TEMP (C)", g.getWidth()/2, y+62);
60-
g.flip();
61-
g.setFont("6x8").setFontAlign(0,0,3).drawString(/*LANG*/"STD", g.getWidth()-5, g.getHeight()/2);
62-
Bangle.setUI("updown", btn=> {
63-
if (!btn) setPressure(0, 1013.25);
64-
if (btn<0) setPressure(1, 1);
65-
if (btn>0) setPressure(1, -1);
66-
});
56+
function start() {
57+
g.reset();
58+
g.setFont("Vector:15");
59+
g.setFontAlign(0,0);
60+
g.drawString(/*LANG*/"ALTITUDE (m)", g.getWidth()/2, y-40);
61+
g.drawString(/*LANG*/"SEA L (hPa) TEMP (C)", g.getWidth()/2, y+62);
62+
g.setFont("6x8").setFontAlign(0,0,3).drawString(/*LANG*/"STD", g.getWidth()-5, g.getHeight()/2);
63+
updateDisplay = true;
64+
Bangle.setUI("updown", btn => {
65+
if (!btn) {
66+
updateDisplay = false;
67+
E.showPrompt(/*LANG*/"Set calibration to default?",{title:/*LANG*/"Altitude"}).then(function(reset) {
68+
start();
69+
if (reset) setPressure(0, 1013.25);
70+
});
71+
}
72+
if (btn<0) setPressure(1, 1);
73+
if (btn>0) setPressure(1, -1);
74+
});
75+
}
76+
start();

apps/altimeter/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{ "id": "altimeter",
22
"name": "Altimeter",
3-
"version":"0.04",
3+
"version":"0.05",
44
"description": "Simple altimeter that can display height changed using Bangle.js 2's built in pressure sensor.",
55
"icon": "app.png",
66
"tags": "tool,outdoors",

apps/boot/ChangeLog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,5 @@
7575
0.64: Automatically create .widcache and .clkinfocache to speed up loads
7676
Bangle.loadWidgets overwritten with fast version on success
7777
Refuse to work on firmware <2v16 and remove old polyfills
78-
0.65: Only display interpreter errors if log is nonzero
78+
0.65: Only display interpreter errors if log is nonzero
79+
0.66: Ensure __FILE__ is set even after a fresh boot (fix #3857)

apps/boot/bootloader.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ if (!_clkApp) {
2323
require("Storage").writeJSON("setting.json", s);
2424
}
2525
}
26+
if (s.clock) __FILE__=s.clock;
2627
delete s;
2728
if (!_clkApp) _clkApp=`E.showMessage("No Clock Found");setWatch(()=>{Bangle.showLauncher();}, global.BTN2||BTN, {repeat:false,edge:"falling"});`;
2829
eval(_clkApp);
29-
delete _clkApp;
30+
delete _clkApp;

apps/boot/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "boot",
33
"name": "Bootloader",
4-
"version": "0.65",
4+
"version": "0.66",
55
"description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
66
"icon": "bootloader.png",
77
"type": "bootloader",

apps/chargeanim/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
0.01: New App!
22
0.02: Bangle.js 2 compatibility
3+
0.03: Add settings menu for showing time and battery percent with animation.

0 commit comments

Comments
 (0)