4.14修改,设备连接去掉ftms骑行台
This commit is contained in:
1 parent
29e7219c21
commit
f383c54507
18 files changed
+2511
-10695
No files matched your search
@@ -58,8 +58,8 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
|
||||
//Debug.Log("数据" + string.Join(",", data));
|
||||
if (data[0] == 53)
|
||||
{
|
||||
PeakDriveForce = LbsToNewton(Convert.ToDouble(BitConvertHelper.ToUInt16(data, 13)) / 10);
|
||||
AverageDriveForce = LbsToNewton(Convert.ToDouble(BitConvertHelper.ToUInt16(data, 15)) / 10);
|
||||
PeakDriveForce = LbsToNewton(Convert.ToDouble(BitConvertHelper.ToUInt16(data, 13)) / 10,true);
|
||||
AverageDriveForce = LbsToNewton(Convert.ToDouble(BitConvertHelper.ToUInt16(data, 15)) / 10, true);
|
||||
Debug.Log($"峰力值:{PeakDriveForce} 均力值{AverageDriveForce}");
|
||||
}
|
||||
else if (data[0] == 61)
|
||||
@@ -67,7 +67,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
|
||||
List<ushort> r = new List<ushort>();
|
||||
for (int i = 3; i < data.Length; i += 2)
|
||||
{
|
||||
ushort pull = data[i] < 10 ? (ushort)0 : Convert.ToUInt16(Math.Round(LbsToNewton(data[i])));
|
||||
ushort pull = data[i] < 10 ? (ushort)0 : Convert.ToUInt16(Math.Round(LbsToNewton(data[i], true)));
|
||||
r.Add(pull);
|
||||
PullValue = pull;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
|
||||
// isReadyStatus = data[2] == 1 || data[2] == 129;
|
||||
//}
|
||||
}
|
||||
private double LbsToNewton(double lbs) => 4.4482216 * lbs;
|
||||
private double LbsToNewton(double lbs,bool isKg = false) => 4.4482216 * lbs * (isKg ? (1f / 9.8f) : 1f);
|
||||
public void SetUnavailable()
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
|
||||
@@ -226,6 +226,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
|
||||
for (int pullB = 4; pullB < data.Length; pullB += 2)
|
||||
{
|
||||
var val = BitConverter.ToUInt16(data, pullB);
|
||||
val = Convert.ToUInt16(((double)val) /9.8f);
|
||||
list.Add(val);
|
||||
PullValue = val;
|
||||
|
||||
|
||||
Reference in new issue
Block a user