Add gpsd support to portduino/native (#10781)

* Add gpsd support to portduino

* copilot fixes

* emit gps config in emit_yaml

* Fix formating to standard

* Address coderabitai issues

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
This commit is contained in:
jessm33
2026-06-30 14:44:36 -05:00
committed by GitHub
co-authored by GitHub Ben Meadors Jonathan Bennett
parent 23bb55d965
commit 2fdb722e00
7 changed files with 246 additions and 4 deletions
+15
View File
@@ -942,8 +942,23 @@ bool loadConfig(const char *configPath)
std::string serialPath = yamlConfig["GPS"]["SerialPath"].as<std::string>("");
if (serialPath != "") {
Serial1.setPath(serialPath);
portduino_config.gps_serial_path = serialPath;
portduino_config.has_gps = 1;
}
std::string gpsdHost = yamlConfig["GPS"]["GpsdHost"].as<std::string>("");
if (!gpsdHost.empty()) {
if (portduino_config.has_gps) {
LOG_WARN("GPS config: both SerialPath and GpsdHost are set; GpsdHost takes priority");
}
int gpsdPort = yamlConfig["GPS"]["GpsdPort"].as<int>(2947);
if (gpsdPort < 1 || gpsdPort > 65535) {
LOG_ERROR("GPS config: GpsdPort %d is out of range [1, 65535]; ignoring GPS config", gpsdPort);
} else {
portduino_config.gpsd_host = gpsdHost;
portduino_config.gpsd_port = gpsdPort;
portduino_config.has_gps = 1;
}
}
}
if (yamlConfig["GPIO"]["ExtraPins"]) {
for (auto extra_pin : yamlConfig["GPIO"]["ExtraPins"]) {