stop interrupts on ota update
This commit is contained in:
@@ -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);
|
attachInterrupt(digitalPinToInterrupt(DIN_FUNK), pinLevelChangeIsr, CHANGE);
|
||||||
|
|
||||||
#if 1
|
#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);
|
timerAttachInterrupt(timer, &timerIsr, true);
|
||||||
timerAlarmWrite(timer, ISR_TIME_US, true);
|
timerAlarmWrite(timer, ISR_TIME_US, true);
|
||||||
timerAlarmEnable(timer);
|
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()
|
IRAM_ATTR void InterruptHandler_PauseReceive()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
void InterruptHandler_Init(void);
|
void InterruptHandler_Init(void);
|
||||||
void InterruptHandler_PauseReceive();
|
void InterruptHandler_PauseReceive();
|
||||||
|
void InterruptHandler_Stop(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "WebServer.h"
|
#include "WebServer.h"
|
||||||
#include <Update.h>
|
#include <Update.h>
|
||||||
#include "Version.h"
|
#include "Version.h"
|
||||||
|
#include "InterruptHandler.h"
|
||||||
|
|
||||||
WebServer webServer;
|
WebServer webServer;
|
||||||
|
|
||||||
@@ -80,6 +81,7 @@ void UpdateHandler()
|
|||||||
HTTPUpload& upload = webServer.upload();
|
HTTPUpload& upload = webServer.upload();
|
||||||
if (upload.status == UPLOAD_FILE_START)
|
if (upload.status == UPLOAD_FILE_START)
|
||||||
{
|
{
|
||||||
|
InterruptHandler_Stop();
|
||||||
Serial.printf("Update: %s\n", upload.filename.c_str());
|
Serial.printf("Update: %s\n", upload.filename.c_str());
|
||||||
if (!Update.begin(UPDATE_SIZE_UNKNOWN))
|
if (!Update.begin(UPDATE_SIZE_UNKNOWN))
|
||||||
{ //start with max available size
|
{ //start with max available size
|
||||||
@@ -101,7 +103,7 @@ void UpdateHandler()
|
|||||||
Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize);
|
Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Update.printError(Serial);
|
Update.printError(Serial);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PROJECT_NAME "FENSTER_PIEPSER_NODEMCU_32_S" PROJECT_VARIANT
|
#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_ */
|
#endif /* VERSION_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user