ESPHome 2026.10.2
Loading...
Searching...
No Matches
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
7
8namespace esphome::ota {
9
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);
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
38std::unique_ptr<ArduinoLibreTinyOTABackend> make_ota_backend();
39
40} // namespace esphome::ota
41#endif // USE_LIBRETINY
OTAResponseTypes begin(size_t image_size, OTAType ota_type=OTA_TYPE_UPDATE_APP)
OTAResponseTypes write(uint8_t *data, size_t len)
std::unique_ptr< ArduinoLibreTinyOTABackend > make_ota_backend()
const void size_t len
Definition hal.h:64