Skip to content

Commit

Permalink
Merge branch 'espruino:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
indridieinarsson authored Nov 2, 2024
2 parents ad70e34 + 7da2895 commit d75ca1b
Show file tree
Hide file tree
Showing 334 changed files with 50,076 additions and 2,073 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

# Needs to be ignored because it uses ESM export/import
apps/gipy/pkg/gps.js
apps/gipy/pkg/gps.d.ts
apps/gipy/pkg/gps_bg.wasm.d.ts

# Needs to be ignored because it includes broken JS
apps/health/chart.min.js
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ module.exports = {
"getSerial": "readonly",
"getTime": "readonly",
"global": "readonly",
"globalThis": "readonly",
"HIGH": "readonly",
"I2C1": "readonly",
"Infinity": "readonly",
Expand Down
16 changes: 10 additions & 6 deletions android.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,18 @@ <h3>Settings</h3>
</details>
</div>
<div id="more-deviceinfo" style="display:none">
<h3>Device info</h3>
<div id="more-deviceinfo-content"></div>
<h3>Device info</h3>
<div id="more-deviceinfo-content"></div>
<div class="editor--terminal">
<div class="editor__canvas" style="position:relative;height:20rem;display:none;"></div>
<button class="btn" id="terminalEnable">Enable Terminal</button>
</div>
</div>
</div>
</div>

<footer class="floating hidden">
<!-- Install button, hidden by default -->
<!-- PWA Install button, hidden by default -->
<div id="installContainer" class="hidden">
<button id="butInstall" type="button">
Install
Expand All @@ -203,7 +207,7 @@ <h3>Device info</h3>
</footer>

<script src="webtools/puck.js"></script>
<script src="webtools/heatshrink.js"></script>
<script src="webtools/heatshrink.js"></script>
<script src="core/lib/marked.min.js"></script>
<script src="core/lib/espruinotools.js"></script>
<script src="core/js/utils.js"></script>
Expand Down Expand Up @@ -416,7 +420,7 @@ <h3>Device info</h3>
if (webrtc) showWebRTCID(webrtc.peerId);
else {
webrtc = webrtcInit({
bridge:true,
bridge:true,
onStatus : function(s) {
showToast(s);
},
Expand All @@ -432,7 +436,7 @@ <h3>Device info</h3>
onPortDisconnect : function(serialPort) {
},
onPortWrite : function(data, cb) {
Puck.write(data, cb);
Puck.write(data, cb);
}
});
connection.on("data", function(d) {
Expand Down
6 changes: 4 additions & 2 deletions apps/_example_clock/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
var dateStr = require("locale").date(date);
// draw time
g.setFontAlign(0,0).setFont("Vector",48);
g.clearRect(0,y-15,g.getWidth(),y+25); // clear the background
g.clearRect(0,y-20,g.getWidth(),y+25); // clear the background
g.drawString(timeStr,x,y);
// draw date
y += 35;
y += 30;
g.setFontAlign(0,0).setFont("6x8");
g.clearRect(0,y-4,g.getWidth(),y+4); // clear the background
g.drawString(dateStr,x,y);
Expand All @@ -41,6 +41,8 @@
// Show launcher when middle button pressed
Bangle.setUI({mode:"clock", remove:function() {
// free any memory we allocated to allow fast loading
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = undefined;
}});
// Load widgets
Bangle.loadWidgets();
Expand Down
4 changes: 4 additions & 0 deletions apps/alarm/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@
0.46: Show alarm groups if the Show Group setting is ON. Scroll alarms menu back to previous position when getting back to it.
0.47: Fix wrap around when snoozed through midnight
0.48: Use datetimeinput for Events, if available. Scroll back when getting out of group. Menu date format setting for shorter dates on current year.
0.49: fix uncaught error if no scroller (Bangle 1). Would happen when trying
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
the right will do the same.
3 changes: 3 additions & 0 deletions apps/alarm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ It uses the [`sched` library](https://github.com/espruino/BangleApps/blob/master
- `Disable All` &rarr; Disable _all_ enabled alarms & timers
- `Delete All` &rarr; Delete _all_ alarms & timers

On Bangle.js 2 it's possible to toggle alarms, timers and events from the main menu. This is done by clicking the indicator icons of corresponding entries. Or long pressing anywhere on them.

## Creator

- [Gordon Williams](https://github.com/gfwilliams)
Expand All @@ -29,6 +31,7 @@ It uses the [`sched` library](https://github.com/espruino/BangleApps/blob/master
- [Alessandro Cocco](https://github.com/alessandrococco) - New UI, full rewrite, new features
- [Sabin Iacob](https://github.com/m0n5t3r) - Auto snooze support
- [storm64](https://github.com/storm64) - Fix redrawing in submenus
- [thyttan](https://github.com/thyttan) - Toggle alarms directly from main menu.

## Attributions

Expand Down
18 changes: 14 additions & 4 deletions apps/alarm/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,31 @@ function showMainMenu(scroll, group, scrollback) {
const getGroups = settings.showGroup && !group;
const groups = getGroups ? {} : undefined;
var showAlarm;
const getIcon = (e)=>{return e.on ? (e.timer ? iconTimerOn : iconAlarmOn) : (e.timer ? iconTimerOff : iconAlarmOff);};

alarms.forEach((e, index) => {
showAlarm = !settings.showGroup || (group ? e.group === group : !e.group);
if(showAlarm) {
menu[trimLabel(getLabel(e),40)] = {
value: e.on ? (e.timer ? iconTimerOn : iconAlarmOn) : (e.timer ? iconTimerOff : iconAlarmOff),
onchange: () => setTimeout(e.timer ? showEditTimerMenu : showEditAlarmMenu, 10, e, index, undefined, scroller.scroll, group)
const label = trimLabel(getLabel(e),40);
menu[label] = {
value: e.on,
onchange: (v, touch) => {
if (touch && (2==touch.type || 145<touch.x)) { // Long touch or touched icon.
e.on = v;
saveAndReload();
} else {
setTimeout(e.timer ? showEditTimerMenu : showEditAlarmMenu, 10, e, index, undefined, scroller?scroller.scroll:undefined, group);
}
},
format: v=>getIcon(e)
};
} else if (getGroups) {
groups[e.group] = undefined;
}
});

if (!group) {
Object.keys(groups).sort().forEach(g => menu[g] = () => showMainMenu(null, g, scroller.scroll));
Object.keys(groups).sort().forEach(g => menu[g] = () => showMainMenu(null, g, scroller?scroller.scroll:undefined));
menu[/*LANG*/"Advanced"] = () => showAdvancedMenu();
}

Expand Down
2 changes: 1 addition & 1 deletion apps/alarm/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "alarm",
"name": "Alarms & Timers",
"shortName": "Alarms",
"version": "0.48",
"version": "0.50",
"description": "Set alarms and timers on your Bangle",
"icon": "app.png",
"tags": "tool,alarm",
Expand Down
5 changes: 4 additions & 1 deletion apps/android/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@
0.34: Implement API for activity tracks fetching (Recorder app logs).
0.35: Implement API to enable/disable acceleration data tracking.
0.36: Move from wrapper function to {} and let - faster execution at boot
Allow `calendar-` to take an array of items to remove
Allow `calendar-` to take an array of items to remove
0.37: Support Gadgetbridge canned responses
0.38: Don't rewrite settings file on every boot!
0.39: Move GB message handling into a library to reduce boot time from 40ms->13ms
14 changes: 12 additions & 2 deletions apps/android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,21 @@ The boot code also provides some useful functions:
* `body` the body of the HTTP request
* `headers` an object of headers, eg `{HeaderOne : "headercontents"}`

`Bangle.http` returns a promise which contains:

```JS
{
t:"http",
id: // the ID of this HTTP request
resp: "...." // a string containing the response
}
```

eg:

```
```JS
Bangle.http("https://pur3.co.uk/hello.txt").then(data=>{
console.log("Got ",data);
console.log("Got ",data.resp);
});
```

Expand Down
Loading

0 comments on commit d75ca1b

Please sign in to comment.