适配速度计和踏频计
This commit is contained in:
1 parent
f14a071179
commit
29aef943b9
8 files changed
+84
-12
No files matched your search
@@ -142,7 +142,7 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
{
|
||||
case SensorType.SpeedCadence:
|
||||
case SensorType.Cadence:
|
||||
devices = App.MainDeviceAdapter.GetDevices().Where(d => d.Sensor == SensorType || (d is ICadenceDevice && d.State == DeviceState.Connected)).OrderBy(d=>d.Priority).ToList();
|
||||
devices = App.MainDeviceAdapter.GetDevices().Where(d => (d.Sensor == SensorType.Cadence || d.Sensor == SensorType.SpeedCadence) || (d is ICadenceDevice && d.State == DeviceState.Connected)).OrderBy(d=>d.Priority).ToList();
|
||||
break;
|
||||
case SensorType.HeartRate:
|
||||
devices = App.MainDeviceAdapter.GetDevices().Where(d => d.Sensor == SensorType || (d is IHeartRateDevice && d.State == DeviceState.Connected)).OrderBy(d => d.Priority).ToList();
|
||||
|
||||
@@ -227,9 +227,15 @@ public class DeviceView : MonoBehaviour
|
||||
|
||||
logo.sprite = sprite0;
|
||||
noDevice.text = "NO DEVICE";
|
||||
searchState.text = "Searching...";
|
||||
|
||||
var hasDevice = App.MainDeviceAdapter.GetDevices().Any(d => d.Sensor == SensorType);
|
||||
searchState.text = "Searching...";
|
||||
|
||||
var hasDevice = false;
|
||||
if (SensorType == SensorType.SpeedCadence) {
|
||||
hasDevice = App.MainDeviceAdapter.GetDevices().Any(d => d.Sensor == SensorType.SpeedCadence || d.Sensor == SensorType.Cadence);
|
||||
}
|
||||
else {
|
||||
hasDevice = App.MainDeviceAdapter.GetDevices().Any(d => d.Sensor == SensorType);
|
||||
}
|
||||
if (hasDevice)
|
||||
{
|
||||
mSearchButton.SetActive(false);
|
||||
@@ -366,6 +372,10 @@ public class DeviceView : MonoBehaviour
|
||||
AbstractDevice GetCurrentDevice()
|
||||
{
|
||||
//return AntConnector.Instance().discoveredDevices.FirstOrDefault(d => (d.State == DeviceState.Connected || d.State == DeviceState.Connecting) && d.Sensor == SensorType);
|
||||
if(SensorType == SensorType.SpeedCadence || SensorType == SensorType.Cadence)
|
||||
{
|
||||
return App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected || d.State == DeviceState.Connecting) && (d.Sensor == SensorType.SpeedCadence || d.Sensor == SensorType.Cadence));
|
||||
}
|
||||
return App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected || d.State == DeviceState.Connecting) && d.Sensor == SensorType);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user