@user107850 - I managed to get it to compile with this hack:
I dont think you need to worry about rolling over time_t in 1 year of milli seconds for a test harness where the logs are a few hours at most.
$ git diff
diff --git a/src/types.h b/src/types.h
index 6e74ab1..39a972e 100644
--- a/src/types.h
+++ b/src/types.h
@@ -1,11 +1,12 @@
[#include](https://forum.espruino.com/search/?q=%23include) <inttypes.h>
+#include <time.h>
// type for the accelerometer samples, this depends on your hardware
typedef int16_t accel_t;
// type used for time: warning the algorithm is not robust to roll-over of this variable
// example: a year worth of ms needs 35 bits, 32 bits allows you to store about 50 days of ms
-typedef uint32_t time_t;
+//typedef uint32_t time_t;
// steps count type
// the size of this depends on what is the maximum number of steps you are willing to show and store
$
But when I ran it I didn't match the results you showed in the README file.
I noticed that the step count was just incrementing file on file.
So I looked at the reset code and put a reset in after printing the results from a single test.
See diff below.
diff --git a/src/main.c b/src/main.c
index 0dc2d1d..a4838cb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -69,6 +69,7 @@ void becnhmarkFolder(char *prefix, char *dirname)
fclose(pFile);
}
+ resetStepCounters(); // reset after every run
}
}
closedir(folder);
@@ -89,4 +90,4 @@ int main()
resetStepCounters();
return 0;
-}
\ No newline at end of file
+}
Now the results look more realistic and the 3058.csv result for the Oxford of 3301 steps EXACTLY matches your results.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@user107850 - I managed to get it to compile with this hack:
I dont think you need to worry about rolling over time_t in 1 year of milli seconds for a test harness where the logs are a few hours at most.
But when I ran it I didn't match the results you showed in the README file.
I noticed that the step count was just incrementing file on file.
So I looked at the reset code and put a reset in after printing the results from a single test.
See diff below.
Now the results look more realistic and the 3058.csv result for the Oxford of 3301 steps EXACTLY matches your results.
Can you check the 2 changes I have made to the test framework code are correct.
I will do a pull request for the test files.