修改细节,修复bug
This commit is contained in:
1 parent
06aefb93c4
commit
30e09c9c7a
15 files changed
+3566
-3347
No files matched your search
@@ -18,8 +18,8 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
|
||||
public bool IsOptional => false;
|
||||
|
||||
public static event EventHandler EnableChanged;
|
||||
private static bool? _isEnabled;
|
||||
public static bool? IsEnabled
|
||||
private static bool _isEnabled;
|
||||
public static bool IsEnabled
|
||||
{
|
||||
get => _isEnabled;
|
||||
set
|
||||
@@ -55,7 +55,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
|
||||
public static RowerTaskPanel.RowerType rowerType { get; private set; }
|
||||
public void HandleAttributeReceived(byte[] data)
|
||||
{
|
||||
Debug.Log("数据" + string.Join(",", data));
|
||||
//Debug.Log("数据" + string.Join(",", data));
|
||||
if (data[0] == 53)
|
||||
{
|
||||
PeakDriveForce = LbsToNewton(Convert.ToDouble(BitConvertHelper.ToUInt16(data, 13)) / 10);
|
||||
@@ -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 = Convert.ToUInt16(Math.Round(LbsToNewton(data[i])));
|
||||
r.Add(pull);
|
||||
PullValue = pull;
|
||||
}
|
||||
@@ -94,6 +94,9 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
|
||||
{
|
||||
rowerType = null;
|
||||
}
|
||||
//isReadyStatus = data[9] == 0;
|
||||
var time = ((data[3] << 16) + (data[2] << 8) + data[1]) / 100;
|
||||
Debug.Log("划船时间"+time);
|
||||
isReadyStatus = data[9] == 0;
|
||||
//isReadyStatus = data[2] == 1 || data[2] == 129;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
||||
{
|
||||
Debug.Log("中控台获取");
|
||||
this.controlPointCharacteristic = character;
|
||||
C2RowerData.IsEnabled = false;
|
||||
}
|
||||
else if (character.MatchGuid(ServiceUuids.Characteristics.RowerData))
|
||||
{
|
||||
@@ -79,7 +80,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
||||
else if (character.MatchGuid(ServiceUuids.Characteristics.C2RowerCourse))
|
||||
{
|
||||
Debug.Log("c2划船机课程数据" + service.Id);
|
||||
//C2RowerData.IsEnabled = true;
|
||||
C2RowerData.IsEnabled = true;
|
||||
this.hwInterface.SubscribeCharacteristic(character, null);
|
||||
}
|
||||
else if (character.MatchGuid(ServiceUuids.Characteristics.C2RowerControl))
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace Assets.Scripts.Ble
|
||||
{
|
||||
continue;
|
||||
}
|
||||
//Debug.Log($"設備信息,{item.IdGuid},{string.Join(";",item.IdByteArray)}" );
|
||||
//Debug.Log($"設備信息,{item.IdGuid},{string.Join(";", item.IdByteArray)}");
|
||||
if (item.IdByteArray == ServiceUuids.Ftms)
|
||||
{
|
||||
if (App.IsRowerMode == true)
|
||||
@@ -231,7 +231,6 @@ namespace Assets.Scripts.Ble
|
||||
callback?.Invoke(self, info, s);
|
||||
this.callbacks.Remove(info);
|
||||
Debug.Log("连接成功!"+info.Name);
|
||||
Devices.Ble.Characteristic.C2RowerData.IsEnabled = info.Name.Contains("PM");
|
||||
if (this.callbacks.Any())
|
||||
{
|
||||
this.ConnectPeripheral(this.callbacks.First().Key, this.callbacks.First().Value);
|
||||
|
||||
Reference in new issue
Block a user