void HandleAccel(MessageAccel data) { // These values are supposed to be in meters per second squared but I need to convert them to 0 to 1 values. // A quick test seems to make them go to +/- around 50 at least on my iPhone5s but different on my android. // Maybe I should keep track of max values and reset over time with some threshold? // actually I'm just going to pass them through as is. axes[AXIS_ACCELERATION_X] = data.x; //clamp(data.x / maxAcceleration, -1, 1); axes[AXIS_ACCELERATION_Y] = data.y; //clamp(data.y / maxAcceleration, -1, 1); axes[AXIS_ACCELERATION_Z] = data.z; //clamp(data.z / maxAcceleration, -1, 1); }