Skip to content

Commit

Permalink
Merge branch 'espruino:master' into pushups
Browse files Browse the repository at this point in the history
  • Loading branch information
wagnerf42 authored Nov 22, 2024
2 parents 47d917c + f34a9bf commit 536c7fe
Show file tree
Hide file tree
Showing 501 changed files with 52,295 additions and 3,089 deletions.
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ and which gives information about the app for the Launcher.
"dependencies" : { "message":"widget" } // optional, depend on a specific type of widget - see provides_widgets
"provides_modules" : ["messageicons"] // optional, this app provides a module that can be used with 'require'
"provides_widgets" : ["battery"] // optional, this app provides a type of widget - 'alarm/battery/bluetooth/pedometer/message'
"provides_features" : ["welcome"] // optional, this app provides some feature, used to ensure two aren't installed at once. Currently just 'welcome'
"default" : true, // set if an app is the default implementer of something (a widget/module/etc)
"readme": "README.md", // if supplied, a link to a markdown-style text file
// that contains more information about this app (usage, etc)
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
3 changes: 1 addition & 2 deletions apps/a_dndtoggle/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@
}

E.showMenu(buildMainMenu());
});

})
2 changes: 1 addition & 1 deletion apps/activepedom/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@
},
};
E.showMenu(menu);
});
})
2 changes: 1 addition & 1 deletion apps/agpsdata/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ function buildMainMenu() {
}

E.showMenu(buildMainMenu());
});
})
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
2 changes: 1 addition & 1 deletion apps/alarm/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@
};

E.showMenu(appMenu);
});
})
25 changes: 19 additions & 6 deletions apps/alpinenav/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,39 @@ Alpine Navigator
================
App that performs GPS monitoring to track and display position relative to a given origin in realtime.

![screenshot](./sample.png)
![screenshot](./sample.png)

[compass 5]

altitude
[start 1] [current 2]

distance
[from start 3] [track 4]


[btn1 -- screen lock]
[btn2 -- remove points]
[btn3 -- pause]

Functions
---------
Note if you've not used GPS yet I suggest using one of the GPS apps to get your first fix and confirm as I've found that helps initially.
Note if you've not used GPS yet, I suggest using one of the GPS apps to get your first fix and confirm, as I've found that helps initially.

The GPS and magnetometer will be turned on and after a few moments, when the watch buzzes and the dot turns from red to pink, that means the GPS is fixed. all your movements now will be displayed with a line drawn back to show your position relative to the start. New waypoints will be added based on checking every 10 seconds for at least 5 meters of movement. The map will scale to your distance travelled so the route will always remain within the window, the accelerometer/pedometer is not used - this is a purely GPS and compass solution so can be used for driving/cycling etc. A log file will be recorded that tracks upto 1000 waypoints, this isn't a big file and you could remove the limit but I've kept it fairly conservative here as it's not intended as a main feature, there's already good GPS recorders for the Bangle. The following other items are displayed:
The GPS and magnetometer will be turned on and after a few moments, when the watch buzzes and the dot turns from red to pink, that means the GPS is fixed. All your movements now will be displayed with a line drawn back to show your position relative to the start. New waypoints will be added based on checking every 10 seconds for at least 5 meters of movement. The map will scale to your distance travelled so the route will always remain within the window, the accelerometer/pedometer is not used - this is a purely GPS and compass solution so can be used for driving/cycling etc. A log file will be recorded that tracks upto 1000 waypoints, this isn't a big file and you could remove the limit, but I've kept it fairly conservative here, as it's not intended as a main feature, there's already good GPS recorders for the Bangle. The following other items are displayed:

1. altitude at origin, this is displayed left of the centre.
2. current altitude, displayed centre right
3. distance from origin, bottom left (meters)
4. distance travelled, bottom right (meters)
5. compass heading, at the top

For the display, the route is kept at a set resolution, so there's no risk of running into memory problems if you run this for long periods or any length of time because the waypoints will be reduced when it reaches a set threshold so you may see the path smooth out slightly at intervals.
For the display, the route is kept at a set resolution, so there's no risk of running into memory problems if you run this for long periods or any length of time, because the waypoints will be reduced when it reaches a set threshold, so you may see the path smooth out slightly at intervals.

If you get strange values or dashes for the compass, it just needs calibration so you need to move the watch around briefly for this each time, ideally 360 degrees around itself, which involves taking the watch off. If you don't want to do that you can also just wave your hand around for a few seconds like you're at a rave or Dr Strange making a Sling Ring but often just moving your wrist a bit is enough.
If you get strange values or dashes for the compass, it just needs calibration so you need to move the watch around briefly for this each time, ideally 360 degrees around itself, which involves taking the watch off. If you don't want to do that you can also just wave your hand around for a few seconds like you're at a rave or Dr Strange making a Sling Ring, but often just moving your wrist a bit is enough.

The buttons do the following:
BTN1: this will display an 'X' in the bottom of the screen and lock all the buttons, this is to prevent you accidentally pressing either of the below. Remember to press this again to unlock it! soft and hard reset will both still work.
BTN1: this will display an 'X' in the bottom of the screen and lock all the buttons, this is to prevent you accidentally pressing either of the below. Remember to press this again to unlock it! Soft and hard reset will both still work.
BTN2: this removes all waypoints aside from the origin and your current location; sometimes during smaller journeys and walks, the GPS can give sporadic differences in locations because of the error margins of GPS and this can add noise to your route.
BTN3: this will pause the GPS and magnetometer, useful for saving power for situations where you don't necessarily need to track parts of your route e.g. you're going indoors/shelter for some time. You'll know it's paused because the compass won't update it's reading and all the metrics will be blacked out on the screen.

Expand Down
2 changes: 1 addition & 1 deletion apps/andark/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
};

E.showMenu(appMenu);
});
})
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 536c7fe

Please sign in to comment.