Esempio n. 1
0
    def _connect_to_hardware(self):
        """Connect to each port from the config.

        This process will cause the OPPSerialCommunicator to figure out which chains they've connected to
        and to register themselves.
        """
        for port in self.config['ports']:
            comm = OPPSerialCommunicator(platform=self,
                                         port=port,
                                         baud=self.config['baud'])
            yield from comm.connect()
            self.serial_connections.add(comm)

        for chain_serial, versions in self.gen2AddrArr.items():
            for chain_id, version in versions.items():
                if self.minVersion != version:
                    self.raise_config_error(
                        "Version mismatch. Board {}-{} has version {:d}.{:d}.{:d}.{:d} which is not"
                        " the minimal version"
                        "{:d}.{:d}.{:d}.{:d}".format(
                            chain_serial, chain_id, (version >> 24) & 0xFF,
                            (version >> 16) & 0xFF, (version >> 8) & 0xFF,
                            version & 0xFF, (self.minVersion >> 24) & 0xFF,
                            (self.minVersion >> 16) & 0xFF,
                            (self.minVersion >> 8) & 0xFF,
                            self.minVersion & 0xFF), 1)
Esempio n. 2
0
File: opp.py Progetto: tylervz/mpf
    def _connect_to_hardware(self):
        """Connect to each port from the config.

        This process will cause the OPPSerialCommunicator to figure out which chains they've connected to
        and to register themselves.
        """
        for port in self.config['ports']:
            comm = OPPSerialCommunicator(platform=self, port=port, baud=self.config['baud'])
            yield from comm.connect()
            self.serial_connections.add(comm)