Skip to content

Commit 449d6fe

Browse files
authored
Merge pull request espruino#4101 from RKBoss6/sleeplogqolfixes
[SleepLog] Make date title easier to follow at a glance, update documentation in README
2 parents aca8ecd + 2824d11 commit 449d6fe

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

apps/sleeplog/ChangeLog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
0.18: Add back as a function to prevent translation making it a menu entry
1717
0.19: Write sleep state into health event's .activity field
1818
0.20: Increase default sleep thresholds, tweak settings to allow higher ones to be chosen
19-
0.21: Use HRM data is polling is enabled, and add appropriate thresholds in settings. Change settings to feel more intuitive, rather than copied settings in different pages.
19+
0.21: Use HRM data if polling is enabled, and add appropriate thresholds in settings. Change settings to feel more intuitive, rather than copied settings in different pages.
2020
0.22: Fix bug with HRM threshold not updating due to movement thresholds being incorrectly compared against the HRM thresholds.
2121
0.23: Fix important bug with HRM data being undefined when compared - broken apps should work properly now
22+
0.24: Change day title to be easier to read, capitalization, and improved documentation/tuning guide in README.

apps/sleeplog/README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Logfiles are not removed on un-/reinstall to prevent data loss.
3232
#### Controls:
3333
- __swipe left & right__
3434
to change the displayed day
35-
- __touch the "title"__ (e.g. `Night to Fri 20/05/2022`)
35+
- __touch the "title"__ (e.g. `Thu to Fri 20/05/2022`)
3636
to enter day selection prompt
3737
- __touch the info area__
3838
to change the displayed information
@@ -56,14 +56,22 @@ Logfiles are not removed on un-/reinstall to prevent data loss.
5656
---
5757
### Settings Usage
5858
---
59-
59+
#### Tuning guide
60+
To make sure the app accurately provides sleep information, it's a good idea to change the default thresholds to find one that works for you. A step-by-step process would be:
61+
- Set the thresholds (movement or hrm, depending on what you use) to be high.
62+
- Every day, look at the sleep it tracked and see if it's accurate or not.
63+
- If it doesn't detect much, reduce the thresholds.
64+
- If it detects more than it should, increase slightly until you find an accurate setting.
65+
#### Settings
66+
67+
6068
- __HRM Thresholds__ submenu
6169

6270
Changes take effect from now on, not retrospective! HRM works only if polling is enabled in `Health` settings
6371
- __Deep Sleep__ | deep sleep threshold
64-
_30_ / _31_ / ... / __100__ / ... / _200_
72+
_40_ / _41_ / ... / __60__ / ... / _80_
6573
- __Light Sleep__ | light sleep threshold
66-
_100_ / _110_ / ... / __200__ / ... / _400_
74+
_50_ / _51_ / ... / __74__ / ... / _90_
6775
- __Reset to Default__ | reset to bold values above
6876
- __Movement Thresholds__ submenu
6977

apps/sleeplog/app.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,16 @@ function drawingCycle(calcDate, thisID, cycle, log) {
153153
infoData = slMod.getStats(calcDate, 0, log);
154154
infoData = [
155155
[
156-
[ /*LANG*/"consecutive\nsleeping", infoData.consecSleep],
157-
[ /*LANG*/"true\nsleeping", infoData.deepSleep + infoData.lightSleep]
156+
[ /*LANG*/"Consec.\nsleep", infoData.consecSleep],
157+
[ /*LANG*/"True\nsleep", infoData.deepSleep + infoData.lightSleep]
158158
],
159159
[
160-
[ /*LANG*/"deep\nsleep", infoData.deepSleep],
161-
[ /*LANG*/"light\nsleep", infoData.lightSleep]
160+
[ /*LANG*/"Deep\nsleep", infoData.deepSleep],
161+
[ /*LANG*/"Light\nsleep", infoData.lightSleep]
162162
],
163163
[
164-
[ /*LANG*/"awake", infoData.awakeTime],
165-
[ /*LANG*/"not worn", infoData.notWornTime]
164+
[ /*LANG*/"Awake", infoData.awakeTime],
165+
[ /*LANG*/"Not worn", infoData.notWornTime]
166166
]
167167
];
168168
// draw info
@@ -235,10 +235,11 @@ function draw() {
235235

236236
// set date to calculate data for
237237
var calcDate = new Date(startDate - prevDays * 864E5);
238-
238+
var oneDayAgo = new Date(startDate - prevDays * 864E5);
239+
oneDayAgo.setDate(oneDayAgo.getDate() - 1);
239240
// draw title
240241
g.setFont("12x20").setFontAlign(0, -1)
241-
.drawString( /*LANG*/"Night to " + require('locale').dow(calcDate, 1) + "\n" +
242+
.drawString(require('locale').dow(oneDayAgo, 1)+" to " + require('locale').dow(calcDate, 1) + "\n" +
242243
require('locale').date(calcDate, 1), 87, 28);
243244

244245
// reset graphics and define image string
@@ -262,7 +263,7 @@ function draw() {
262263
// show loading info with progresss bar
263264
g.reset().drawRect(7, 117, width - 8, 157)
264265
.setFont("6x8").setFontAlign(0, 0)
265-
.drawString( /*LANG*/ "calculating data ...\nplease be patient :)", 87, 133)
266+
.drawString( /*LANG*/ "Calculating...\nPlease be patient :)", 87, 133)
266267
.drawRect(17, 145, 157, 151);
267268

268269
// draw first progress

apps/sleeplog/metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"id":"sleeplog",
33
"name":"Sleep Log",
44
"shortName": "SleepLog",
5-
"version": "0.23",
6-
"description": "Log and view your sleeping habits. This app uses built in movement calculations, or HRM data, if enabled. View data from Bangle.js, or from the web app.",
5+
"version": "0.24",
6+
"description": "Log and view your sleeping habits. This app uses built in movement calculations or HRM data, if enabled. View data from Bangle.js, or from the web app.",
77
"icon": "app.png",
88
"type": "app",
99
"tags": "tool,boot,health",

0 commit comments

Comments
 (0)