diff --git a/Assets/Scripts/Devices/Ble/Devices/FtmsRower.cs b/Assets/Scripts/Devices/Ble/Devices/FtmsRower.cs index 4fac5dc5..0abd3633 100644 --- a/Assets/Scripts/Devices/Ble/Devices/FtmsRower.cs +++ b/Assets/Scripts/Devices/Ble/Devices/FtmsRower.cs @@ -118,7 +118,7 @@ namespace Assets.Scripts.Devices.Ble.Devices if (characteristic.MatchGuid(ServiceUuids.Characteristics.RowerData)) { var c = base.Characteristics.SingleOrDefault(x => x.Uuid == ServiceUuids.Characteristics.RowerData); - if (c != null) + if (c != null && !C2RowerData.IsEnabled) { c.HandleAttributeReceived(response.Data); } diff --git a/Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs b/Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs index 6c43fb04..56b7b036 100644 --- a/Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs +++ b/Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs @@ -39,7 +39,7 @@ public class RowerHomeScript : PFUIPanel { get { - return Rower != null ? (C2RowerData.IsEnabled == true ? (IRowerCommonData)Rower.c2RowerData : (IRowerCommonData)Rower.rowerData) : null; + return Rower != null ? (C2RowerData.IsEnabled == true ? Rower.c2RowerData : Rower.rowerData) : null; //var device = App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected) && d.Sensor == SensorType.Rower); //if (device != null) //{ @@ -420,7 +420,7 @@ public class RowerHomeScript : PFUIPanel { startTime = UIManager.Now.GetDateTime(); createTime = null; - truelyTime = 0; + truelyTime = historyTime; //TimerTicks(); openTimer = true; timer = 1.0f; @@ -626,7 +626,10 @@ public class RowerHomeScript : PFUIPanel leftLine.localPosition = new Vector3(-207.5f+43, leftLine.localPosition.y, leftLine.localPosition.z); rightLine.localPosition = new Vector3(164.5f+43, rightLine.localPosition.y, rightLine.localPosition.z); finishLine.localPosition = new Vector3(-237.5f+43, finishLine.localPosition.y, finishLine.localPosition.z); - + historyStrokeCount = 0; + historyDistance = 0; + historyTime = 0; + historyEnergy = 0; Resources.UnloadUnusedAssets(); GC.Collect(); @@ -702,9 +705,11 @@ public class RowerHomeScript : PFUIPanel #endif var heartRate = HeartRate ?? 0; bottom.Find("BPM/Value").GetComponent().text = heartRate.ToString(); - var distance = (int)RowerData.TotalDistance; - var energy = RowerData.TotalEnergy; - var strokeCount = RowerData.StrokeCount; + //断线重连继续 + var distance = (int)RowerData.TotalDistance + historyDistance; + var energy = RowerData.TotalEnergy + historyEnergy; + var strokeCount = RowerData.StrokeCount + historyStrokeCount; + var power = RowerData.InstantaneousPower; var rate = RowerData.StrokeRate; truelyTime++; @@ -858,6 +863,8 @@ public class RowerHomeScript : PFUIPanel } } //检查本地数据 + int historyDistance = 0,historyStrokeCount = 0,historyEnergy = 0; + public int historyTime = 0; private void CheckLocalData() { try @@ -876,6 +883,16 @@ public class RowerHomeScript : PFUIPanel { records.Add(item); } + //records.Add($"{strokeCount},{RowerData.ElapsedTime},{distance},{power},{pace},{rate},{RowerData.ResistanceLevel},{heartRate},{energy},{RowerData.AveragePower},{truelyTime}"); + var _re = records.LastOrDefault(); + if (!string.IsNullOrEmpty(_re)) + { + var datas = _re.Split(','); + historyStrokeCount = int.Parse(datas[0]); + historyDistance = int.Parse(datas[2]); + historyTime = int.Parse(datas[10]); + historyEnergy = int.Parse(datas[8]); + } } UIManager.CloseConfirm(); }, 2, diff --git a/Assets/Scripts/UI/Prefab/Rower/RowerMultiModeScript.cs b/Assets/Scripts/UI/Prefab/Rower/RowerMultiModeScript.cs index 610222bb..490a8092 100644 --- a/Assets/Scripts/UI/Prefab/Rower/RowerMultiModeScript.cs +++ b/Assets/Scripts/UI/Prefab/Rower/RowerMultiModeScript.cs @@ -201,7 +201,7 @@ public class RowerMultiModeScript : MonoBehaviour public async void GetShadowList(RowerTaskPanel.RowerType rowerType, RowerResultModel reRowData) { this.rowerType = rowerType; - currentSecond = -1; + currentSecond = GetComponent().historyTime - 1; //if(Application.internetReachability == NetworkReachability.NotReachable) var res = reRowData ==null? await ConfigHelper.rowerApi.GetShadowList(rowerType): await ConfigHelper.rowerApi.GetReRowShadowList(reRowData.Id); shadowList = res.data;