32 lines
1.2 KiB
C#
32 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Assets.Scripts.Ble.Characteristic
|
|
{
|
|
public static class BleMathHelper
|
|
{
|
|
// Token: 0x06000028 RID: 40 RVA: 0x00002740 File Offset: 0x00000940
|
|
public static double WheelFrequency(WheelRevolution? lastWheelRevolution, WheelRevolution? newWheelRevolution, uint timeResolution)
|
|
{
|
|
return WheelRevolution.ComputeValue(lastWheelRevolution, newWheelRevolution, delegate (WheelRevolution lastValue, WheelRevolution newValue)
|
|
{
|
|
WheelRevolution wheelRevolution = newValue - lastValue;
|
|
return wheelRevolution.Count / ((double)wheelRevolution.Time / timeResolution);
|
|
});
|
|
}
|
|
|
|
// Token: 0x06000029 RID: 41 RVA: 0x0000276D File Offset: 0x0000096D
|
|
public static double CrankFrequency(CrankRevolution? lastCrankRevolutions, CrankRevolution? newCrankRevolutions)
|
|
{
|
|
return CrankRevolution.ComputeValue(lastCrankRevolutions, newCrankRevolutions, delegate (CrankRevolution lastValue, CrankRevolution newValue)
|
|
{
|
|
CrankRevolution crankRevolution = newValue - lastValue;
|
|
return (double)crankRevolution.Count / ((double)crankRevolution.Time / 1024.0);
|
|
});
|
|
}
|
|
}
|
|
}
|