summaryrefslogtreecommitdiff
path: root/lora_pkt_fwd
diff options
context:
space:
mode:
Diffstat (limited to 'lora_pkt_fwd')
-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];