断线重连取数据逻辑
This commit is contained in:
parent
167a424505
commit
3f8c189ad4
@ -118,7 +118,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
|||||||
if (characteristic.MatchGuid(ServiceUuids.Characteristics.RowerData))
|
if (characteristic.MatchGuid(ServiceUuids.Characteristics.RowerData))
|
||||||
{
|
{
|
||||||
var c = base.Characteristics.SingleOrDefault(x => x.Uuid == 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);
|
c.HandleAttributeReceived(response.Data);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ public class RowerHomeScript : PFUIPanel
|
|||||||
{
|
{
|
||||||
get
|
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);
|
//var device = App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected) && d.Sensor == SensorType.Rower);
|
||||||
//if (device != null)
|
//if (device != null)
|
||||||
//{
|
//{
|
||||||
@ -420,7 +420,7 @@ public class RowerHomeScript : PFUIPanel
|
|||||||
{
|
{
|
||||||
startTime = UIManager.Now.GetDateTime();
|
startTime = UIManager.Now.GetDateTime();
|
||||||
createTime = null;
|
createTime = null;
|
||||||
truelyTime = 0;
|
truelyTime = historyTime;
|
||||||
//TimerTicks();
|
//TimerTicks();
|
||||||
openTimer = true;
|
openTimer = true;
|
||||||
timer = 1.0f;
|
timer = 1.0f;
|
||||||
@ -626,7 +626,10 @@ public class RowerHomeScript : PFUIPanel
|
|||||||
leftLine.localPosition = new Vector3(-207.5f+43, leftLine.localPosition.y, leftLine.localPosition.z);
|
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);
|
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);
|
finishLine.localPosition = new Vector3(-237.5f+43, finishLine.localPosition.y, finishLine.localPosition.z);
|
||||||
|
historyStrokeCount = 0;
|
||||||
|
historyDistance = 0;
|
||||||
|
historyTime = 0;
|
||||||
|
historyEnergy = 0;
|
||||||
|
|
||||||
Resources.UnloadUnusedAssets();
|
Resources.UnloadUnusedAssets();
|
||||||
GC.Collect();
|
GC.Collect();
|
||||||
@ -702,9 +705,11 @@ public class RowerHomeScript : PFUIPanel
|
|||||||
#endif
|
#endif
|
||||||
var heartRate = HeartRate ?? 0;
|
var heartRate = HeartRate ?? 0;
|
||||||
bottom.Find("BPM/Value").GetComponent<Text>().text = heartRate.ToString();
|
bottom.Find("BPM/Value").GetComponent<Text>().text = heartRate.ToString();
|
||||||
var distance = (int)RowerData.TotalDistance;
|
//断线重连继续
|
||||||
var energy = RowerData.TotalEnergy;
|
var distance = (int)RowerData.TotalDistance + historyDistance;
|
||||||
var strokeCount = RowerData.StrokeCount;
|
var energy = RowerData.TotalEnergy + historyEnergy;
|
||||||
|
var strokeCount = RowerData.StrokeCount + historyStrokeCount;
|
||||||
|
|
||||||
var power = RowerData.InstantaneousPower;
|
var power = RowerData.InstantaneousPower;
|
||||||
var rate = RowerData.StrokeRate;
|
var rate = RowerData.StrokeRate;
|
||||||
truelyTime++;
|
truelyTime++;
|
||||||
@ -858,6 +863,8 @@ public class RowerHomeScript : PFUIPanel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//检查本地数据
|
//检查本地数据
|
||||||
|
int historyDistance = 0,historyStrokeCount = 0,historyEnergy = 0;
|
||||||
|
public int historyTime = 0;
|
||||||
private void CheckLocalData()
|
private void CheckLocalData()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -876,6 +883,16 @@ public class RowerHomeScript : PFUIPanel
|
|||||||
{
|
{
|
||||||
records.Add(item);
|
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();
|
UIManager.CloseConfirm();
|
||||||
}, 2,
|
}, 2,
|
||||||
|
|||||||
@ -201,7 +201,7 @@ public class RowerMultiModeScript : MonoBehaviour
|
|||||||
public async void GetShadowList(RowerTaskPanel.RowerType rowerType, RowerResultModel reRowData)
|
public async void GetShadowList(RowerTaskPanel.RowerType rowerType, RowerResultModel reRowData)
|
||||||
{
|
{
|
||||||
this.rowerType = rowerType;
|
this.rowerType = rowerType;
|
||||||
currentSecond = -1;
|
currentSecond = GetComponent<RowerHomeScript>().historyTime - 1;
|
||||||
//if(Application.internetReachability == NetworkReachability.NotReachable)
|
//if(Application.internetReachability == NetworkReachability.NotReachable)
|
||||||
var res = reRowData ==null? await ConfigHelper.rowerApi.GetShadowList(rowerType): await ConfigHelper.rowerApi.GetReRowShadowList(reRowData.Id);
|
var res = reRowData ==null? await ConfigHelper.rowerApi.GetShadowList(rowerType): await ConfigHelper.rowerApi.GetReRowShadowList(reRowData.Id);
|
||||||
shadowList = res.data;
|
shadowList = res.data;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user