RAKWireless / udp-packet-forwarder

UDP Packet Forwarder for Docker
MIT License
27 stars 23 forks source link

Service tries to open GPS UART even if GPS is disabled with HAS_GPS=0 #11

Closed xoseperez closed 10 months ago

xoseperez commented 10 months ago

As reported by a user (see https://forum.rakwireless.com/t/rak5146-gps-error/10760):

I have 2 RAK5146 concentrators in a RAK7391 server. I am using the UDP packet forwarder as I need the GPS location. I am running 2 UDP packet forwarders to make use of the 2 RAK5146’s installed. The configuration for packet forwarder 1 is as follows:

version: '2.0'

services:

  udp-packet-forwarder:
    image: rakwireless/udp-packet-forwarder:latest
    container_name: udp-packet-forwarder-c1
    restart: unless-stopped
    privileged: true
    network_mode: host
#    volumes:
#      - ./global_conf.json:/app/global_conf.json:ro
    environment:
      SERVER_HOST: localhost
      MODEL: "RAK5146"
      INTERFACE: "USB"
      HAS_GPS: 1
      RADIO_DEV: "/dev/ttyACM1"
      GPS_DEV: "/dev/ttyAMA0"
      GATEWAY_EUI_SOURCE: "chip"

The configuration of rhte second packet forwarder is as follows:

version: '2.0'

services:

  udp-packet-forwarder:
    image: rakwireless/udp-packet-forwarder:latest
    container_name: udp-packet-forwarder-c2
    restart: unless-stopped
    privileged: true
    network_mode: host
#    volumes:
#     - ./global_conf.json:/app/global_conf.json:ro
    environment:
      SERVER_HOST: localhost
      MODEL: "RAK5146"
      HAS_GPS: 0
      RESET_GPIO: 0
      GATEWAY_EUI: "0016c001ff1e54b3"
      RADIO_DEV: "/dev/ttyACM2"

However, both the packet forwarders wants to access the GPS on /dev/ttyAMA0. As a result I am getting the warning on both packet forwarders (only one log shown):

udp-packet-forwarder-c2  | WARNING: [gps] could not get a valid message from GPS (no time)
udp-packet-forwarder-c2  | WARNING: [gps] could not get a valid message from GPS (no time)
udp-packet-forwarder-c2  | WARNING: [gps] could not get a valid message from GPS (no time)

Why ido both packet forwarders want to access the GPS even though it is disabled in the one? How can a prevent one of the packet forwarders from trying to access the GPS device?

Any help or suggestions would be helpfull

xoseperez commented 10 months ago

Solved in 2.2.0. If the device is not known to have a GPS or HAS_GPS is set to 0 the GPS connection will be disabled.