From fb80090d1b7cfd2ad9ae417bc609b21fcca4481f Mon Sep 17 00:00:00 2001 From: Fisch Date: Mon, 25 Jul 2022 13:59:05 +0200 Subject: [PATCH] add automatic flash script --- otaflash.sh | 18 ++++++++++++++++++ src/simpleota.h | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 otaflash.sh diff --git a/otaflash.sh b/otaflash.sh new file mode 100644 index 0000000..54f51fd --- /dev/null +++ b/otaflash.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +do_this_on_ctrl_c(){ + echo "Stopped searching!" + exit 0 +} + +trap 'do_this_on_ctrl_c' SIGINT + +printf "ip: %s" "$1" +printf "\n%s" "waiting for Device ..." +while ! ping -c 1 -n -w 1 $1 &> /dev/null +do + printf "%c" "." +done +printf "\n%s\n" "Device is online" +pio run -t upload --upload-port $1 + diff --git a/src/simpleota.h b/src/simpleota.h index bbd62f7..f2ee904 100644 --- a/src/simpleota.h +++ b/src/simpleota.h @@ -8,7 +8,7 @@ #define OTA_WIFI_SSID "Chaos-West temp alternative" #define OTA_WIFI_PASSWORD "" -#define OTA_WAIT_TIMEOUT 1000 // in 0.1s increments -> 10s +#define OTA_WAIT_TIMEOUT 20 // in 0.1s increments -> 10s #define OTA_PASSWORD "MCH2022OTA" //password needed for ota flashing void checkOTA();