Skip to content

Commit

Permalink
update config
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheng2216 committed Jul 10, 2023
1 parent a4c7521 commit 05c854f
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 6 deletions.
3 changes: 2 additions & 1 deletion chirpstack_concentratord_sx1302_docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM balenalib/aarch64-debian:bullseye-run as runner
#FROM balenalib/aarch64-debian:bullseye-run as runner
FROM alpine:3.14

# Image metadata
LABEL maintainer="RAKwireless"
Expand Down
3 changes: 2 additions & 1 deletion chirpstack_mqtt_forwarder_docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM balenalib/aarch64-debian:bullseye-run as runner
#FROM balenalib/aarch64-debian:bullseye-run as runner
FROM alpine:3.14

# Image metadata
LABEL maintainer="RAKwireless"
Expand Down
2 changes: 1 addition & 1 deletion configuration/chirpstack/chirpstack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
# is never exposed. Changing this secret will invalidate all login and API
# tokens. The following command can be used to generate a random secret:
# openssl rand -base64 32
secret="you-must-replace-this"
secret="agDYqOjSbdBQ6W7S7ivhYh8oTX7/hpryPlWQ7RFBbUk="


[integration]
Expand Down
8 changes: 5 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ services:
privileged: true
volumes:
# Mount the shared volume for the socket files
- concentratord_sockets_slot2:/tmp/
# - concentratord_sockets_slot2:/tmp/
- /tmp/:/tmp/
- ./configuration/concentratord/concentratord_RAK7391_slot2.toml:/app/concentratord.toml:ro
networks:
- slot_2_local
Expand All @@ -126,7 +127,8 @@ services:
# - "1700:1700/udp"
volumes:
# Mount the shared volume for the socket files
- concentratord_sockets_slot2:/tmp/
# - concentratord_sockets_slot2:/tmp/
- /tmp/:/tmp/
- ./configuration/chirpstack-mqtt-forwarder/chirpstack-mqtt-forwarder-local.toml:/app/chirpstack-mqtt-forwarder.toml:ro
depends_on:
- chirpstack
Expand All @@ -138,7 +140,7 @@ volumes:
postgresqldata:
redisdata:
concentratord_sockets_slot1:
concentratord_sockets_slot2:
# concentratord_sockets_slot2:

networks:
slot_1_cloud:
Expand Down
94 changes: 94 additions & 0 deletions eui_script/find_new.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/usr/bin/env bash

# -----------------------------------------------------------------------------
# Colors
# -----------------------------------------------------------------------------

COLOR_INFO="\e[32m" # green
COLOR_WARNING="\e[33m" # yellow
COLOR_ERROR="\e[31m" # red
COLOR_END="\e[0m"

WIDTH=20

function pad() {

TEXT=$1
LENGTH=$2
FILL=$3

START=$( echo $TEXT | wc -c )
COUNT=$(( $LENGTH - $START ))
printf "$TEXT"
for (( i = 0; i < "$COUNT"; ++i )); do printf "$FILL"; done

}

# -----------------------------------------------------------------------------
# Tests
# -----------------------------------------------------------------------------

function test_corecell {

DEVICE=$1

pad $DEVICE $WIDTH " "
pad "Corecell" $WIDTH " "

local COM_TYPE=""
if [[ "$DEVICE" == *"tty"* ]]; then COM_TYPE="-u"; fi
OUTPUT=$( timeout ${TIMEOUT:-3}s artifacts/corecell/chip_id $COM_TYPE -d $DEVICE )
STATUS=$?

if [[ $STATUS -eq 0 ]]; then
EUI=$( echo $OUTPUT | grep 'EUI' | sed 's/^.*0x//' | tr [a-z] [A-Z] )
pad $EUI $WIDTH " "
FOUND=1
fi

echo ""

}

# -----------------------------------------------------------------------------
# Create reset file
# -----------------------------------------------------------------------------

cp reset_lgw.sh.legacy reset_lgw.sh
sed -i "s#{{RESET_GPIO}}#\"${RESET_GPIO:-6 17}\"#" reset_lgw.sh
sed -i "s#{{POWER_EN_GPIO}}#${POWER_EN_GPIO:-0}#" reset_lgw.sh
sed -i "s#{{POWER_EN_LOGIC}}#${POWER_EN_LOGIC:-0}#" reset_lgw.sh
chmod +x reset_lgw.sh

# -----------------------------------------------------------------------------
# Test all devices
# -----------------------------------------------------------------------------

pad "DEVICE" $WIDTH " "
pad "DESIGN" $WIDTH " "
pad "RESPONSE" $WIDTH " "; echo ""
pad "" $WIDTH "-"
pad "" $WIDTH "-"
pad "" $WIDTH "-"; echo ""

SCAN_USB=${SCAN_USB:-1}
SCAN_SPI=${SCAN_SPI:-1}

if [[ $SCAN_USB -eq 1 ]]; then
if [[ $SCAN_SPI -eq 1 ]]; then
DEVICES=$( ls /dev/spidev* /dev/ttyACM* /dev/ttyUSB* 2> /dev/null )
else
DEVICES=$( ls /dev/ttyACM* /dev/ttyUSB* 2> /dev/null )
fi
else
if [[ $SCAN_SPI -eq 1 ]]; then
DEVICES=$( ls /dev/spidev* 2> /dev/null )
else
DEVICES=""
fi
fi

for DEVICE in $DEVICES; do
FOUND=0
[[ $FOUND -eq 0 ]] && test_corecell $DEVICE
done
21 changes: 21 additions & 0 deletions eui_script/get_eui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/python3

import zmq

context = zmq.Context()

# Socket to talk to server
print("Connecting to hello world server…")
socket = context.socket(zmq.REQ)
# socket.connect("tcp://localhost:5555")
socket.connect("ipc:///tmp/concentratord_command")

# Do 10 requests, waiting each time for a response
for request in range(10):
print("Sending request %s …" % request)
# socket.send(b"Hello")
socket.send(b"gateway_id")

# Get the reply.
message = socket.recv()
print("Received reply %s [ %s ]" % (request, message))
1 change: 1 addition & 0 deletions eui_script/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyzmq==25.1.0

0 comments on commit 05c854f

Please sign in to comment.