public void HandleSnapshotRequest(LaserThreadSharedData unity_data) { if (snapshots_left == 0 && unity_data.snapshot_request) { snapshots_left = unity_data.snapshots_left; snapshot_request = true; unity_data.snapshot_request=false; } unity_data.snapshots_left = snapshots_left; }
public void CopyNewDataFrom(LaserThreadSharedData thr_data) { // Copy only the data that changed since last call from = thr_data.from; length = thr_data.length; averagedPacketTimeMs = thr_data.averagedPacketTimeMs; laserRPM = thr_data.laserRPM; crcFailurePercentage = thr_data.crcFailurePercentage; invalidPercentage = thr_data.invalidPercentage; for (int i = from; i < from + length; ++i) { int ind = i % readings.Length; readings[ind] = thr_data.readings[ind]; invalid_data[ind] = thr_data.invalid_data[ind]; } }