Browse Source

Improved script on macosx system

master
Anthony Hinsinger 7 years ago
parent
commit
8b930cc554
  1. 4
      mbed_app.json
  2. 13
      scripts/gen_images.sh

4
mbed_app.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"config": {
"tx-timer": { "value": 30000 },
"tx-timer": { "value": 600000 },
"lora-radio": {
"help": "Which radio to use (options: SX1272,SX1276)",
"value": "SX1276"
@ -61,8 +61,6 @@ @@ -61,8 +61,6 @@
"main_stack_size": 1024,
"target.lpticker_lptim": 0,
"target.clock_source": "USE_PLL_HSI",
"lora.duty-cycle-on": false,
"tx-timer": 600000,
"lora-radio": "SX1272",
"lora-spi-mosi": "D11",
"lora-spi-miso": "D12",

13
scripts/gen_images.sh

@ -13,9 +13,18 @@ if [ $# -ne 2 ]; then @@ -13,9 +13,18 @@ if [ $# -ne 2 ]; then
exit 1;
fi
SED=sed
MASTER=$1
DEVICES=$2
if [[ $OSTYPE == "darwin"* ]]; then
if ! command -v gsed > /dev/null 2>&1; then
echo "You need gnu-sed on darwin system (available with homebrew)"
exit 1
fi
SED=gsed
fi
if [ ! -e $MASTER ]; then
echo "The master file $MASTER doesn't exists"
exit 1;
@ -31,8 +40,8 @@ for DEVICE in $(cat $DEVICES); do @@ -31,8 +40,8 @@ for DEVICE in $(cat $DEVICES); do
deviceeui=$(echo $DEVICE | cut -d : -f 2)
appeui=$(echo $DEVICE | cut -d : -f 3)
appkey=$(echo $DEVICE | cut -d : -f 4)
echo $name
hexdump -ve '1/1 "%.2X"' $MASTERFILE | sed "s/$DEVICEEUI/$deviceeui/; s/$APPEUI/$appeui/; s/$APPKEY/$appkey/" | xxd -r -p > waveofhoney-${name}.bin
echo "Generating device $name ($deviceeui)"
hexdump -ve '1/1 "%.2X"' $MASTER | $SED "s/${DEVICEEUI}/${deviceeui}/; s/${APPEUI}/${appeui}/; s/${APPKEY}/${appkey}/" | xxd -r -p - ${deviceeui}.bin
done
exit;
Loading…
Cancel
Save