diff --git a/src/InterruptHandler.cpp b/src/InterruptHandler.cpp index 687b2c2..b591bf5 100644 --- a/src/InterruptHandler.cpp +++ b/src/InterruptHandler.cpp @@ -19,6 +19,7 @@ IRAM_ATTR void pinLevelChangeIsr(void); /*****************************************************/ +hw_timer_t * timer; /** @@ -30,7 +31,7 @@ void InterruptHandler_Init(void) attachInterrupt(digitalPinToInterrupt(DIN_FUNK), pinLevelChangeIsr, CHANGE); #if 1 - hw_timer_t * timer = timerBegin(0, 80, true); /* 80 -> 1 Mhz */ + timer = timerBegin(0, 80, true); /* 80 -> 1 Mhz */ timerAttachInterrupt(timer, &timerIsr, true); timerAlarmWrite(timer, ISR_TIME_US, true); timerAlarmEnable(timer); @@ -103,6 +104,12 @@ IRAM_ATTR void timerIsr() } } +IRAM_ATTR void InterruptHandler_Stop(void) +{ + timerAlarmDisable(timer); + detachInterrupt(digitalPinToInterrupt(DIN_FUNK)); +} + IRAM_ATTR void InterruptHandler_PauseReceive() { diff --git a/src/InterruptHandler.h b/src/InterruptHandler.h index 6bb18fc..34712ef 100644 --- a/src/InterruptHandler.h +++ b/src/InterruptHandler.h @@ -18,7 +18,7 @@ void InterruptHandler_Init(void); void InterruptHandler_PauseReceive(); - +void InterruptHandler_Stop(void); diff --git a/src/UpdateHandler.cpp b/src/UpdateHandler.cpp index 4f622cd..e66807e 100644 --- a/src/UpdateHandler.cpp +++ b/src/UpdateHandler.cpp @@ -8,6 +8,7 @@ #include "WebServer.h" #include #include "Version.h" +#include "InterruptHandler.h" WebServer webServer; @@ -80,6 +81,7 @@ void UpdateHandler() HTTPUpload& upload = webServer.upload(); if (upload.status == UPLOAD_FILE_START) { + InterruptHandler_Stop(); Serial.printf("Update: %s\n", upload.filename.c_str()); if (!Update.begin(UPDATE_SIZE_UNKNOWN)) { //start with max available size @@ -101,7 +103,7 @@ void UpdateHandler() Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize); } else - { + { Update.printError(Serial); } } diff --git a/src/Version.h b/src/Version.h index 27a492f..7c48057 100644 --- a/src/Version.h +++ b/src/Version.h @@ -17,7 +17,7 @@ #endif #define PROJECT_NAME "FENSTER_PIEPSER_NODEMCU_32_S" PROJECT_VARIANT -#define VERSION_STR "v2.0.0" +#define VERSION_STR "v2.0.1" #endif /* VERSION_H_ */