Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTA don't work with hardware timer #66

Closed
jlfrucot opened this issue Dec 9, 2021 · 3 comments
Closed

OTA don't work with hardware timer #66

jlfrucot opened this issue Dec 9, 2021 · 3 comments

Comments

@jlfrucot
Copy link

jlfrucot commented Dec 9, 2021

Maybe not an issue !
The use of hardware timer blocks OTA update. This may solved by settings this timer in IRAM with IRAM_ATTR like in this example :

`int16_t tempsRestant = timeToGo;
hw_timer_t *Chrono_timer = NULL;
portMUX_TYPE timerChronoMux = portMUX_INITIALIZER_UNLOCKED;
bool ChronoIsRunning = false;
IRAM_ATTR void Chrono_decremente()
{
portENTER_CRITICAL_ISR(&timerChronoMux);
tempsRestant--;
portEXIT_CRITICAL_ISR(&timerChronoMux);
}

IRAM_ATTR hw_timer_t * Chrono_init(uint16_t time)
{
tempsRestant = time;
Chrono_timer = timerBegin(2, 80, true);
timerAttachInterrupt(Chrono_timer, &Chrono_decremente, true);
timerAlarmWrite(Chrono_timer, 1000000, true);
timerAlarmEnable(Chrono_timer);
return Chrono_timer;
}
`

@ayushsharma82
Copy link
Owner

Yeah, DFU ( device firmware upgrade ) is a CPU intensive task. I'll soon add callbacks to ElegantOTA so that users can pause all timers and tasks gracefully before the OTA starts.

@hitenlulla
Copy link

Hey, did you find a solution to this problem? My device highly depends upon Hardware Timer and I want to add the feature of OTA updates. @jlfrucot @ayushsharma82

@ayushsharma82
Copy link
Owner

@hitenlulla Added callbacks in V3. These can be used to stop timers before update starting downloading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants