示例#1
0
 def read_features(self):
     super().read_features()
     if self.version >= Version("0.7.1"):
         logger.debug("Using scan mask command.")
         self.features.add("Scan mask command")
         self.sweep_method = "scan_mask"
     elif self.version >= Version("0.2.0"):
         logger.debug("Using new scan command.")
         self.features.add("Scan command")
         self.sweep_method = "scan"
示例#2
0
    def __init__(self, app, serial_port):
        super().__init__(app, serial_port)
        self.version = Version(self.readVersion())

        logger.debug("Testing against 0.2.0")
        if self.version.version_string.find("extended with scan") > 0:
            logger.debug("Incompatible scan command detected.")
            self.features.add("Incompatible scan command")
            self.useScan = False
        elif self.version >= Version("0.2.0"):
            logger.debug("Newer than 0.2.0, using new scan command.")
            self.features.add("New scan command")
            self.useScan = True
        else:
            logger.debug("Older than 0.2.0, using old sweep command.")
            self.features.add("Original sweep method")
            self.useScan = False
        self.readFeatures()
示例#3
0
 def readVersion(self):
     # read register 0xf0 (device type), 0xf2 (board revision)
     cmd = b"\x10\xf0\x10\xf2"
     with self.app.serialLock:
         self.serial.write(cmd)
         resp = self.serial.read(2)
     if len(resp) != 2:
         logger.error("Timeout reading version registers")
         return None
     return Version(f"{resp[0]}.0.{resp[1]}")
示例#4
0
    def readFirmware(self) -> str:
        # read register 0xf3 and 0xf4 (firmware major and minor version)
        cmd = b"\x10\xf3\x10\xf4"
        self.serial.write(cmd)

        resp = self.serial.read(2)
        if len(resp) != 2:
            logger.error("Timeout reading version registers")
            return None
        return Version(f"{resp[0]}.{resp[1]}.0")
示例#5
0
    def readFirmware(self) -> str:
        # read register 0xf3 and 0xf4 (firmware major and minor version)
        cmd = pack("<BBBB", _CMD_READ, _ADDR_FW_MAJOR, _CMD_READ,
                   _ADDR_FW_MINOR)
        self.serial.write(cmd)

        resp = self.serial.read(2)
        if len(resp) != 2:
            logger.error("Timeout reading version registers")
            return None
        return Version(f"{resp[0]}.{resp[1]}.0")
示例#6
0
 def __init__(self, app, serial_port):
     super().__init__(app, serial_port)
     self.version = Version(self.readVersion())
     self.features.add("Customizable data points")