1
0
mirror of synced 2024-09-23 18:48:21 +02:00

fix not using serial touch issue

This commit is contained in:
xpeng 2023-08-22 20:01:26 +08:00
parent f422c7ad70
commit e0bccd72ea
4 changed files with 91 additions and 75 deletions

View File

@ -33,11 +33,11 @@ MonoBehaviour:
m_Name: HandTrackingFeature Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi:
version:
featureIdInternal:
openxrExtensionStrings:
company:
nameUi: Ultraleap Hand Tracking
version: 1.0.0
featureIdInternal: com.ultraleap.tracking.openxr.feature.handtracking
openxrExtensionStrings: XR_EXT_hand_tracking XR_ULTRALEAP_hand_tracking_forearm
company: Ultraleap
priority: 0
required: 0
metaPermissions: 1
@ -82,11 +82,11 @@ MonoBehaviour:
m_Name: RuntimeDebuggerOpenXRFeature Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi:
version:
featureIdInternal:
nameUi: Runtime Debugger
version: 1
featureIdInternal: com.unity.openxr.features.runtimedebugger
openxrExtensionStrings:
company:
company: Unity
priority: 0
required: 0
cacheSize: 1048576
@ -103,7 +103,18 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b5a1f07dc5afe854f9f12a4194aca3fb, type: 3}
m_Name: Android
m_EditorClassIdentifier:
features: []
features:
- {fileID: -2759355098841077344}
- {fileID: 1242339343659939596}
- {fileID: -7791884441479556929}
- {fileID: 529299522121976043}
- {fileID: -2114470977307191787}
- {fileID: -2665317602316070962}
- {fileID: 1505799936249668369}
- {fileID: -1778638552271781925}
- {fileID: 7291351694695269871}
- {fileID: 7167600451737671974}
- {fileID: -5716994982038825123}
m_renderMode: 1
m_depthSubmissionMode: 0
--- !u!114 &-4197090093912000502
@ -181,11 +192,11 @@ MonoBehaviour:
m_Name: ConformanceAutomationFeature Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi:
version:
featureIdInternal:
openxrExtensionStrings:
company:
nameUi: Conformance Automation
version: 0.0.1
featureIdInternal: com.unity.openxr.feature.conformance
openxrExtensionStrings: XR_EXT_conformance_automation
company: Unity
priority: 0
required: 0
--- !u!114 &-2665317602316070962
@ -201,11 +212,11 @@ MonoBehaviour:
m_Name: MetaQuestTouchProControllerProfile Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi:
version:
featureIdInternal:
openxrExtensionStrings:
company:
nameUi: Meta Quest Touch Pro Controller Profile
version: 0.0.1
featureIdInternal: com.unity.openxr.feature.input.metaquestpro
openxrExtensionStrings: XR_FB_touch_controller_pro
company: Unity
priority: 0
required: 0
--- !u!114 &-2114470977307191787
@ -221,11 +232,11 @@ MonoBehaviour:
m_Name: MetaQuestFeature Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi:
version:
featureIdInternal:
openxrExtensionStrings:
company:
nameUi: Meta Quest Support
version: 1.0.0
featureIdInternal: com.unity.openxr.feature.metaquest
openxrExtensionStrings: XR_OCULUS_android_initialize_loader
company: Unity
priority: 0
required: 0
targetDevices:
@ -251,11 +262,11 @@ MonoBehaviour:
m_Name: MockRuntime Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi:
version:
featureIdInternal:
openxrExtensionStrings:
company:
nameUi: Mock Runtime
version: 0.0.2
featureIdInternal: com.unity.openxr.feature.mockruntime
openxrExtensionStrings: XR_UNITY_null_gfx XR_UNITY_android_present
company: Unity
priority: 0
required: 0
ignoreValidationErrors: 0
@ -308,11 +319,11 @@ MonoBehaviour:
m_Name: KHRSimpleControllerProfile Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi:
version:
featureIdInternal:
nameUi: Khronos Simple Controller Profile
version: 0.0.1
featureIdInternal: com.unity.openxr.feature.input.khrsimpleprofile
openxrExtensionStrings:
company:
company: Unity
priority: 0
required: 0
--- !u!114 &587458779450762736
@ -348,11 +359,11 @@ MonoBehaviour:
m_Name: EyeGazeInteraction Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi:
version:
featureIdInternal:
openxrExtensionStrings:
company:
nameUi: Eye Gaze Interaction Profile
version: 0.0.1
featureIdInternal: com.unity.openxr.feature.input.eyetracking
openxrExtensionStrings: XR_EXT_eye_gaze_interaction
company: Unity
priority: 0
required: 0
--- !u!114 &1505799936249668369
@ -368,11 +379,11 @@ MonoBehaviour:
m_Name: MicrosoftHandInteraction Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi:
version:
featureIdInternal:
openxrExtensionStrings:
company:
nameUi: Microsoft Hand Interaction Profile
version: 0.0.1
featureIdInternal: com.unity.openxr.feature.input.handtracking
openxrExtensionStrings: XR_MSFT_hand_interaction
company: Unity
priority: 0
required: 0
--- !u!114 &2249684173708023368
@ -557,11 +568,11 @@ MonoBehaviour:
m_Name: OculusTouchControllerProfile Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi:
version:
featureIdInternal:
nameUi: Oculus Touch Controller Profile
version: 0.0.1
featureIdInternal: com.unity.openxr.feature.input.oculustouch
openxrExtensionStrings:
company:
company: Unity
priority: 0
required: 0
--- !u!114 &7291351694695269871
@ -577,11 +588,11 @@ MonoBehaviour:
m_Name: OculusQuestFeature Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi:
version:
featureIdInternal:
openxrExtensionStrings:
company:
nameUi: Oculus Quest Support
version: 1.0.0
featureIdInternal: com.unity.openxr.feature.oculusquest
openxrExtensionStrings: XR_OCULUS_android_initialize_loader
company: Unity
priority: 0
required: 0
targetQuest: 1

