11#if defined(USE_LIBRETINY_VARIANT_BK7238) && defined(USE_OTA)
19void LTComponent::dump_config() {
24 <_BANNER_STR[10], LT_LOGLEVEL);
25#if defined(__OPTIMIZE_SIZE__) && __OPTIMIZE_LEVEL__ > 0 && __OPTIMIZE_LEVEL__ <= 3
26 ESP_LOGCONFIG(TAG,
" Optimization: -Os, SDK: -O" STRINGIFY_MACRO(__OPTIMIZE_LEVEL__));
29#if defined(USE_LN882X) && defined(USE_WIFI)
31 static constexpr uint8_t SDK_DEFAULT_MAC[MAC_ADDRESS_SIZE] = {0x00, 0x50, 0xC2, 0x5E, 0x10, 0x88};
32 uint8_t mac[MAC_ADDRESS_SIZE];
34 if (memcmp(mac, SDK_DEFAULT_MAC, MAC_ADDRESS_SIZE) == 0) {
35 ESP_LOGE(TAG,
"MAC is the LN882H SDK default 00:50:C2:5E:10:88; only one device with it can be on a network. "
36 "On a Tuya module, set board: to its Tuya board (e.g. wl2s, wl2h-u) and flash over serial");
40#if defined(USE_BK72XX) && defined(USE_WIFI)
42 static constexpr uint32_t RF_CAL_TLV_MAGIC = 0x00564C54;
43 static constexpr uint32_t RF_CAL_OFFSETS[] = {FLASH_CALIBRATION_OFFSET, 0x1D0000, 0x1E0000, 0x1E3000};
45 for (
uint32_t offset : RF_CAL_OFFSETS) {
47 if (lt_flash_read(offset, (uint8_t *) &magic,
sizeof(magic)) ==
sizeof(magic) && magic == RF_CAL_TLV_MAGIC) {
53 ESP_LOGE(TAG,
"No RF calibration found; Wi-Fi may be unreliable. Check that board: matches this module");
54 }
else if (found != FLASH_CALIBRATION_OFFSET) {
56 "board: layout wrong for this module, RF calibration is at 0x%06" PRIX32
" not 0x%06" PRIX32
57 "; reflash over serial",
58 found, (
uint32_t) FLASH_CALIBRATION_OFFSET);
62#if defined(USE_LIBRETINY_VARIANT_BK7238) && defined(USE_OTA) && \
63 (FLASH_DOWNLOAD_OFFSET == 0x132000 || FLASH_DOWNLOAD_OFFSET == 0x12C000)
66#if FLASH_DOWNLOAD_OFFSET == 0x132000
67 static constexpr uint32_t OTHER_BOOTLOADER_CRC = 0xF42F8C32;
68 static constexpr const char *OTHER_BOOTLOADER =
"Tuya T1 2.0.0; set board: generic-bk7238-tuya";
70 static constexpr uint32_t OTHER_BOOTLOADER_CRC = 0x6BEB0924;
71 static constexpr const char *OTHER_BOOTLOADER =
"Beken 1.0.14; set board: generic-bk7238";
73 uint8_t bootloader[257];
74 if (lt_flash_read(0, bootloader,
sizeof(bootloader)) ==
sizeof(bootloader) &&
75 fdb_calc_crc32(0, bootloader,
sizeof(bootloader)) == OTHER_BOOTLOADER_CRC) {
76 ESP_LOGE(TAG,
"OTA updates are not applied: bootloader is %s, upload, then reset (the upload reports an error)",
82 PUBLISH_STATE(this->version_text_sensor_, <_BANNER_STR[10]);
virtual float get_setup_priority() const
priority of setup().
ESPHOME_LOG_TAG(TAG, "libretiny.crash")
constexpr float LATE
For components that should be initialized at the very end of the setup process.
void get_mac_address_raw(uint8_t *mac)
Get the device MAC address as raw bytes, written into the provided byte array (6 bytes).