Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix line length problems, remove unneeded else statements
  • Loading branch information
zunkworks committed Jan 8, 2021
commit 2347133c5596fa3348e850513812b7c250ca9890
40 changes: 18 additions & 22 deletions adafruit_rockblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,24 @@ def _uart_xfer(self, cmd):
resp = []
line = self._uart.readline()
if line is None:
# print("No response from Modem")
# No response from Modem
return None
else:
resp.append(line)
while not any(EOM in line for EOM in (b"OK\r\n", b"ERROR\r\n")):
line = self._uart.readline()
resp.append(line)
while not any(EOM in line for EOM in (b"OK\r\n", b"ERROR\r\n")):
line = self._uart.readline()
resp.append(line)

self._uart.reset_input_buffer()
self._uart.reset_input_buffer()

return tuple(resp)
return tuple(resp)

def reset(self):
"""Perform a software reset."""
if self._uart_xfer("&F0") is None: # factory defaults
return False
else:
if self._uart_xfer("&K0") is None: # flow control off
return False
else:
return True
if self._uart_xfer("&K0") is None: # flow control off
return False
return True

def _transfer_buffer(self):
"""Copy out buffer to in buffer to simulate receiving a message."""
Expand Down Expand Up @@ -264,8 +261,7 @@ def ring_alert(self, value=1):
resp = self._uart_xfer("+SBDMTA=" + str(int(value)))
if resp[-1].strip().decode() == "OK":
return True
else:
raise RuntimeError("Error setting Ring Alert.")
raise RuntimeError("Error setting Ring Alert.")
else:
raise ValueError(
"Use 0 or False to disable Ring Alert or use 0 or True to enable Ring Alert."
Expand Down Expand Up @@ -302,14 +298,14 @@ def geolocation(self):
The response is in the form:
[<x>,<y>,<z>,<timestamp>]
<x>,<y>,<z> is a geolocation grid code from an earth centered Cartesian coordinate system,
using dimensions, x, y, and z, to specify location. The coordinate system is aligned such
that the z-axis is aligned with the north and south poles, leaving the x-axis and y-axis
to lie in the plane containing the equator. The axes are aligned such that at 0 degrees
latitude and 0 degrees longitude, both y and z are zero and x is positive (x = +6376,
representing the nominal earth radius in kilometres). Each dimension of the
geolocation grid code is displayed in decimal form using units of kilometres.
Each dimension of the geolocation grid code has a minimum value of –6376,
a maximum value of +6376, and a resolution of 4.
using dimensions, x, y, and z, to specify location. The coordinate system is aligned
such that the z-axis is aligned with the north and south poles, leaving the x-axis
and y-axis to lie in the plane containing the equator. The axes are aligned such that
at 0 degrees latitude and 0 degrees longitude, both y and z are zero and
x is positive (x = +6376, representing the nominal earth radius in kilometres).
Each dimension of the geolocation grid code is displayed in decimal form using
units of kilometres. Each dimension of the geolocation grid code has a minimum value
of –6376, a maximum value of +6376, and a resolution of 4.
This geolocation coordinate system is known as ECEF (acronym earth-centered, earth-fixed),
also known as ECR (initialism for earth-centered rotational)

Expand Down