add ota authentification

This commit is contained in:
interfisch 2022-07-25 13:31:12 +02:00
parent 285f138485
commit d2085041c6
3 changed files with 7 additions and 1 deletions

View File

@ -13,4 +13,7 @@ platform = espressif32
board = lolin32 board = lolin32
framework = arduino framework = arduino
monitor_speed = 115200 monitor_speed = 115200
upload_speed = 921600 upload_speed = 921600
upload_flags =
--auth=MCH2022OTA

View File

@ -34,6 +34,8 @@ bool initOTA() {
Serial.print("IP address: "); Serial.print("IP address: ");
Serial.println(WiFi.localIP()); Serial.println(WiFi.localIP());
ArduinoOTA.setPassword((const char *)OTA_PASSWORD);
ArduinoOTA ArduinoOTA
.onStart([]() { .onStart([]() {
otaMode = UPDATING; otaMode = UPDATING;

View File

@ -9,6 +9,7 @@
#define OTA_WIFI_SSID "Chaos-West temp alternative" #define OTA_WIFI_SSID "Chaos-West temp alternative"
#define OTA_WIFI_PASSWORD "" #define OTA_WIFI_PASSWORD ""
#define OTA_WAIT_TIMEOUT 1000 // in 0.1s increments -> 10s #define OTA_WAIT_TIMEOUT 1000 // in 0.1s increments -> 10s
#define OTA_PASSWORD "MCH2022OTA" //password needed for ota flashing
void checkOTA(); void checkOTA();
bool initOTA(); bool initOTA();