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:
co-authored by
GitHub
Ben Meadors
Jonathan Bennett
parent
23bb55d965
commit
2fdb722e00
@@ -120,6 +120,9 @@ extern struct portduino_config_struct {
|
||||
|
||||
// GPS
|
||||
bool has_gps = false;
|
||||
std::string gps_serial_path = "";
|
||||
std::string gpsd_host = "";
|
||||
int gpsd_port = 2947;
|
||||
|
||||
// I2C
|
||||
std::string i2cdev = "";
|
||||
@@ -360,6 +363,18 @@ extern struct portduino_config_struct {
|
||||
out << YAML::EndMap; // GPIO
|
||||
}
|
||||
|
||||
if (has_gps) {
|
||||
out << YAML::Key << "GPS" << YAML::Value << YAML::BeginMap;
|
||||
if (!gpsd_host.empty()) {
|
||||
out << YAML::Key << "GpsdHost" << YAML::Value << gpsd_host;
|
||||
if (gpsd_port != 2947)
|
||||
out << YAML::Key << "GpsdPort" << YAML::Value << gpsd_port;
|
||||
} else if (!gps_serial_path.empty()) {
|
||||
out << YAML::Key << "SerialPath" << YAML::Value << gps_serial_path;
|
||||
}
|
||||
out << YAML::EndMap; // GPS
|
||||
}
|
||||
|
||||
if (i2cdev != "") {
|
||||
out << YAML::Key << "I2C" << YAML::Value << YAML::BeginMap;
|
||||
out << YAML::Key << "I2CDevice" << YAML::Value << i2cdev;
|
||||
|
||||
Reference in New Issue
Block a user