9 static const char *
const TAG =
"debug";
12 #if !defined(CLANG_TIDY) 13 return ESP.getResetReason().c_str();
20 return ESP.getFreeHeap();
24 const char *flash_mode;
25 switch (ESP.getFlashChipMode()) {
39 flash_mode =
"UNKNOWN";
41 ESP_LOGD(TAG,
"Flash Chip: Size=%ukB Speed=%uMHz Mode=%s",
42 ESP.getFlashChipSize() / 1024,
43 ESP.getFlashChipSpeed() / 1000000, flash_mode);
44 device_info +=
"|Flash: " +
to_string(ESP.getFlashChipSize() / 1024) +
45 "kB Speed:" +
to_string(ESP.getFlashChipSpeed() / 1000000) +
"MHz Mode:";
46 device_info += flash_mode;
48 #if !defined(CLANG_TIDY) 50 ESP_LOGD(TAG,
"Chip ID: 0x%08X", ESP.getChipId());
51 ESP_LOGD(TAG,
"SDK Version: %s", ESP.getSdkVersion());
52 ESP_LOGD(TAG,
"Core Version: %s", ESP.getCoreVersion().c_str());
53 ESP_LOGD(TAG,
"Boot Version=%u Mode=%u", ESP.getBootVersion(), ESP.getBootMode());
54 ESP_LOGD(TAG,
"CPU Frequency: %u", ESP.getCpuFreqMHz());
55 ESP_LOGD(TAG,
"Flash Chip ID=0x%08X", ESP.getFlashChipId());
56 ESP_LOGD(TAG,
"Reset Reason: %s", reset_reason.c_str());
57 ESP_LOGD(TAG,
"Reset Info: %s", ESP.getResetInfo().c_str());
59 device_info +=
"|Chip: 0x" +
format_hex(ESP.getChipId());
60 device_info +=
"|SDK: ";
61 device_info += ESP.getSdkVersion();
62 device_info +=
"|Core: ";
63 device_info += ESP.getCoreVersion().c_str();
64 device_info +=
"|Boot: ";
65 device_info +=
to_string(ESP.getBootVersion());
66 device_info +=
"|Mode: " +
to_string(ESP.getBootMode());
67 device_info +=
"|CPU: " +
to_string(ESP.getCpuFreqMHz());
68 device_info +=
"|Flash: 0x" +
format_hex(ESP.getFlashChipId());
69 device_info +=
"|Reset: ";
70 device_info += reset_reason;
72 device_info += ESP.getResetInfo().c_str();
82 #if USE_ARDUINO_VERSION_CODE >= VERSION_CODE(2, 5, 2)
std::string format_hex(const uint8_t *data, size_t length)
Format the byte array data of length len in lowercased hex.
void get_device_info_(std::string &device_info)
sensor::Sensor * fragmentation_sensor_
void publish_state(float state)
Publish a new state to the front-end.
uint32_t get_free_heap_()
std::string to_string(int value)
std::string get_reset_reason_()
Implementation of SPI Controller mode.
sensor::Sensor * block_sensor_