ESPHome
2026.10.2
Loading...
Searching...
No Matches
esphome
components
ota
ota_backend_arduino_libretiny.h
Go to the documentation of this file.
1
#pragma once
2
#ifdef USE_LIBRETINY
3
#include "
ota_backend.h
"
4
5
#include "
esphome/components/md5/md5.h
"
6
#include "
esphome/core/defines.h
"
7
8
namespace
esphome::ota
{
9
10
class
ArduinoLibreTinyOTABackend
final {
11
public
:
12
OTAResponseTypes
begin
(
size_t
image_size,
OTAType
ota_type =
OTA_TYPE_UPDATE_APP
);
13
void
set_update_md5
(
const
char
*md5);
14
OTAResponseTypes
write
(uint8_t *data,
size_t
len
);
15
OTAResponseTypes
end
();
16
void
abort
();
17
static
constexpr
bool
supports_compression
() {
return
false
; }
18
19
private
:
20
// LibreTiny uses a full 512-byte UF2 block in place, and patches it there
21
// when writing the OTA2 slot, so it never gets more than one byte less
22
static
constexpr
size_t
MAX_FEED = 511;
23
24
bool
feed_(
const
uint8_t *data,
size_t
len
);
25
26
md5::MD5Digest
md5_{};
27
uint8_t expected_md5_[16];
28
// The last byte is held back until end() has checked the MD5: lt_ota_end(),
29
// which Update.abort() runs too, marks the image bootable once every block is
30
// written.
31
uint8_t pending_{0};
32
bool
has_pending_{
false
};
33
bool
md5_set_{
false
};
34
bool
md5_parsed_{
false
};
35
bool
wrote_{
false
};
36
};
37
38
std::unique_ptr<ArduinoLibreTinyOTABackend>
make_ota_backend
();
39
40
}
// namespace esphome::ota
41
#endif
// USE_LIBRETINY
esphome::md5::MD5Digest
Definition
md5.h:34
esphome::ota::ArduinoLibreTinyOTABackend
Definition
ota_backend_arduino_libretiny.h:10
esphome::ota::ArduinoLibreTinyOTABackend::end
OTAResponseTypes end()
Definition
ota_backend_arduino_libretiny.cpp:75
esphome::ota::ArduinoLibreTinyOTABackend::begin
OTAResponseTypes begin(size_t image_size, OTAType ota_type=OTA_TYPE_UPDATE_APP)
Definition
ota_backend_arduino_libretiny.cpp:19
esphome::ota::ArduinoLibreTinyOTABackend::set_update_md5
void set_update_md5(const char *md5)
Definition
ota_backend_arduino_libretiny.cpp:43
esphome::ota::ArduinoLibreTinyOTABackend::abort
void abort()
Definition
ota_backend_arduino_libretiny.cpp:99
esphome::ota::ArduinoLibreTinyOTABackend::supports_compression
static constexpr bool supports_compression()
Definition
ota_backend_arduino_libretiny.h:17
esphome::ota::ArduinoLibreTinyOTABackend::write
OTAResponseTypes write(uint8_t *data, size_t len)
Definition
ota_backend_arduino_libretiny.cpp:63
defines.h
md5.h
esphome::ota
Definition
automation.h:7
esphome::ota::OTAType
OTAType
Definition
ota_backend.h:92
esphome::ota::OTA_TYPE_UPDATE_APP
@ OTA_TYPE_UPDATE_APP
Definition
ota_backend.h:93
esphome::ota::OTAResponseTypes
OTAResponseTypes
Definition
ota_backend.h:18
esphome::ota::make_ota_backend
std::unique_ptr< ArduinoLibreTinyOTABackend > make_ota_backend()
Definition
ota_backend_arduino_libretiny.cpp:17
esphome::len
const void size_t len
Definition
hal.h:64
ota_backend.h
Generated by
1.12.0