Beispiel #1
0
    def conduct(self):
        if self.verbose:
            print("GPS...", file=sys.stderr)

        gps = None

        try:
            I2C.open(Host.I2C_SENSORS)

            # GPS...
            gps = PAM7Q(Host.gps_device())

            gps.power_on()
            gps.open()

            # test...
            self.datum = gps.report(GPRMC)

            if self.verbose:
                print(self.datum, file=sys.stderr)

            # criterion...
            return self.datum is not None

        finally:
            if gps:
                gps.close()
                gps.power_off()

            I2C.close()
Beispiel #2
0
    def conduct(self):
        if self.verbose:
            print("EEPROM...", file=sys.stderr)

        # validate...
        if not path.isfile(Host.eep_image()):
            print("error: eeprom image not found", file=sys.stderr)
            exit(1)

        try:
            # resources...
            Host.enable_eeprom_access()

            I2C.open(Host.I2C_EEPROM)

            eeprom = CAT24C32()

            # test...
            file_image = EEPROMImage.construct_from_file(
                Host.eep_image(), CAT24C32.SIZE)
            eeprom.write(file_image)

            # test criterion...
            return eeprom.image == file_image

        finally:
            I2C.close()
Beispiel #3
0
    def conduct(self):
        if self.verbose:
            print("AFE...", file=sys.stderr)

        try:
            I2C.open(Host.I2C_SENSORS)

            # AFE...
            dfe_conf = DFEConf.load(Host)
            afe = dfe_conf.afe(Host)

            # test...
            self.datum = afe.sample()

            if self.verbose:
                print(self.datum, file=sys.stderr)

            ok = True

            # test criterion...
            for gas, sensor in self.datum.sns.items():
                sensor_ok = 0.9 < sensor.we_v < 1.1 and 0.9 < sensor.ae_v < 1.1

                if not sensor_ok:
                    ok = False

            return ok

        finally:
            I2C.close()
Beispiel #4
0
    def conduct(self):
        if self.verbose:
            print("Pt1000...", file=sys.stderr)

        try:
            I2C.open(Host.I2C_SENSORS)

            # AFE...
            afe_conf = AFEConf.load(Host)
            afe = afe_conf.afe(Host)

            # test...
            self.datum = afe.sample_temp()

            if self.verbose:
                print(self.datum, file=sys.stderr)

            # test criterion...
            return 0.4 < self.datum.v < 0.6

        finally:
            I2C.close()
Beispiel #5
0
    def conduct(self):
        if self.verbose:
            print("Board temp...", file=sys.stderr)

        try:
            I2C.open(Host.I2C_SENSORS)

            # resources...
            sensor = MCP9808(True)

            # test...
            self.datum = sensor.sample()

            if self.verbose:
                print(self.datum, file=sys.stderr)

            temp = self.datum.temp

            # test criterion...
            return 10 < temp < 50

        finally:
            I2C.close()
Beispiel #6
0
from scs_host.sys.host import Host

from scs_mfr.cmd.cmd_eeprom_write import CmdEEPROMWrite


# --------------------------------------------------------------------------------------------------------------------

Host.enable_eeprom_access()


# --------------------------------------------------------------------------------------------------------------------

if __name__ == '__main__':

    try:
        I2C.open(Host.I2C_EEPROM)


        # ------------------------------------------------------------------------------------------------------------
        # cmd...

        cmd = CmdEEPROMWrite()

        if cmd.verbose:
            print(cmd, file=sys.stderr)
            print("-")


        # ------------------------------------------------------------------------------------------------------------
        # resources...