diff --git a/src/FabReader_v2/src/main.cpp b/src/FabReader_v2/src/main.cpp index cb66063..84fe2c3 100644 --- a/src/FabReader_v2/src/main.cpp +++ b/src/FabReader_v2/src/main.cpp @@ -23,6 +23,9 @@ PubSubClient* mqtt; NFC* nfc; OTAProxy* ota; +unsigned long otatimeout = 3000; +unsigned long lastotatime; + void setup_wifi() { delay(10); @@ -125,8 +128,16 @@ void loop() if(nfc->connecttoCard()) { Serial.println("Card connected"); + lastotatime = millis(); ota->startOTA(); } } } + if(ota->hasActiveOTA()) + { + if(millis() - lastotatime > otatimeout) + { + ota->cancelOTA(); + } + } } \ No newline at end of file