@@ -62,12 +62,14 @@ bool hrm_new(int ppgValue, Vector3 *acc) {
62
62
hrmInfo .raw = ppgValue ;
63
63
// Feed data into algorithm
64
64
AlgoInputData_t inputData ;
65
- inputData .axes .x = acc -> y >> 5 ; // perpendicular to the direction of the arm
66
- inputData .axes .y = acc -> x >> 5 ; // along the direction of the arm
67
- inputData .axes .z = acc -> z >> 5 ;
65
+ // Acceleration data should have 1G=256 (acc is 1G=8192, so shift by 5 bits)
66
+ inputData .axes .x = - acc -> y >> 5 ; // perpendicular to the direction of the arm (if left-hand, in direction of thumb)
67
+ inputData .axes .y = - acc -> x >> 5 ; // along the direction of the arm (if left-hand, in direction of middle finger)
68
+ inputData .axes .z = acc -> z >> 5 ; // if left-hand, running into palm
68
69
inputData .ppgSample = vcInfo .ppgValue | (vcInfo .wasAdjusted ? 0x1000 : 0 );
69
70
inputData .envSample = vcInfo .envValue ;
70
71
hrmInfo .msSinceLastHRM += timeDiff ;
72
+ // TODO: The VC31 example code uses a static value here (eg hrmPollInterval) - maybe we should do this
71
73
Algo_Input (& inputData , timeDiff , hrmInfo .sportMode , 0 /*surfaceRecogMode*/ ,0 /*opticalAidMode*/ );
72
74
AlgoOutputData_t outputData ;
73
75
Algo_Output (& outputData );
@@ -93,4 +95,4 @@ void hrm_get_hrm_info(JsVar *o) {
93
95
94
96
// Append extra information to an existing HRM-raw event object
95
97
void hrm_get_hrm_raw_info (JsVar * o ) {
96
- }
98
+ }
0 commit comments