SensESP
2.7.2
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
ota.cpp
Go to the documentation of this file.
1
#include "
ota.h
"
2
3
#include <Arduino.h>
4
#include <ArduinoOTA.h>
5
6
#include "
sensesp.h
"
7
8
namespace
sensesp
{
9
10
void
OTA::start
() {
11
ArduinoOTA
.setPassword(password_);
12
ArduinoOTA
.onStart([]() {
debugW
(
"Starting OTA"
); });
13
ArduinoOTA
.onEnd([]() {
debugW
(
"OTA End"
); });
14
ArduinoOTA
.onProgress([](
unsigned
int
progress
,
unsigned
int
total
) {
15
debugI
(
"OTA Progress: %u%%\r"
, (
progress
/ (
total
/ 100)));
16
});
17
ArduinoOTA
.onError([](
ota_error_t
error
) {
18
debugE
(
"OTA Error[%u]: "
,
error
);
19
if
(
error
==
OTA_AUTH_ERROR
) {
20
debugE
(
"OTA Auth Failed"
);
21
}
else
if
(
error
==
OTA_BEGIN_ERROR
) {
22
debugE
(
"OTA Begin Failed"
);
23
}
else
if
(
error
==
OTA_CONNECT_ERROR
) {
24
debugE
(
"OTA Connect Failed"
);
25
}
else
if
(
error
==
OTA_RECEIVE_ERROR
) {
26
debugE
(
"OTA Receive Failed"
);
27
}
else
if
(
error
==
OTA_END_ERROR
) {
28
debugE
(
"OTA End Failed"
);
29
}
30
});
31
ArduinoOTA
.begin();
32
ReactESP::app->onRepeat(20, OTA::handle_ota);
33
}
34
35
void
OTA::handle_ota() {
ArduinoOTA
.handle(); }
36
37
}
// namespace sensesp
sensesp::LambdaTransform
Construct a new transform based on a single function.
Definition
lambda_transform.h:71
sensesp::OTA::start
virtual void start() override
Definition
ota.cpp:10
debugI
#define debugI(fmt,...)
Definition
local_debug.h:48
debugE
#define debugE(fmt,...)
Definition
local_debug.h:50
debugW
#define debugW(fmt,...)
Definition
local_debug.h:49
sensesp
Definition
sensesp.h:22
ota.h
sensesp.h
src
sensesp
net
ota.cpp
Generated by
1.9.8