2019-11-18 18:21:39 +01:00
#!/bin/bash
2019-11-19 11:34:30 +01:00
if [ " $1 " = = "" ] ; then
echo "Give one of the targets: build, clean, upload"
echo "If you want to use a project directory different"
echo "than the current directory, give it as a second"
echo "argument."
exit 1
fi
if [ " $2 " != "" ] ; then
2019-11-19 11:38:46 +01:00
PROJECT_DIR = $2
2019-11-18 18:21:39 +01:00
else
PROJECT_DIR = $PWD
fi
2019-11-19 11:34:30 +01:00
if [ " $1 " = = "build" ] ; then
pushd $PROJECT_DIR /libraries/esp8266boilerplate/ConfigGenerator && ./configGen.sh && popd
env ARDUINO_SKETCHBOOK_DIR = $PROJECT_DIR arduino-cli compile --fqbn= esp8266:esp8266:nodemcu $PROJECT_DIR /sketch
cp sketch/sketch.esp8266.esp8266.nodemcu.* .
elif [ " $1 " = = "clean" ] ; then
for D in libraries/includes/configuration.h libraries/includes/configuration.cpp sketch/sketch.esp8266.esp8266.nodemcu.bin sketch/sketch.esp8266.esp8266.nodemcu.elf sketch.esp8266.esp8266.nodemcu.bin sketch.esp8266.esp8266.nodemcu.elf; do
echo -n " About to delete $D ... "
rm $PROJECT_DIR /$D && echo "done"
done
elif [ " $1 " = = "upload" ] ; then
echo "About to upload to device"
else
echo " Unknown subcommand ' $1 ' "
exit 1
fi
2019-11-18 18:21:39 +01:00