View File

@ -24,11 +24,11 @@ public class ConfigManager : MonoBehaviour
{
onConfigChanged += EnsureInitialization;
onConfigChanged += SaveFileWait;
EnsureInitialization();
}
void Start()
{
EnsureInitialization();
AddListenerToWidget(ConfigPanelComponents);
onConfigChanged?.Invoke();
}

View File

@ -93,8 +93,8 @@ public class SerialManager : MonoBehaviour
if (ComR.IsOpen)
ReadHead(ComR, 1);
//following are touch test code
//if (Input.GetKeyDown(KeyCode.M))
//StartCoroutine(TouchTest(true));
if (Input.GetKeyDown(KeyCode.M))
StartCoroutine(TouchTest(true));
//if (Input.GetKeyDown(KeyCode.M) && StartUp)
//SendTouchState();
}
@ -117,9 +117,12 @@ public class SerialManager : MonoBehaviour
{
SetTouch(i, true);
Debug.Log(i);
yield return new WaitForSeconds(0.05f);
PingTouchThread();
yield return new WaitForSeconds(0.03f);
SetTouch(i, false);
yield return new WaitForSeconds(0.05f);
PingTouchThread();
yield return new WaitForSeconds(0.03f);
}
}
@ -145,34 +148,34 @@ public class SerialManager : MonoBehaviour
byte syncCheckSum = (byte)44;
syncbytes.Add(syncCheckSum);
Serial.Write(syncbytes.ToArray(), 0, syncbytes.Count);
//Debug.Log($"GET SYNC BOARD VER {side}");
Debug.Log($"GET SYNC BOARD VER {side}");
break;
case CMD_NEXT_READ:
//Response: corresponding read bytes + checksum
StartUp = false;
//Debug.Log($"Side {side} NEXT READ {Convert.ToByte(data[2])}");
Debug.Log($"Side {side} NEXT READ {Convert.ToByte(data[2])}");
switch (Convert.ToByte(data[2]))
{
case 0x30:
var bytes = ByteHelper.ConvertStringToByteArray(read1);
bytes.Add(ByteHelper.CalCheckSum(bytes.ToArray(), bytes.Count));
//Debug.Log("Read 1");
Debug.Log("Read 1");
Serial.Write(bytes.ToArray(), 0, bytes.Count);
break;
case 0x31:
var bytes2 = ByteHelper.ConvertStringToByteArray(read2);
bytes2.Add(ByteHelper.CalCheckSum(bytes2.ToArray(), bytes2.Count));
//Debug.Log("Read 2");
Debug.Log("Read 2");
Serial.Write(bytes2.ToArray(), 0, bytes2.Count);
break;
case 0x33:
var bytes3 = ByteHelper.ConvertStringToByteArray(read3);
bytes3.Add(ByteHelper.CalCheckSum(bytes3.ToArray(), bytes3.Count));
//Debug.Log("Read 3");
Debug.Log("Read 3");
Serial.Write(bytes3.ToArray(), 0, bytes3.Count);
break;
default:
//Debug.Log("Extra Read");
Debug.Log("Extra Read");
break;
}
break;
@ -189,34 +192,34 @@ public class SerialManager : MonoBehaviour
unitBytes.AddRange(ByteHelper.ConvertStringToByteArray(UNIT_BOARD_VER));
unitBytes.Add(unitCheckSum);
Serial.Write(unitBytes.ToArray(), 0, unitBytes.Count);
//Debug.Log($"GET UNIT BOARD VER {side}");
Debug.Log($"GET UNIT BOARD VER {side}");
break;
case CMD_MYSTERY1:
StartUp = false;
Serial.Write(SettingData_162, 0, 3);
//Debug.Log($"MYSTERY 1 SIDE {side}");
Debug.Log($"MYSTERY 1 SIDE {side}");
break;
case CMD_MYSTERY2:
StartUp = false;
Serial.Write(SettingData_148, 0, 3);
//Debug.Log($"MYSTERY 2 SIDE {side}");
Debug.Log($"MYSTERY 2 SIDE {side}");
break;
case CMD_START_AUTO_SCAN:
Serial.Write(SettingData_201.ToArray(), 0, 3);
//Debug.Log($"START AUTO SCAN SIDE {side}");
Debug.Log($"START AUTO SCAN SIDE {side}");
StartUp = true;
if (!_touchThread.IsAlive)
_touchThread.Start();
break;
case CMD_BEGIN_WRITE:
// Debug.Log($"Begin Write For Side {side}");
Debug.Log($"Begin Write For Side {side}");
break;
case CMD_NEXT_WRITE:
// Debug.Log($"Continue Write For Side {side}");
Debug.Log($"Continue Write For Side {side}");
break;
case 154:
StartUp = false;
//Debug.Log("BAD");
Debug.Log("BAD");
break;
}
}
@ -241,13 +244,13 @@ public class SerialManager : MonoBehaviour
Area -= 1; //0-239
if (Area < 120) //right side
{
Area += Area / 5 * 3 + 7;
Area += Area / 5 * 3 + 8;
ByteHelper.SetBit(TouchPackR, Area, State);
}
else if (Area >= 120) //left side
{
Area -= 120;
Area += Area / 5 * 3 + 7;
Area += Area / 5 * 3 + 8;
ByteHelper.SetBit(TouchPackL, Area, State);
}
}

View File

@ -16,8 +16,9 @@ public class TouchManager : MonoBehaviour
var toggle = widget.GetComponent<Toggle>();
toggle.onValueChanged.AddListener((value) => {
useIPCTouch = value;
Debug.Log("UseIPCTouch: " + value);
});
toggle.onValueChanged.Invoke(useIPCTouch);
toggle.onValueChanged.Invoke(toggle.isOn);
}
IEnumerator TouchTest(bool State) //this is a touch test code
@ -33,6 +34,7 @@ public class TouchManager : MonoBehaviour
}
public static void SetTouch(int Area, bool State) //set touch data 1-240
{
Debug.Log("SetTouch: " + Area + " " + State + " " + useIPCTouch);
if (useIPCTouch)
IPCManager.SetTouch(Area, State); //send touch data to IPC
else