解决c2表头设定课程后抖动问题,设备断开失败问题

This commit is contained in:
lishuo 2022-06-15 16:42:07 +08:00
parent 0202814f67
commit 610c98f9b8
5 changed files with 18 additions and 10 deletions

View File

@ -128,7 +128,7 @@ namespace Assets.Scripts.Devices.Ble
Debug.Log("断开设备" + this.Name);
//App.MainDeviceAdapter.PrintStatus();
this.State = DeviceState.Disconnected;
//this.State = DeviceState.Disconnected;
this.hwInterface.DisconnectPeripheral(this.peripheralInfo, () => {
//App.MainDeviceAdapter.PrintStatus();

View File

@ -240,6 +240,7 @@ namespace Assets.Scripts.Ble
IsSuccess = true,
Error = null
};
PeripheralDisconnected(address, info);//连接前断开
callback?.Invoke(self, info, s);
this.callbacks.Remove(info);
Debug.Log("连接成功!" + info.Name);
@ -341,8 +342,6 @@ namespace Assets.Scripts.Ble
{
characteristicsDiscoveredCallbacks.Remove(characteristicsDiscoveredCallback.First().Key);
}
peripheralDisconnectedEvent(this, info, null, false);
}
#endregion

View File

@ -64,12 +64,14 @@ public class PFUISlider : MonoBehaviour
text.text = $"{valueHandler(f):#0}";
this.ValueChangedHandler?.Invoke(f);
}
public void SetValue(float a)
public void SetValue(float a,bool silent = false)
{
a = a > 1 ? 1 : a;
a = a < 0 ? 0 : a;
slider.value = a;
OnValueChanged();
text.text = $"{valueHandler(a):#0}";
if(!silent)
OnValueChanged();
}
public float GetValue()

View File

@ -751,7 +751,7 @@ public class RowerHomeScript : PFUIPanel
{
var origin = RowerData.ResistanceLevel;
var wrapped = origin< 50 ? 50 : origin;
slider.GetComponent<PFUISlider>().SetValue((wrapped - 50) / 300f);
slider.GetComponent<PFUISlider>().SetValue((wrapped - 50) / 300f,false);
}
}
@ -827,7 +827,10 @@ public class RowerHomeScript : PFUIPanel
});
return;
}
if (interruptFlag) return;
if (interruptFlag) {
transform.Find("Stopped").gameObject.SetActive(false);
return;
}
if (RowerData == null) return;
//#endif
//断线重连继续
@ -853,9 +856,10 @@ public class RowerHomeScript : PFUIPanel
}
if (stopSeconds >= 2)
{
if (UIManager.Instance.confirm != null && UIManager.Instance.confirm.IsActive())
if (UIManager.Instance.confirm != null && UIManager.Instance.confirm.IsActive()) {
transform.Find("Stopped").gameObject.SetActive(false);
return;
}
transform.Find("Stopped").gameObject.SetActive(true);
//if (stopSeconds == 6)
//{
@ -1339,7 +1343,7 @@ public class RowerHomeScript : PFUIPanel
}
if (Rower != null)
{
if (C2RowerData.IsEnabled == true && !openTimer && !isPause && C2RowerData.rowerType!=null)
if (C2RowerData.IsEnabled == true && !openTimer && !isPause && C2RowerData.rowerType!=null && rowerType!= null && !rowerType.EqualTo(C2RowerData.rowerType))
{
rowerType = C2RowerData.rowerType;
HandleSelectType();

View File

@ -22,6 +22,9 @@ public class RowerTaskPanel : PFUIPanel
/// 里程m 时间s
/// </summary>
public float value { get; set; }
public bool EqualTo(RowerType rowerType) {
return this.type == rowerType.type && this.value == rowerType.value;
}
}
Transform selector, distance, time;
public RowerType rowerType;