Active Pedometer 0.04

pull/356/head
Purple-Tentacle 2020-04-27 10:35:11 +02:00 committed by GitHub
parent 8dd71947bd
commit dd014d5a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 21 deletions

View File

@ -1,3 +1,4 @@
0.01: New Widget!
0.02: Distance calculation and display
0.03: Data logging and display
0.03: Data logging and display
0.04: Steps are set to 0 in log on new day

View File

@ -18,7 +18,7 @@ Steps are saved to a datafile every 5 minutes. You can watch a graph using the a
* 10600 steps
![](10600.png)
## Features
## Features Widget
* Two line display
* Can display distance (in km) or steps in each line
@ -32,22 +32,23 @@ Steps are saved to a datafile every 5 minutes. You can watch a graph using the a
* Steps are saved to a file and read-in at start (to not lose step progress)
* Settings can be changed in Settings - App/widget settings - Active Pedometer
## Features App
* The app accesses the data stored for the current day
* Timespan is choseable (1h, 4h, 8h, 12h, 16h, 20, 24h), standard is 24h, the whole current day
## Data storage
* Data is stored to a file
* Data is stored to a file named activepedomYYYYMMDD.data (activepedom20200427.data)
* One file is created for each day
* Format: now,stepsCounted,active,stepsTooShort,stepsTooLong,stepsOutsideTime
* now is UNIX timestamp in ms
* You can chose the app to watch a steps graph
* 'now' is UNIX timestamp in ms
* You can use the app to watch a steps graph
* You can import the file into Excel
* The file does not include a header
* You can convert UNIX timestamp to a date in Excel using this formula: =DATUM(1970;1;1)+(LINKS(A2;10)/86400)
* You have to format the cell with the formula to a date cell. Example: JJJJ-MM-TT-hh-mm-ss
## App
* The app accesses the data stored for the current day
* Timespan is choseable (1h, 4h, 8h, 12h, 16h, 20, 24h), standard is 24h, the whole current day
## Settings
* Max time (ms): Maximum time between two steps in milliseconds, steps will not be counted if exceeded. Standard: 1100

View File

@ -162,4 +162,4 @@ settings = storage.readJSON(SETTINGS_FILE, 1) || {};
drawMenu();
})();
})();

View File

@ -33,27 +33,28 @@
function storeData() {
now = new Date();
month = now.getMonth() + 1;
if (month < 10) month = "0" + month;
filename = filename = "activepedom" + now.getFullYear() + month + now.getDate() + ".data";
month = now.getMonth() + 1; //month is 0-based
if (month < 10) month = "0" + month; //leading 0
filename = filename = "activepedom" + now.getFullYear() + month + now.getDate() + ".data"; //new file for each day
dataFile = s.open(filename,"a");
if (dataFile) {
if (dataFile) { //check if filen already exists
if (dataFile.getLength() == 0) {
stepsToWrite = 0;
}
else {
stepsToWrite = stepsCounted;
//new day, set steps to 0
stepsCounted = 0;
stepsTooShort = 0;
stepsTooLong = 0;
stepsOutsideTime = 0;
}
dataFile.write([
now.getTime(),
stepsToWrite,
stepsCounted,
active,
stepsTooShort,
stepsTooLong,
stepsOutsideTime,
].join(",")+"\n");
}
dataFile = undefined;
dataFile = undefined; //save memory
}
//return setting