Пример #1
0
        void setupSerialComs()
        {
            string frontComName = "";

            string[] names = getPortNames();

            if (names.Length == 0)
            {
                Debug.LogWarning("Can't get input from Volume because no ports were detected! Confirm that Volume is connected via USB.");
                return;
            }

            for (int i = 0; i < names.Length; i++)
            {
                if (names[i].StartsWith("COM") || names[i].Contains("usbmodem"))
                {
                    frontComName = names[i];
                }
            }

            if (frontScreen == null && useFrontScreen)
            {
                frontScreen = new touchScreenInputManager("Front Touch Screen", addSerialPortInput(frontComName), true);
            }

            if (backScreen == null && useBackScreen)
            {
                backScreen = new touchScreenInputManager("Back Touch Screen", addSerialPortInput(frontComName), false);
            }
        }
Пример #2
0
        //we haven't found all of our ports, keep trying.
        void updateSerialComSearch(float deltaTime)
        {
            for (int i = 0; i < portSearches.Length; i++)
            {
                if (portSearches[i] == null)
                {
                    continue;
                }

                serialPortType t = portSearches[i].update(deltaTime);
                if (t == serialPortType.SERIAL_UNKNOWN) //a timeout or some other problem.  This is likely not a port related to us.
                {
                    //input._debugLog("<color=orange>Failed to connect to "+ portSearches[i].getSerialInput().portName +" </color>");
                    GameObject.Destroy(portSearches[i].getSerialInput());
                    badSerialPorts.Add(portSearches[i].getSerialInput().portName);
                    portSearches[i] = null;
                }
                else if (t == serialPortType.SERIAL_TOUCHPANEL)
                {
                    //note that the serialController is still readAsString = true here

                    input._debugLog("<color=#00ff00>Touch Panel PCB identified.</color>");
                    touchPanelFirmwareVersion = portSearches[i].firmwareVersion;

                    portSearches[i].getSerialInput().SendSerialMessage("read0");//send for the config asap.

                    //also give it to the touchpanel, this will let other methods call input.touchpanel without getting a null,
                    //but it wont receive updates until we get a calibration.
                    touchPanel = new touchScreenInputManager(portSearches[i].getSerialInput());

#if HYPERCUBE_DEV
                    castMesh cm = input._get().GetComponent <castMesh>();
                    if (cm.calibratorBasic)
                    {
                        cm.calibratorBasic.fwVersionNumber.text = "Firmware\nv" + touchPanelFirmwareVersion.ToString();
                        cm.calibratorBasic.pcbText.color        = Color.yellow; //let the dev know that we have found the pcb.
                    }
#endif

                    portSearches[i] = null; //stop checking this port for relevance.

                    Debug.Log("Hypercube: Successfully connected to Volume Touch Panel running firmware v" + touchPanelFirmwareVersion);

                    //TEMP:this version of the tools only knows how to use touchpanel serial port. we are done.
                    //if we ever need to find other ports, this should be removed so it can continue searching.
                    endPortSearch();
                }
            }
        }