mirror of
https://github.com/craigerl/aprsd.git
synced 2024-11-21 15:51:52 -05:00
Cleanup test failures
This commit is contained in:
parent
c12c42b876
commit
14c0a699cb
@ -60,7 +60,6 @@ class PacketCollector:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(f"Error in monitor {name} (tx): {e}")
|
LOG.error(f"Error in monitor {name} (tx): {e}")
|
||||||
|
|
||||||
|
|
||||||
def flush(self):
|
def flush(self):
|
||||||
"""Call flush on the objects. This is used to flush out any data."""
|
"""Call flush on the objects. This is used to flush out any data."""
|
||||||
for name in self.monitors:
|
for name in self.monitors:
|
||||||
|
@ -101,7 +101,6 @@ def log(packet, tx: Optional[bool] = False, header: Optional[bool] = True) -> No
|
|||||||
if header:
|
if header:
|
||||||
if tx:
|
if tx:
|
||||||
via_color = "red"
|
via_color = "red"
|
||||||
# arrow = f"<{via_color}>-></{via_color}>"
|
|
||||||
arrow = f"<{via_color}>\u2192</{via_color}>"
|
arrow = f"<{via_color}>\u2192</{via_color}>"
|
||||||
logit.append(
|
logit.append(
|
||||||
f"<red>TX\u2191</red> "
|
f"<red>TX\u2191</red> "
|
||||||
@ -111,7 +110,6 @@ def log(packet, tx: Optional[bool] = False, header: Optional[bool] = True) -> No
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
via_color = "fg #1AA730"
|
via_color = "fg #1AA730"
|
||||||
#arrow = f"<{via_color}>-></{via_color}>"
|
|
||||||
arrow = f"<{via_color}>\u2192</{via_color}>"
|
arrow = f"<{via_color}>\u2192</{via_color}>"
|
||||||
f"<{via_color}><-</{via_color}>"
|
f"<{via_color}><-</{via_color}>"
|
||||||
logit.append(
|
logit.append(
|
||||||
|
@ -175,18 +175,18 @@ def load_entry_points(group):
|
|||||||
|
|
||||||
|
|
||||||
def calculate_initial_compass_bearing(start, end):
|
def calculate_initial_compass_bearing(start, end):
|
||||||
if (type(start) != tuple) or (type(end) != tuple):
|
if (type(start) != tuple) or (type(end) != tuple): # noqa: E721
|
||||||
raise TypeError("Only tuples are supported as arguments")
|
raise TypeError("Only tuples are supported as arguments")
|
||||||
|
|
||||||
lat1 = math.radians(float(start[0]))
|
lat1 = math.radians(float(start[0]))
|
||||||
lat2 = math.radians(float(end[0]))
|
lat2 = math.radians(float(end[0]))
|
||||||
|
|
||||||
diffLong = math.radians(float(end[1]) - float(start[1]))
|
diff_long = math.radians(float(end[1]) - float(start[1]))
|
||||||
|
|
||||||
x = math.sin(diffLong) * math.cos(lat2)
|
x = math.sin(diff_long) * math.cos(lat2)
|
||||||
y = math.cos(lat1) * math.sin(lat2) - (
|
y = math.cos(lat1) * math.sin(lat2) - (
|
||||||
math.sin(lat1)
|
math.sin(lat1)
|
||||||
* math.cos(lat2) * math.cos(diffLong)
|
* math.cos(lat2) * math.cos(diff_long)
|
||||||
)
|
)
|
||||||
|
|
||||||
initial_bearing = math.atan2(x, y)
|
initial_bearing = math.atan2(x, y)
|
||||||
@ -202,17 +202,17 @@ def calculate_initial_compass_bearing(start, end):
|
|||||||
|
|
||||||
def degrees_to_cardinal(bearing, full_string=False):
|
def degrees_to_cardinal(bearing, full_string=False):
|
||||||
if full_string:
|
if full_string:
|
||||||
DIRECTIONS = [
|
directions = [
|
||||||
"North", "North-Northeast", "Northeast", "East-Northeast", "East", "East-Southeast",
|
"North", "North-Northeast", "Northeast", "East-Northeast", "East", "East-Southeast",
|
||||||
"Southeast", "South-Southeast", "South", "South-Southwest", "Southwest", "West-Southwest",
|
"Southeast", "South-Southeast", "South", "South-Southwest", "Southwest", "West-Southwest",
|
||||||
"West", "West-Northwest", "Northwest", "North-Northwest", "North",
|
"West", "West-Northwest", "Northwest", "North-Northwest", "North",
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
DIRECTIONS = [
|
directions = [
|
||||||
"N", "NNE", "NE", "ENE", "E", "ESE",
|
"N", "NNE", "NE", "ENE", "E", "ESE",
|
||||||
"SE", "SSE", "S", "SSW", "SW", "WSW",
|
"SE", "SSE", "S", "SSW", "SW", "WSW",
|
||||||
"W", "WNW", "NW", "NNW", "N",
|
"W", "WNW", "NW", "NNW", "N",
|
||||||
]
|
]
|
||||||
|
|
||||||
cardinal = DIRECTIONS[round(bearing / 22.5)]
|
cardinal = directions[round(bearing / 22.5)]
|
||||||
return cardinal
|
return cardinal
|
||||||
|
Loading…
Reference in New Issue
Block a user