/// <summary> /// Add a new sample to rolling average /// </summary> /// <param name="sample">The sample to add</param> public void PushSample(UserData sample) { // Replace oldest sample Samples[index] = sample; // Update position of oldest sample index = (index + 1) % Samples.Length; // Set flag to indicate that the average needs to be recalculated upToDate = false; // Log the raw value if logging is enabled if (log) { nLog.Log("raLogRaw", sample.rightArmAngle); } }