// notice: 1. a_xyz.x and a_xyz.y should not be small together, so we need to give a liminal value // 2. the a_xyz.z should be enough small to ensure the G-Sensor is vertical, // the degree is 45, means abs(a_xyz.z) should not larger than nAccelRange*sin(45) if((abs(a_xyz.x) < nAccelRange/10) && (abs(a_xyz.y) < nAccelRange/10) || abs(a_xyz.z) > (nAccelRange*0.707)) { dbAngle = nAccelRange; return AD_UNKNOWN; }