mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-26 12:46:37 +00:00
Add onPregress callback
This commit is contained in:
parent
307f259a51
commit
1865e340e9
@ -35,6 +35,14 @@ static inline void otaProgress(void)
|
|||||||
(ArduinoOTA.getCommand() == U_FLASH ? PSTR("Firmware") : PSTR("Filesystem")), otaPrecentageComplete);
|
(ArduinoOTA.getCommand() == U_FLASH ? PSTR("Firmware") : PSTR("Filesystem")), otaPrecentageComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void otaOnProgress(unsigned int progress, unsigned int total)
|
||||||
|
{
|
||||||
|
if(total != 0) {
|
||||||
|
otaPrecentageComplete = progress * 100 / total;
|
||||||
|
haspProgressVal(otaPrecentageComplete);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void otaSetup(void)
|
void otaSetup(void)
|
||||||
{
|
{
|
||||||
if(strlen(otaUrl.c_str())) {
|
if(strlen(otaUrl.c_str())) {
|
||||||
@ -63,12 +71,7 @@ void otaSetup(void)
|
|||||||
// setup();
|
// setup();
|
||||||
dispatchReboot(true);
|
dispatchReboot(true);
|
||||||
});
|
});
|
||||||
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
|
ArduinoOTA.onProgress(otaOnProgress);
|
||||||
if(total != 0) {
|
|
||||||
otaPrecentageComplete = progress * 100 / total;
|
|
||||||
haspProgressVal(otaPrecentageComplete);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ArduinoOTA.onError([](ota_error_t error) {
|
ArduinoOTA.onError([](ota_error_t error) {
|
||||||
char buffer[16];
|
char buffer[16];
|
||||||
switch(error) {
|
switch(error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user