diff --git a/flasher/README.md b/flasher/README.md new file mode 100644 index 00000000..ac55e715 --- /dev/null +++ b/flasher/README.md @@ -0,0 +1,26 @@ +# COOL FLASHER + +With coolFlasher.sh you can send config to the shadow when you flash your board ! + + +## Prerequisites: + + - aws cli +If you haven't, contact your admin for credentials. Then follow those instructions : + - `pip install awscli` + - `aws configure`: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html +- your board is plugged and in _load_ mode +- platformIO + +You always need to use option -e [...] for environnement and you can use -s [...] to flash SPIFFS (configuration) if you use this option you need to give your macAddress ([A-Z0-9]) ex: 32AEA4583D84. + +## Example : + +I want to flash only the code: + +`flasher/flasher.sh -e debug` + +i want to flash the code, the configuration and to send it to the shadow: + +`flash/flasher.sh -e debug -s 32AEA4583D84` + diff --git a/flasher/coolFlasher.sh b/flasher/coolFlasher.sh new file mode 100755 index 00000000..76149222 --- /dev/null +++ b/flasher/coolFlasher.sh @@ -0,0 +1,34 @@ +#!/bin/bash +if [ ${#} -lt 2 ] +then + echo $'Usage : ./coolFlasher.sh -e [env] -s [macAddress] (optionnal) for more information read flasher/README.md\n\n -e [...] choose compilation environnement [minified, prod, debug, trace]\n -s [...] flash SPIFFS and send configuration to aws [yourMacAddress]' +else + if [ ${1} = "-e" ] + then + pio run -e $2 -t upload + fi + if [ ${#} -eq 4 ] + then + if [ ${3} = "-s" ] + then + start='{"state":{"reported":{"config":' + end='}}}' + + general=$(