You are reading a single comment by @HughB and its replies. Click here to read the full conversation.
  • @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](http://forum.espruino.com/sea­rch/?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.

    $ ./banglejs-algos-tester |grep oxf
    steps-controlled, oxford, 0.csv, 0, 0
    steps-controlled, oxford, 0_1.csv, 0, 0
    steps-controlled, oxford, 0_2.csv, 0, 0
    steps-controlled, oxford, 0_3.csv, 0, 0
    steps-controlled, oxford, 100.csv, 77, 100
    steps-controlled, oxford, 100_1.csv, 79, 100
    steps-controlled, oxford, 100_2.csv, 80, 100
    steps-controlled, oxford, 100_3.csv, 170, 100
    steps-controlled, oxford, 100_4.csv, 268, 100
    steps-controlled, oxford, 100_5.csv, 270, 100
    steps-controlled, oxford, 100_6.csv, 270, 100
    steps-controlled, oxford, 100_7.csv, 270, 100
    steps-controlled, oxford, 150.csv, 326, 150
    steps-controlled, oxford, 150_1.csv, 345, 150
    steps-controlled, oxford, 150_2.csv, 564, 150
    steps-controlled, oxford, 150_3.csv, 727, 150
    steps-controlled, oxford, 150_4.csv, 914, 150
    steps-uncontrolled, oxford, 0_HughB-static.csv, 0, 0
    steps-uncontrolled, oxford, 10134.csv, 17314, 10134
    steps-uncontrolled, oxford, 3058.csv, 20694, 3058
    steps-uncontrolled, oxford, 0_HughB-work-0.csv, 22287, 0
    steps-uncontrolled, oxford, 0_HughB-work-66.csv, 24182, 0
    steps-uncontrolled, oxford, 0_HughB-drive-29min-0.csv, 26783, 0
    steps-uncontrolled, oxford, 0_HughB-drive-36min-0.csv, 29674, 0
    steps-uncontrolled, oxford, 0_HughB-drive-a3-b136.csv, 29678, 0
    $ 
    

    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.

    $ ./banglejs-algos-tester |grep oxf
    steps-controlled, oxford, 0.csv, 0, 0
    steps-controlled, oxford, 0_1.csv, 0, 0
    steps-controlled, oxford, 0_2.csv, 0, 0
    steps-controlled, oxford, 0_3.csv, 0, 0
    steps-controlled, oxford, 100.csv, 113, 100
    steps-controlled, oxford, 100_1.csv, 101, 100
    steps-controlled, oxford, 100_2.csv, 102, 100
    steps-controlled, oxford, 100_3.csv, 91, 100
    steps-controlled, oxford, 100_4.csv, 77, 100
    steps-controlled, oxford, 100_5.csv, 84, 100
    steps-controlled, oxford, 100_6.csv, 80, 100
    steps-controlled, oxford, 100_7.csv, 80, 100
    steps-controlled, oxford, 150.csv, 138, 150
    steps-controlled, oxford, 150_1.csv, 150, 150
    steps-controlled, oxford, 150_2.csv, 192, 150
    steps-controlled, oxford, 150_3.csv, 131, 150
    steps-controlled, oxford, 150_4.csv, 151, 150
    steps-uncontrolled, oxford, 0_HughB-static.csv, 0, 0
    steps-uncontrolled, oxford, 10134.csv, 17314, 10134
    steps-uncontrolled, oxford, 3058.csv, 3301, 3058
    steps-uncontrolled, oxford, 0_HughB-work-0.csv, 1347, 0
    steps-uncontrolled, oxford, 0_HughB-work-66.csv, 1639, 0
    steps-uncontrolled, oxford, 0_HughB-drive-29min-0.csv, 2372, 0
    steps-uncontrolled, oxford, 0_HughB-drive-36min-0.csv, 2651, 0
    steps-uncontrolled, oxford, 0_HughB-drive-a3-b136.csv, 1093, 0
    

    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.

About

Avatar for HughB @HughB started