diff --git a/apps/sleeplog/ChangeLog b/apps/sleeplog/ChangeLog index d12c565ac..e21f12757 100644 --- a/apps/sleeplog/ChangeLog +++ b/apps/sleeplog/ChangeLog @@ -2,3 +2,4 @@ 0.02: Fix crash on start #1423 0.03: Added power saving mode, move all read/write log actions into lib/module 0.04: Fix #1445, display loading info, add icons to display service states +0.05: Fix LOW_MEMORY,MEMORY error on to big log size diff --git a/apps/sleeplog/README.md b/apps/sleeplog/README.md index 4b10438ef..b1618c5bf 100644 --- a/apps/sleeplog/README.md +++ b/apps/sleeplog/README.md @@ -21,7 +21,8 @@ also provides a power saving mode using the built in movement calculation. The i * __Logging__ To minimize the log size only a changed state is logged. The logged timestamp is matching the beginning of its measurement period. When not on power saving mode a movement is detected nearly instantaneous and the detection of a no movement period is delayed by the minimal no movement duration. To match the beginning of the measurement period a cached timestamp (_sleeplog.firstnomodate_) is logged. - On power saving mode the measurement period is fixed to 10 minutes and all logged timestamps are also set back 10 minutes. + On power saving mode the measurement period is fixed to 10 minutes and all logged timestamps are also set back 10 minutes. + To prevent a LOW_MEMORY,MEMORY error the log size is limited to 1500 entries, older entries will be overwritten. --- ### Control diff --git a/apps/sleeplog/lib.js b/apps/sleeplog/lib.js index 7b35d8a85..7e3ec7451 100644 --- a/apps/sleeplog/lib.js +++ b/apps/sleeplog/lib.js @@ -98,6 +98,9 @@ exports = { input = log; } + // check and if neccessary reduce logsize to prevent low mem + if (input.length > 1500) input = input.slice(-1500); + // simple check for log plausibility if (input[0].length > 1 && input[0][0] * 1 > 9E11) { // write log to storage diff --git a/apps/sleeplog/metadata.json b/apps/sleeplog/metadata.json index 8cf6979d6..17eab2d1d 100644 --- a/apps/sleeplog/metadata.json +++ b/apps/sleeplog/metadata.json @@ -2,7 +2,7 @@ "id":"sleeplog", "name":"Sleep Log", "shortName": "SleepLog", - "version": "0.04", + "version": "0.05", "description": "Log and view your sleeping habits. This app derived from SleepPhaseAlarm and uses also the principe of Estimation of Stationary Sleep-segments (ESS). It also provides a power saving mode using the built in movement calculation.", "icon": "app.png", "type": "app",