diff --git a/apps/powermanager/ChangeLog b/apps/powermanager/ChangeLog
index de3fd021c..87bbc80c7 100644
--- a/apps/powermanager/ChangeLog
+++ b/apps/powermanager/ChangeLog
@@ -9,4 +9,6 @@
0.07: Convert Yes/No On/Off in settings to checkboxes
0.08: Fix the wrapping of intervals/timeouts with parameters
Fix the widget drawing if widgets are hidden and Bangle.setLCDBrightness is called
-0.09: Accidental version bump
\ No newline at end of file
+0.09: Accidental version bump
+0.10: Use charging state on boot for auto calibration
+ Log additional timestamp for trace log
diff --git a/apps/powermanager/boot.js b/apps/powermanager/boot.js
index f3e3f718f..c35ec1546 100644
--- a/apps/powermanager/boot.js
+++ b/apps/powermanager/boot.js
@@ -42,10 +42,10 @@
let logPower = (type, oldstate, state, app) => {
- logFile.write("p," + type + ',' + (oldstate?1:0) + ',' + (state?1:0) + ',' + app + "\n");
+ logFile.write(Date.now() + ",p," + type + ',' + (oldstate?1:0) + ',' + (state?1:0) + ',' + app + "\n");
};
let logDeferred = (type, duration, source) => {
- logFile.write(type + ',' + duration + ',' + source.replace(/\n/g, " ").replace(/,/g,"") + "\n");
+ logFile.write(Date.now() + "," + type + ',' + duration + ',' + source.replace(/\n/g, " ").replace(/,/g,"") + "\n");
};
let lastPowerOn = {};
@@ -152,13 +152,14 @@
return v;
};
}
-
+
if (settings.autoCalibration){
let chargeStart;
+ if (Bangle.isCharging()) chargeStart = Date.now();
Bangle.on("charging", (charging)=>{
- if (charging) chargeStart = Date.now();
+ if (!chargeStart && charging) chargeStart = Date.now();
if (chargeStart && !charging && (Date.now() - chargeStart > 1000*60*60*3)) require("powermanager").setCalibration();
if (!charging) chargeStart = undefined;
});
}
-})();
\ No newline at end of file
+})();
diff --git a/apps/powermanager/interface.html b/apps/powermanager/interface.html
index fac49694c..2cab4561a 100644
--- a/apps/powermanager/interface.html
+++ b/apps/powermanager/interface.html
@@ -1,6 +1,15 @@
+
+
@@ -119,18 +128,21 @@ function viewDeferredTable(filename) {
This are functions used in timeouts and intervals and their accumulated execution times. Recorded in a time span of ${timeFormat(duration)}. Timeouts/intervals have run for ${timeFormat(sum)} (${(sum/duration*100).toFixed(2)}%). Percentages are calculated from summarized timeout/interval running time.
-
`;
domContent.innerHTML = htmlOverview;
domContent.querySelector("#back").addEventListener("click",event => {
show();
@@ -234,24 +246,46 @@ function viewDetailsTable(filename) {
Util.hideModal();
var htmlOverview = `
Detailed logging
-
- This is a trace log of all logged power entries, first column denotes the type. p for power, i for interval and t for timeout. Power is logged with old state, new state and calling app if available. Functions are logged with execution duraion and source if available.
-
-
- \n`;
+
+ This is a trace log of all logged entries. Power is logged with type, state transition (old → new) and calling app if available. Functions are logged with execution duration and source if available.
+
+
+
+
+
+
+
Time
+
Type
+
Info
+
+
+ \n`;
let rows = data.trim().split("\n");
+ let firstTimestamp;
for (var row of rows) {
let cols = row.split(",");
- htmlOverview += `
-
${cols[0]}
-
${cols[1]}
-
${cols[2]}
-
${cols[3]}
-
${cols[4]}
-
`
+ let col = 0;
+ if (!firstTimestamp) firstTimestamp = cols[0];
+
+ if (cols[1] == "p"){
+ cols[1] = "Power";
+ htmlOverview += `