mirror of https://github.com/espruino/BangleApps
Active Pedometer 0.04
parent
8dd71947bd
commit
dd014d5a26
|
@ -1,3 +1,4 @@
|
||||||
0.01: New Widget!
|
0.01: New Widget!
|
||||||
0.02: Distance calculation and display
|
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
|
|
@ -18,7 +18,7 @@ Steps are saved to a datafile every 5 minutes. You can watch a graph using the a
|
||||||
* 10600 steps
|
* 10600 steps
|
||||||

|

|
||||||
|
|
||||||
## Features
|
## Features Widget
|
||||||
|
|
||||||
* Two line display
|
* Two line display
|
||||||
* Can display distance (in km) or steps in each line
|
* 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)
|
* 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
|
* 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 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
|
* Format: now,stepsCounted,active,stepsTooShort,stepsTooLong,stepsOutsideTime
|
||||||
* now is UNIX timestamp in ms
|
* 'now' is UNIX timestamp in ms
|
||||||
* You can chose the app to watch a steps graph
|
* You can use the app to watch a steps graph
|
||||||
* You can import the file into Excel
|
* You can import the file into Excel
|
||||||
* The file does not include a header
|
* 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 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
|
* 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
|
## Settings
|
||||||
|
|
||||||
* Max time (ms): Maximum time between two steps in milliseconds, steps will not be counted if exceeded. Standard: 1100
|
* Max time (ms): Maximum time between two steps in milliseconds, steps will not be counted if exceeded. Standard: 1100
|
||||||
|
|
|
@ -33,27 +33,28 @@
|
||||||
|
|
||||||
function storeData() {
|
function storeData() {
|
||||||
now = new Date();
|
now = new Date();
|
||||||
month = now.getMonth() + 1;
|
month = now.getMonth() + 1; //month is 0-based
|
||||||
if (month < 10) month = "0" + month;
|
if (month < 10) month = "0" + month; //leading 0
|
||||||
filename = filename = "activepedom" + now.getFullYear() + month + now.getDate() + ".data";
|
filename = filename = "activepedom" + now.getFullYear() + month + now.getDate() + ".data"; //new file for each day
|
||||||
dataFile = s.open(filename,"a");
|
dataFile = s.open(filename,"a");
|
||||||
if (dataFile) {
|
if (dataFile) { //check if filen already exists
|
||||||
if (dataFile.getLength() == 0) {
|
if (dataFile.getLength() == 0) {
|
||||||
stepsToWrite = 0;
|
//new day, set steps to 0
|
||||||
}
|
stepsCounted = 0;
|
||||||
else {
|
stepsTooShort = 0;
|
||||||
stepsToWrite = stepsCounted;
|
stepsTooLong = 0;
|
||||||
|
stepsOutsideTime = 0;
|
||||||
}
|
}
|
||||||
dataFile.write([
|
dataFile.write([
|
||||||
now.getTime(),
|
now.getTime(),
|
||||||
stepsToWrite,
|
stepsCounted,
|
||||||
active,
|
active,
|
||||||
stepsTooShort,
|
stepsTooShort,
|
||||||
stepsTooLong,
|
stepsTooLong,
|
||||||
stepsOutsideTime,
|
stepsOutsideTime,
|
||||||
].join(",")+"\n");
|
].join(",")+"\n");
|
||||||
}
|
}
|
||||||
dataFile = undefined;
|
dataFile = undefined; //save memory
|
||||||
}
|
}
|
||||||
|
|
||||||
//return setting
|
//return setting
|
||||||
|
|
Loading…
Reference in New Issue