Skip to content

Commit

Permalink
Merge pull request #981 from lk-iqt/dev/mavlink-api
Browse files Browse the repository at this point in the history
Mavlink-api gps_checks
  • Loading branch information
anarkiwi authored Nov 22, 2023
2 parents af782c6 + 9c47a1d commit e6a0c76
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
12 changes: 11 additions & 1 deletion gamutrf/mqtt_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,17 @@ def get_heading(self):
logging.error("could not update heading: %s", err)

def add_gps(self, publish_args):
if not self.gps_server or not self.use_external_gps:
if not self.gps_server and not self.external_gps_server:
logging.error("no gps_server or external_gps_server found")
return publish_args
if (
self.external_gps_server
and not self.use_external_gps
and not self.gps_server
):
logging.error(
"only external_gps_server found, but no use_external_gps flag"
)
return publish_args
publish_args.update(
{
Expand Down
8 changes: 7 additions & 1 deletion gamutrf/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ def argument_parser():
default=ORCHESTRATOR,
type=str,
)
parser.add_argument(
"--gps_server",
help="GPS Server to get lat,long, and heading",
default=ORCHESTRATOR,
type=str,
)
parser.add_argument(
"--rssi_interval",
help="rate limit in seconds for RSSI updates to MQTT",
Expand Down Expand Up @@ -252,7 +258,7 @@ def __init__(self, arguments):
self.mqtt_reporter = MQTTReporter(
name=self.arguments.name,
mqtt_server=self.arguments.mqtt_server,
gps_server=ORCHESTRATOR,
gps_server=self.arguments.gps_server,
compass=True,
use_external_gps=self.arguments.use_external_gps,
use_external_heading=self.arguments.use_external_heading,
Expand Down
1 change: 1 addition & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class FakeArgs:
def __init__(self):
self.name = "test"
self.mqtt_server = ""
self.gps_server = ""
self.use_external_gps = False
self.use_external_heading = False
self.external_gps_server = ""
Expand Down

0 comments on commit e6a0c76

Please sign in to comment.