@@ -67,27 +67,24 @@ def _uart_xfer(self, cmd):
67
67
resp = []
68
68
line = self ._uart .readline ()
69
69
if line is None :
70
- # print(" No response from Modem")
70
+ # No response from Modem
71
71
return None
72
- else :
72
+ resp .append (line )
73
+ while not any (EOM in line for EOM in (b"OK\r \n " , b"ERROR\r \n " )):
74
+ line = self ._uart .readline ()
73
75
resp .append (line )
74
- while not any (EOM in line for EOM in (b"OK\r \n " , b"ERROR\r \n " )):
75
- line = self ._uart .readline ()
76
- resp .append (line )
77
76
78
- self ._uart .reset_input_buffer ()
77
+ self ._uart .reset_input_buffer ()
79
78
80
- return tuple (resp )
79
+ return tuple (resp )
81
80
82
81
def reset (self ):
83
82
"""Perform a software reset."""
84
83
if self ._uart_xfer ("&F0" ) is None : # factory defaults
85
84
return False
86
- else :
87
- if self ._uart_xfer ("&K0" ) is None : # flow control off
88
- return False
89
- else :
90
- return True
85
+ if self ._uart_xfer ("&K0" ) is None : # flow control off
86
+ return False
87
+ return True
91
88
92
89
def _transfer_buffer (self ):
93
90
"""Copy out buffer to in buffer to simulate receiving a message."""
@@ -264,8 +261,7 @@ def ring_alert(self, value=1):
264
261
resp = self ._uart_xfer ("+SBDMTA=" + str (int (value )))
265
262
if resp [- 1 ].strip ().decode () == "OK" :
266
263
return True
267
- else :
268
- raise RuntimeError ("Error setting Ring Alert." )
264
+ raise RuntimeError ("Error setting Ring Alert." )
269
265
else :
270
266
raise ValueError (
271
267
"Use 0 or False to disable Ring Alert or use 0 or True to enable Ring Alert."
@@ -302,14 +298,14 @@ def geolocation(self):
302
298
The response is in the form:
303
299
[<x>,<y>,<z>,<timestamp>]
304
300
<x>,<y>,<z> is a geolocation grid code from an earth centered Cartesian coordinate system,
305
- using dimensions, x, y, and z, to specify location. The coordinate system is aligned such
306
- that the z-axis is aligned with the north and south poles, leaving the x-axis and y -axis
307
- to lie in the plane containing the equator. The axes are aligned such that at 0 degrees
308
- latitude and 0 degrees longitude, both y and z are zero and x is positive (x = +6376,
309
- representing the nominal earth radius in kilometres). Each dimension of the
310
- geolocation grid code is displayed in decimal form using units of kilometres.
311
- Each dimension of the geolocation grid code has a minimum value of –6376,
312
- a maximum value of +6376, and a resolution of 4.
301
+ using dimensions, x, y, and z, to specify location. The coordinate system is aligned
302
+ such that the z-axis is aligned with the north and south poles, leaving the x-axis
303
+ and y-axis to lie in the plane containing the equator. The axes are aligned such that
304
+ at 0 degrees latitude and 0 degrees longitude, both y and z are zero and
305
+ x is positive (x = +6376, representing the nominal earth radius in kilometres).
306
+ Each dimension of the geolocation grid code is displayed in decimal form using
307
+ units of kilometres. Each dimension of the geolocation grid code has a minimum value
308
+ of –6376, a maximum value of +6376, and a resolution of 4.
313
309
This geolocation coordinate system is known as ECEF (acronym earth-centered, earth-fixed),
314
310
also known as ECR (initialism for earth-centered rotational)
315
311
0 commit comments