适配C2划船机课程和menu

This commit is contained in:
Caiyanpeng committed 2022-03-30 18:25:51 +08:00
1 parent e0649f7ea1
commit 06aefb93c4
6 files changed
+162 -77

No files matched your search

@@ -50,6 +50,9 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
}
}
}
public static bool isReadyStatus { get; private set; }
public static RowerTaskPanel.RowerType rowerType { get; private set; }
public void HandleAttributeReceived(byte[] data)
{
Debug.Log("数据" + string.Join(",", data));
@@ -59,7 +62,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
AverageDriveForce = LbsToNewton(Convert.ToDouble(BitConvertHelper.ToUInt16(data, 15)) / 10);
Debug.Log($"峰力值:{PeakDriveForce} 均力值{AverageDriveForce}");
}
else if (data[0] == 61)
else if (data[0] == 61)
{
List<ushort> r = new List<ushort>();
for (int i = 3; i < data.Length; i += 2)
@@ -68,9 +71,36 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
r.Add(pull);
PullValue = pull;
}
Debug.Log("拉力曲线:"+ string.Join(",",r));
Debug.Log("拉力曲线:" + string.Join(",", r));
}
else if (data[0] == 49)
{
byte status = data[18];
int value = (data[17] << 16) + (data[16] << 8) + data[15];
if (status == 128 && value != 0)
{
rowerType = new RowerTaskPanel.RowerType();
rowerType.type = 1;
rowerType.value = value;
}
else if (status == 0)
{
rowerType = new RowerTaskPanel.RowerType();
rowerType.type = 2;
rowerType.value = value / 100;
}
else
{
rowerType = null;
}
isReadyStatus = data[9] == 0;
//isReadyStatus = data[2] == 1 || data[2] == 129;
}
//else if (data[0] == 34)
//{
// isReadyStatus = data[2] == 1 || data[2] == 129;
//}
}
private double LbsToNewton(double lbs) => 4.4482216 * lbs;
public void SetUnavailable()