tuya_ble_sdk_demo/components/inv_mpu_driver/tuya_gesture_rec.c
/**
 * @brief calculate the total amount of change in acceleration data
 * @param[in] none
 * @return the calculation result
 */
@brief calculate the total amount of change in acceleration data
@param[in] none
@return the calculation result
@brief calculate the total amount of change in acceleration data @param [ in ] none @return the calculation result
FLOAT_T __calc_accel_total_change(VOID_T)
{
    UCHAR_T i, j;
    FLOAT_T diff = 0.0f;
    FLOAT_T diff_sum = 0.0f;
    for (i = 1; i < sg_data_index; i++)
    {
        for (j = 0; j < ACCEL_AXIS_NUM; j++)
        {
            diff = sg_accel_buf[i][j] - sg_accel_buf[0][j];
            diff_sum += ((diff > 0) ? diff : (-diff));
        }
    }
    return diff_sum;
}
FLOAT_T __calc_accel_total_change ( VOID_T ) { UCHAR_T i , j ; FLOAT_T diff = 0.0f ; FLOAT_T diff_sum = 0.0f ; for ( i = 1 ; i < sg_data_index ; i ++ ) { for ( j = 0 ; j < ACCEL_AXIS_NUM ; j ++ ) { diff = sg_accel_buf [ i ] [ j ] - sg_accel_buf [ 0 ] [ j ] ; diff_sum += ( ( diff > 0 ) ? diff : ( - diff ) ) ; } } return diff_sum ; }
@brief calculate the total amount of change in acceleration data
 @param[in] none
 @return the calculation result
@brief calculate the total amount of change in acceleration data @param [ in ] none @return the calculation result