@@ -62,12 +62,14 @@ bool hrm_new(int ppgValue, Vector3 *acc) {
6262 hrmInfo .raw = ppgValue ;
6363 // Feed data into algorithm
6464 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
6869 inputData .ppgSample = vcInfo .ppgValue | (vcInfo .wasAdjusted ? 0x1000 : 0 );
6970 inputData .envSample = vcInfo .envValue ;
7071 hrmInfo .msSinceLastHRM += timeDiff ;
72+ // TODO: The VC31 example code uses a static value here (eg hrmPollInterval) - maybe we should do this
7173 Algo_Input (& inputData , timeDiff , hrmInfo .sportMode , 0 /*surfaceRecogMode*/ ,0 /*opticalAidMode*/ );
7274 AlgoOutputData_t outputData ;
7375 Algo_Output (& outputData );
@@ -93,4 +95,4 @@ void hrm_get_hrm_info(JsVar *o) {
9395
9496// Append extra information to an existing HRM-raw event object
9597void hrm_get_hrm_raw_info (JsVar * o ) {
96- }
98+ }
0 commit comments