Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mavlink-api gps_checks #981

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
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 @@
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 (

Check warning on line 78 in gamutrf/mqtt_reporter.py

View check run for this annotation

Codecov / codecov/patch

gamutrf/mqtt_reporter.py#L78

Added line #L78 was not covered by tests
self.external_gps_server
and not self.use_external_gps
and not self.gps_server
):
logging.error(

Check warning on line 83 in gamutrf/mqtt_reporter.py

View check run for this annotation

Codecov / codecov/patch

gamutrf/mqtt_reporter.py#L83

Added line #L83 was not covered by tests
"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
Loading