feat: support D1
This commit is contained in:
28
ctl.sh
28
ctl.sh
@@ -9,26 +9,40 @@ function info {
|
||||
}
|
||||
|
||||
function build {
|
||||
echo "Building project..."
|
||||
pio run
|
||||
function target {
|
||||
echo "Building project for $1..."
|
||||
pio run -e $1
|
||||
}
|
||||
function all {
|
||||
target esp01_1m
|
||||
target d1_mini
|
||||
}
|
||||
${@:-all}
|
||||
}
|
||||
|
||||
function flash {
|
||||
echo "Flashing firmware..."
|
||||
pio run --target upload
|
||||
function target {
|
||||
echo "Flashing firmware for $1..."
|
||||
pio run --target upload -e $1
|
||||
}
|
||||
function all {
|
||||
target esp01_1m
|
||||
target d1_mini
|
||||
}
|
||||
${@:-all}
|
||||
}
|
||||
|
||||
function ota {
|
||||
function update {
|
||||
echo "Updating node at $1"
|
||||
echo "Updating node at $1 with $2... "
|
||||
curl -X POST \
|
||||
-F "file=@.pio/build/esp01_1m/firmware.bin" \
|
||||
-F "file=@.pio/build/$2/firmware.bin" \
|
||||
http://$1/api/node/update | jq -r '.status'
|
||||
}
|
||||
function all {
|
||||
echo "Updating all nodes..."
|
||||
curl -s http://$API_NODE/api/cluster/members | jq -r '.members.[].ip' | while read -r ip; do
|
||||
ota update $ip
|
||||
ota update $ip $1
|
||||
done
|
||||
}
|
||||
${@:-info}
|
||||
|
||||
Reference in New Issue
Block a user