MCPcopy Create free account
hub / github.com/DexterInd/GoPiGo3 / read

Method read

Software/Python/Examples/gps_reading.py:79–97  ·  view source on GitHub ↗

Attempts 50 times at most to get valid data from GPS Returns as soon as valid data is found If valid data is not found, then clean up data in GPS instance

(self)

Source from the content-addressed store, hash-verified

77
78
79 def read(self):
80 '''
81 Attempts 50 times at most to get valid data from GPS
82 Returns as soon as valid data is found
83 If valid data is not found, then clean up data in GPS instance
84 '''
85 valid = False
86 for i in range(50):
87 time.sleep(0.5)
88 self.raw_line = self.ser.readline().strip()
89 if self.validate(self.raw_line):
90 valid = True
91 break;
92
93 if valid:
94 return self.gga
95 else:
96 self.clean_data()
97 return []
98
99 def validate(self,in_line):
100 '''

Callers 3

easy_Button.pyFile · 0.45
gps_reading.pyFile · 0.45

Calls 2

validateMethod · 0.95
clean_dataMethod · 0.95

Tested by

no test coverage detected