From d2085041c6ec92da3aa49348767b671bf03c80a9 Mon Sep 17 00:00:00 2001 From: Fisch Date: Mon, 25 Jul 2022 13:31:12 +0200 Subject: [PATCH] add ota authentification --- platformio.ini | 5 ++++- src/simpleota.cpp | 2 ++ src/simpleota.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 2b208bb..4cf4ef1 100644 --- a/platformio.ini +++ b/platformio.ini @@ -13,4 +13,7 @@ platform = espressif32 board = lolin32 framework = arduino monitor_speed = 115200 -upload_speed = 921600 \ No newline at end of file +upload_speed = 921600 + +upload_flags = + --auth=MCH2022OTA \ No newline at end of file diff --git a/src/simpleota.cpp b/src/simpleota.cpp index 47580fd..a71e93a 100644 --- a/src/simpleota.cpp +++ b/src/simpleota.cpp @@ -34,6 +34,8 @@ bool initOTA() { Serial.print("IP address: "); Serial.println(WiFi.localIP()); + ArduinoOTA.setPassword((const char *)OTA_PASSWORD); + ArduinoOTA .onStart([]() { otaMode = UPDATING; diff --git a/src/simpleota.h b/src/simpleota.h index da00043..bbd62f7 100644 --- a/src/simpleota.h +++ b/src/simpleota.h @@ -9,6 +9,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_PASSWORD "MCH2022OTA" //password needed for ota flashing void checkOTA(); bool initOTA();