From 37e018d1ff02f58ca0744c3ac7d2c872eeb4e8a4 Mon Sep 17 00:00:00 2001 From: Ray Ozzie Date: Sat, 16 Apr 2016 15:05:52 -0700 Subject: [PATCH] add gateway type --- README.md | 20 ++++++++++++++++---- run.sh | 26 +++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b956914..a579412 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ Resin Dockerfile & scripts for [The Things Network](http://thethingsnetwork.org/) gateways based on the Raspberry Pi. -It supports two configurations: +It supports two configuration types, based on the gateway hardware you're attaching to your Raspberry Pi: -1. A [LinkLabs Raspberry Pi "Hat"](http://link-labs.myshopify.com/products/lorawan-raspberry-pi-board) -2. An [IMST iC880A-SPI](http://webshop.imst.de/ic880a-spi-lorawan-concentrator-868mhz.html) configured as described [here](https://github.com/ttn-zh/ic880a-gateway/tree/spi) +1. "linklabs-dev", a [LinkLabs Raspberry Pi "Hat"](http://link-labs.myshopify.com/products/lorawan-raspberry-pi-board) +2. "imst-ic880a-spi", an [IMST iC880A-SPI](http://webshop.imst.de/ic880a-spi-lorawan-concentrator-868mhz.html) configured as described [here](https://github.com/ttn-zh/ic880a-gateway/tree/spi) ## PREREQUISITES @@ -24,12 +24,13 @@ It supports two configurations: ## PREPARING YOUR FIRST GATEWAY DEVICE FOR TTN -Click the "Environment Variables" section at the left side of the screen. This will allow you to configure environment parameters for this and only this device, and which will be appropriately inserted into this device's "local_conf.json" with lowercase tuple names derived from the appropriate uppercase environment names beginning with "GW_". For example, for an IMST gateway with no GPS, the MINIMUM environment variables that you should configure at this screen should look something like this. For the LinkLabs gateway, which has a built-in GPS, you only need REGION, CONTACT_EMAIL, and DESCRIPTION. +Click the "Environment Variables" section at the left side of the screen. This will allow you to configure environment parameters for this and only this device, and which will be appropriately inserted into this device's "local_conf.json" with lowercase tuple names derived from the appropriate uppercase environment names beginning with "GW_". For example, for an IMST gateway with no GPS, the MINIMUM environment variables that you should configure at this screen should look something like this: DEVICE ENVIRONMENT VARIABLES Name | Value ------------------|-------------------------- +GW_TYPE | imst-ic880a-spi GW_REGION | EU GW_CONTACT_EMAIL | yourname@yourdomain.com GW_DESCRIPTION | your-gateway-1 @@ -38,6 +39,17 @@ GW_REF_LATITUDE | 52.376364 GW_REF_LONGITUDE | 4.884232 GW_REF_ALTITUDE | 3 +On the other hand, for the LinkLabs gateway, which has a built-in GPS, you only need TYPE, REGION, CONTACT_EMAIL, and DESCRIPTION. + +DEVICE ENVIRONMENT VARIABLES + +Name | Value +------------------|-------------------------- +GW_TYPE | linklabs-dev +GW_REGION | EU +GW_CONTACT_EMAIL | yourname@yourdomain.com +GW_DESCRIPTION | your-gateway-1 + ## TRANSFERRING TTN GATEWAY SOFTWARE TO RESIN SO THAT IT MAY BE DOWNLOADED ON YOUR DEVICES 1. On your Mac or PC, in terminal, change your working directory to the directory that is the clone of **this** git repo. diff --git a/run.sh b/run.sh index daf056b..8452c67 100755 --- a/run.sh +++ b/run.sh @@ -33,11 +33,19 @@ echo GW_REGION: $GW_REGION if [[ $GW_DESCRIPTION == "" ]]; then echo "ERROR: GW_DESCRIPTION required" + echo "See https://github.com/rayozzie/ttn-resin-gateway-rpi/blob/master/README.md" exit 1 fi if [[ $GW_CONTACT_EMAIL == "" ]]; then echo "ERROR: GW_CONTACT_EMAIL required" + echo "See https://github.com/rayozzie/ttn-resin-gateway-rpi/blob/master/README.md" + exit 1 +fi + +if [[ $GW_TYPE == "" ]]; then + echo "ERROR: GW_TYPE required" + echo "See https://github.com/rayozzie/ttn-resin-gateway-rpi/blob/master/README.md" exit 1 fi @@ -158,8 +166,10 @@ echo "******************" echo "******************" echo "" -# Reset iC880a PIN - this is necessary to reset its state +# Reset the board to a known state prior to launching the forwarder +if [[ $GW_TYPE == "imst-ic880a-spi" ]]; then +echo "Resetting IMST iC880A-SPI" gpio -1 mode 22 out gpio -1 write 22 0 sleep 0.1 @@ -167,6 +177,20 @@ gpio -1 write 22 1 sleep 0.1 gpio -1 write 22 0 sleep 0.1 +if [[ $GW_TYPE == "linklabs-dev" ]]; then +echo "Resetting LinkLabs Raspberry Pi Development Board"" +gpio -1 mode 29 out +gpio -1 write 29 0 +sleep 0.1 +gpio -1 write 29 1 +sleep 0.1 +gpio -1 write 29 0 +sleep 0.1 +else + echo "ERROR: unrecognized GW_TYPE=$GW_TYPE" + echo "See https://github.com/rayozzie/ttn-resin-gateway-rpi/blob/master/README.md" + exit 1 +fi # Fire up the forwarder.