Skip to content

Commit

Permalink
Merge pull request #277 from anarkiwi/staticpos
Browse files Browse the repository at this point in the history
Allow configuration of static position/heading.
  • Loading branch information
anarkiwi authored Jun 20, 2023
2 parents 7ca4695 + 086c8ea commit ed0a900
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions sigscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,18 @@ def __init__(self, config_path="sigscan_config.ini"):
config = configparser.ConfigParser()
config.read(config_path)
self.config = config["sigscan"]
self.static_position = None
self.static_heading = None

def data_handler(self, message_data):
"""
Generic data processor
"""
if self.static_position:
message_data["position"] = self.static_position
if self.static_heading is not None:
message_data["heading"] = self.static_heading

self.data["previous_position"] = (
self.data.get("position", None)
if not self.data.get("needs_processing", True)
Expand Down Expand Up @@ -190,6 +197,16 @@ def main(self):
"""
Main loop
"""
static_position = self.config.get("static_position", None)
if static_position:
static_position = [float(i) for i in static_position.split(",")]
self.static_position = static_position

static_heading = self.config.get("static_heading", None)
if static_heading is not None:
static_heading = float(static_heading)
self.static_heading = static_heading

replay_file = self.config.get("replay_file", None)

mqtt_host = self.config.get("mqtt_host", "localhost")
Expand Down
4 changes: 4 additions & 0 deletions sigscan_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,7 @@ freq = 5.7e9
fading_sigma = 8
threshold = -90
#################

# if defined, use static antenna position and heading.
# static_position = -41.276825,174.777969
# static_heading = 0

0 comments on commit ed0a900

Please sign in to comment.