Commit de94346c by Oleksandr Barabash

socket fixed and kr_packet updated with compass_offset

parent 0f0d4418
...@@ -48,6 +48,7 @@ class KrPacketV2(BasicDataclass): ...@@ -48,6 +48,7 @@ class KrPacketV2(BasicDataclass):
ant_type: str ant_type: str
latency: int latency: int
processing_time: int processing_time: int
compass_offset: float = 0
def __repr__(self): def __repr__(self):
dt = ( dt = (
...@@ -59,6 +60,10 @@ class KrPacketV2(BasicDataclass): ...@@ -59,6 +60,10 @@ class KrPacketV2(BasicDataclass):
absolute_bearing += 360 absolute_bearing += 360
elif absolute_bearing > 359: elif absolute_bearing > 359:
absolute_bearing -= 360 absolute_bearing -= 360
if self.compass_offset != 0:
absolute_bearing += self.compass_offset
return f"{dt}::{self.station_id}::" \ return f"{dt}::{self.station_id}::" \
f"frequency: {self.freq / 1000000}, " \ f"frequency: {self.freq / 1000000}, " \
f"DoA: {absolute_bearing}, " \ f"DoA: {absolute_bearing}, " \
......
...@@ -148,4 +148,7 @@ class WSClient: ...@@ -148,4 +148,7 @@ class WSClient:
exc_info = (ex.__class__, ex, ex.__traceback__) exc_info = (ex.__class__, ex, ex.__traceback__)
logging.warning("WS error.", exc_info=exc_info) logging.warning("WS error.", exc_info=exc_info)
self.ws = None self.ws = None
finally:
if session is not None:
await session.close()
await asyncio.sleep(0) await asyncio.sleep(0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment