Ribbit-Network / ribbit-network-frog-hardware

The sensor for the world's largest crowdsourced network of open-source, low-cost, GHG Gas Detection Sensors.
https://www.ribbitnetwork.org/
MIT License
94 stars 26 forks source link

Add GPS serial interface detection #64

Closed djgood closed 2 years ago

djgood commented 2 years ago

Fixes #58.

This change allows the gpsd container to try to auto-detect and configure the correct interface for reading GPS data.

The Raspberry Pi 3 has two separate UART interfaces, I decided to use /dev/ttyACM0 because it is more reliable and doesn't require setting a fixed core frequency. Read more here. I wrote this code for my Raspberry Pi 3, which requires the disable-bt dt overlay to break out /dev/ttyACM0 to the header. But some devices in the Raspberry Pi family require other dt overlays.

The script automatically sets up the required dt overlay via the Balena SDK and also disables the development mode console (if enabled) via dbus. The dev console interferes with gpsd by taking control of /dev/serial0 which is a symbolic link to /dev/ttyACM0 (when disable-bt is enabled).

It should be relatively easy to add support for other devices, I just don't have any other Pis hanging around right now.

keenanjohnson commented 2 years ago

Pushing to a test device here to test now!

keenanjohnson commented 2 years ago

I removed one small space, but this looks great to me!