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()
from scs_core.position.gpgsv import GPGSV from scs_core.position.gprmc import GPRMC from scs_core.position.gpvtg import GPVTG from scs_core.position.gps_location import GPSLocation from scs_dfe.gps.pam7q import PAM7Q from scs_host.bus.i2c import I2C from scs_host.sys.host import Host # -------------------------------------------------------------------------------------------------------------------- I2C.open(Host.I2C_SENSORS) gps = PAM7Q(Host.gps_device()) print(gps) print("-") try: # ---------------------------------------------------------------------------------------------------------------- print("power up...") gps.power_on() print("open...") gps.open() print(gps) print("=") # ----------------------------------------------------------------------------------------------------------------