summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Sharma <harsh.sharma@multitech.com>2022-04-22 11:15:09 -0500
committerHarsh Sharma <harsh.sharma@multitech.com>2022-04-22 11:15:09 -0500
commit4d86142740b42df862b8268c9eed3a88811dfa6d (patch)
tree99640b1a83fca0403042c2fd941b5571f0806692
parent881a2ed0af92845f5cb5aee8d2762e6e0a5e7c92 (diff)
downloadpacket_forwarder_mtac_full-4d86142740b42df862b8268c9eed3a88811dfa6d.tar.gz
packet_forwarder_mtac_full-4d86142740b42df862b8268c9eed3a88811dfa6d.tar.bz2
packet_forwarder_mtac_full-4d86142740b42df862b8268c9eed3a88811dfa6d.zip
Bug fix: GPS configuration for dual cards4.0.19
-rw-r--r--lora_pkt_fwd/src/lora_pkt_fwd.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c
index c66ed81..885f80e 100644
--- a/lora_pkt_fwd/src/lora_pkt_fwd.c
+++ b/lora_pkt_fwd/src/lora_pkt_fwd.c
@@ -1701,9 +1701,22 @@ int main(int argc, char** argv)
exit(EXIT_FAILURE);
}
+ char lora_port[5] = "lora"; /* path mapping for mts-io */
+ /* set custom SPI device path if configured */
+ if (strlen(spi_device_path) > 0) {
+ if (strcmp(spi_device_path, LORA_PATH_AP1) == 0 ||
+ strcmp(spi_device_path, LORA_PATH_OLD_AP1) == 0) {
+ snprintf(lora_port, sizeof lora_port, "%s", "ap1");
+ } else if (strcmp(spi_device_path, LORA_PATH_AP2) == 0 ||
+ strcmp(spi_device_path, LORA_PATH_OLD_AP2) == 0) {
+ snprintf(lora_port, sizeof lora_port, "%s", "ap2");
+ }
+ lgw_spi_set_path(spi_device_path);
+ }
+
/* Start GPS a.s.a.p., to allow it to lock */
if (use_gps == true) {
- int i = lgw_gps_enable(gps_tty_path, "ubx7", 0, &gps_tty_fd, 1);
+ int i = lgw_gps_enable(gps_tty_path, "ubx7", 0, &gps_tty_fd, ((strcmp(lora_port, "ap2") == 0) ? 2 : 1));
if (i != LGW_GPS_SUCCESS) {
printf("WARNING: [main] impossible to open for GPS sync (Check GPSD)\n");
gps_enabled = false;
@@ -1794,19 +1807,6 @@ int main(int argc, char** argv)
}
freeaddrinfo(result);
- char lora_port[5] = "lora"; /* path mapping for mts-io */
- /* set custom SPI device path if configured */
- if (strlen(spi_device_path) > 0) {
- if (strcmp(spi_device_path, LORA_PATH_AP1) == 0 ||
- strcmp(spi_device_path, LORA_PATH_OLD_AP1) == 0) {
- snprintf(lora_port, sizeof lora_port, "%s", "ap1");
- } else if (strcmp(spi_device_path, LORA_PATH_AP2) == 0 ||
- strcmp(spi_device_path, LORA_PATH_OLD_AP2) == 0) {
- snprintf(lora_port, sizeof lora_port, "%s", "ap2");
- }
- lgw_spi_set_path(spi_device_path);
- }
-
MSG("INFO: [main] resetting %s **************\n", lora_port);
char cmd_pin_low[64];