mirror of
https://github.com/esphome/esphome.git
synced 2026-01-20 18:09:10 -07:00
Compare commits
128 Commits
wh_templat
...
combine_lo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8151f29163 | ||
|
|
12027569d3 | ||
|
|
43d836a7d3 | ||
|
|
ab0e15e4bb | ||
|
|
9f7925c1d5 | ||
|
|
7449421cea | ||
|
|
4f20c1ceb1 | ||
|
|
452fcd56dd | ||
|
|
44fc156ef6 | ||
|
|
3ec05a5a13 | ||
|
|
e6a630ae64 | ||
|
|
3c8fd5c5c0 | ||
|
|
a635c82830 | ||
|
|
69f431b053 | ||
|
|
0b9fcf9ed3 | ||
|
|
2d8abbb2ac | ||
|
|
6d8142c539 | ||
|
|
50f27cdd77 | ||
|
|
6c809583d3 | ||
|
|
f41f0506c1 | ||
|
|
850f189225 | ||
|
|
d4baaedd07 | ||
|
|
a37d4b17eb | ||
|
|
7309a65167 | ||
|
|
f22dec6cf1 | ||
|
|
7fde110ac5 | ||
|
|
9ed107bc33 | ||
|
|
b291f359ae | ||
|
|
161545584d | ||
|
|
3ea11d4e59 | ||
|
|
5713d69efe | ||
|
|
9d9f9c3c84 | ||
|
|
29d332af92 | ||
|
|
c44d095f8a | ||
|
|
0b996616b8 | ||
|
|
557b6a9ef0 | ||
|
|
6e633f7f3b | ||
|
|
c59455e445 | ||
|
|
32b3d27c7c | ||
|
|
88cb5d9671 | ||
|
|
56d1d928f9 | ||
|
|
e9cab96cb7 | ||
|
|
022c42f9ca | ||
|
|
25ef9aff04 | ||
|
|
71940acc49 | ||
|
|
f537632599 | ||
|
|
8c7dfa0c62 | ||
|
|
0dbf40dcdf | ||
|
|
05695affff | ||
|
|
f2308c77c6 | ||
|
|
a5368d1d95 | ||
|
|
b8d93f2150 | ||
|
|
ca574a1550 | ||
|
|
b0855b4a0e | ||
|
|
1fccddf67f | ||
|
|
548600b47a | ||
|
|
9bbfad4a08 | ||
|
|
8ae1f26b6a | ||
|
|
9b2a36a313 | ||
|
|
aa4b274b3c | ||
|
|
d1d5c942ec | ||
|
|
ccc9d95c9d | ||
|
|
6d9d593e12 | ||
|
|
fc9683f024 | ||
|
|
61ecfb5f2b | ||
|
|
7e75826064 | ||
|
|
8287484a36 | ||
|
|
dd8259b2ce | ||
|
|
449e478bec | ||
|
|
9ae19d53dc | ||
|
|
77b3ffee00 | ||
|
|
dff8dc0ed1 | ||
|
|
5a8b0f59b8 | ||
|
|
25a325da61 | ||
|
|
a6db5a2ed8 | ||
|
|
9e5dbb073a | ||
|
|
cf513975f3 | ||
|
|
1e70091a27 | ||
|
|
766826cc9c | ||
|
|
8a4ee19c0b | ||
|
|
b1f9c08f51 | ||
|
|
facf4777a4 | ||
|
|
096de869b6 | ||
|
|
c59314ec09 | ||
|
|
e94158a12f | ||
|
|
cb598c43e8 | ||
|
|
6e8817cbc4 | ||
|
|
9f06f046d6 | ||
|
|
44fa6bae95 | ||
|
|
bc9093127e | ||
|
|
cf93b66306 | ||
|
|
16ada4d477 | ||
|
|
c96d0015a0 | ||
|
|
12c6f5749e | ||
|
|
5f1eacf4ec | ||
|
|
d23c6a833b | ||
|
|
5d384c77c5 | ||
|
|
32562ca991 | ||
|
|
6b4b1272db | ||
|
|
7b74f94360 | ||
|
|
997ab553c1 | ||
|
|
8b80fe9c6b | ||
|
|
ee65f2f0cd | ||
|
|
723ccd7547 | ||
|
|
102862e99d | ||
|
|
9cb265347c | ||
|
|
d84562f878 | ||
|
|
6bbee3cfc6 | ||
|
|
41e7ecb29f | ||
|
|
0196d6ee55 | ||
|
|
ea848db683 | ||
|
|
41a188ac35 | ||
|
|
8ddfeb2d38 | ||
|
|
d364432e3a | ||
|
|
2a6b192af8 | ||
|
|
07a581e13a | ||
|
|
5f5edf90e9 | ||
|
|
5e24469ce3 | ||
|
|
d7a1ac83ca | ||
|
|
f11abc7dbf | ||
|
|
ec05692f0d | ||
|
|
2e2e54811a | ||
|
|
48ac8aa75b | ||
|
|
0058779481 | ||
|
|
5bb241e42d | ||
|
|
28d4b6378b | ||
|
|
eea8cdb543 | ||
|
|
70496a4c20 |
@@ -575,5 +575,6 @@ esphome/components/xpt2046/touchscreen/* @nielsnl68 @numo68
|
||||
esphome/components/xxtea/* @clydebarrow
|
||||
esphome/components/zephyr/* @tomaszduda23
|
||||
esphome/components/zhlt01/* @cfeenstra1024
|
||||
esphome/components/zigbee/* @tomaszduda23
|
||||
esphome/components/zio_ultrasonic/* @kahrendt
|
||||
esphome/components/zwave_proxy/* @kbx81
|
||||
|
||||
@@ -90,13 +90,16 @@ void AbsoluteHumidityComponent::loop() {
|
||||
this->status_set_error(LOG_STR("Invalid saturation vapor pressure equation selection!"));
|
||||
return;
|
||||
}
|
||||
ESP_LOGD(TAG, "Saturation vapor pressure %f kPa", es);
|
||||
|
||||
// Calculate absolute humidity
|
||||
const float absolute_humidity = vapor_density(es, hr, temperature_k);
|
||||
|
||||
ESP_LOGD(TAG,
|
||||
"Saturation vapor pressure %f kPa\n"
|
||||
"Publishing absolute humidity %f g/m³",
|
||||
es, absolute_humidity);
|
||||
|
||||
// Publish absolute humidity
|
||||
ESP_LOGD(TAG, "Publishing absolute humidity %f g/m³", absolute_humidity);
|
||||
this->status_clear_warning();
|
||||
this->publish_state(absolute_humidity);
|
||||
}
|
||||
|
||||
@@ -211,13 +211,13 @@ void AcDimmer::write_state(float state) {
|
||||
this->store_.value = new_value;
|
||||
}
|
||||
void AcDimmer::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "AcDimmer:");
|
||||
LOG_PIN(" Output Pin: ", this->gate_pin_);
|
||||
LOG_PIN(" Zero-Cross Pin: ", this->zero_cross_pin_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"AcDimmer:\n"
|
||||
" Min Power: %.1f%%\n"
|
||||
" Init with half cycle: %s",
|
||||
this->store_.min_power / 10.0f, YESNO(this->init_with_half_cycle_));
|
||||
LOG_PIN(" Output Pin: ", this->gate_pin_);
|
||||
LOG_PIN(" Zero-Cross Pin: ", this->zero_cross_pin_);
|
||||
if (method_ == DIM_METHOD_LEADING_PULSE) {
|
||||
ESP_LOGCONFIG(TAG, " Method: leading pulse");
|
||||
} else if (method_ == DIM_METHOD_LEADING) {
|
||||
|
||||
@@ -3,6 +3,7 @@ import esphome.codegen as cg
|
||||
from esphome.components import output
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import CONF_ID, CONF_METHOD, CONF_MIN_POWER
|
||||
from esphome.core import CORE
|
||||
|
||||
CODEOWNERS = ["@glmnet"]
|
||||
|
||||
@@ -36,6 +37,12 @@ CONFIG_SCHEMA = cv.All(
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
if CORE.is_esp8266:
|
||||
# ac_dimmer uses setTimer1Callback which requires the waveform generator
|
||||
from esphome.components.esp8266.const import require_waveform
|
||||
|
||||
require_waveform()
|
||||
|
||||
var = cg.new_Pvariable(config[CONF_ID])
|
||||
await cg.register_component(var, config)
|
||||
|
||||
|
||||
@@ -121,23 +121,21 @@ void ADCSensor::setup() {
|
||||
void ADCSensor::dump_config() {
|
||||
LOG_SENSOR("", "ADC Sensor", this);
|
||||
LOG_PIN(" Pin: ", this->pin_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
" Channel: %d\n"
|
||||
" Unit: %s\n"
|
||||
" Attenuation: %s\n"
|
||||
" Samples: %i\n"
|
||||
" Sampling mode: %s",
|
||||
this->channel_, LOG_STR_ARG(adc_unit_to_str(this->adc_unit_)),
|
||||
this->autorange_ ? "Auto" : LOG_STR_ARG(attenuation_to_str(this->attenuation_)), this->sample_count_,
|
||||
LOG_STR_ARG(sampling_mode_to_str(this->sampling_mode_)));
|
||||
|
||||
ESP_LOGCONFIG(
|
||||
TAG,
|
||||
" Channel: %d\n"
|
||||
" Unit: %s\n"
|
||||
" Attenuation: %s\n"
|
||||
" Samples: %i\n"
|
||||
" Sampling mode: %s\n"
|
||||
" Setup Status:\n"
|
||||
" Handle Init: %s\n"
|
||||
" Config: %s\n"
|
||||
" Calibration: %s\n"
|
||||
" Overall Init: %s",
|
||||
this->channel_, LOG_STR_ARG(adc_unit_to_str(this->adc_unit_)),
|
||||
this->autorange_ ? "Auto" : LOG_STR_ARG(attenuation_to_str(this->attenuation_)), this->sample_count_,
|
||||
LOG_STR_ARG(sampling_mode_to_str(this->sampling_mode_)),
|
||||
this->setup_flags_.handle_init_complete ? "OK" : "FAILED", this->setup_flags_.config_complete ? "OK" : "FAILED",
|
||||
this->setup_flags_.calibration_complete ? "OK" : "FAILED", this->setup_flags_.init_complete ? "OK" : "FAILED");
|
||||
|
||||
|
||||
@@ -162,11 +162,13 @@ void ADE7880::update() {
|
||||
}
|
||||
|
||||
void ADE7880::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "ADE7880:");
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"ADE7880:\n"
|
||||
" Frequency: %.0f Hz",
|
||||
this->frequency_);
|
||||
LOG_PIN(" IRQ0 Pin: ", this->irq0_pin_);
|
||||
LOG_PIN(" IRQ1 Pin: ", this->irq1_pin_);
|
||||
LOG_PIN(" RESET Pin: ", this->reset_pin_);
|
||||
ESP_LOGCONFIG(TAG, " Frequency: %.0f Hz", this->frequency_);
|
||||
|
||||
if (this->channel_a_ != nullptr) {
|
||||
ESP_LOGCONFIG(TAG, " Phase A:");
|
||||
|
||||
@@ -21,10 +21,12 @@ void ADS1115Sensor::update() {
|
||||
|
||||
void ADS1115Sensor::dump_config() {
|
||||
LOG_SENSOR(" ", "ADS1115 Sensor", this);
|
||||
ESP_LOGCONFIG(TAG, " Multiplexer: %u", this->multiplexer_);
|
||||
ESP_LOGCONFIG(TAG, " Gain: %u", this->gain_);
|
||||
ESP_LOGCONFIG(TAG, " Resolution: %u", this->resolution_);
|
||||
ESP_LOGCONFIG(TAG, " Sample rate: %u", this->samplerate_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
" Multiplexer: %u\n"
|
||||
" Gain: %u\n"
|
||||
" Resolution: %u\n"
|
||||
" Sample rate: %u",
|
||||
this->multiplexer_, this->gain_, this->resolution_, this->samplerate_);
|
||||
}
|
||||
|
||||
} // namespace ads1115
|
||||
|
||||
@@ -9,8 +9,10 @@ static const char *const TAG = "ads1118.sensor";
|
||||
|
||||
void ADS1118Sensor::dump_config() {
|
||||
LOG_SENSOR(" ", "ADS1118 Sensor", this);
|
||||
ESP_LOGCONFIG(TAG, " Multiplexer: %u", this->multiplexer_);
|
||||
ESP_LOGCONFIG(TAG, " Gain: %u", this->gain_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
" Multiplexer: %u\n"
|
||||
" Gain: %u",
|
||||
this->multiplexer_, this->gain_);
|
||||
}
|
||||
|
||||
float ADS1118Sensor::sample() {
|
||||
|
||||
@@ -67,8 +67,10 @@ void Anova::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_
|
||||
case ESP_GATTC_SEARCH_CMPL_EVT: {
|
||||
auto *chr = this->parent_->get_characteristic(ANOVA_SERVICE_UUID, ANOVA_CHARACTERISTIC_UUID);
|
||||
if (chr == nullptr) {
|
||||
ESP_LOGW(TAG, "[%s] No control service found at device, not an Anova..?", this->get_name().c_str());
|
||||
ESP_LOGW(TAG, "[%s] Note, this component does not currently support Anova Nano.", this->get_name().c_str());
|
||||
ESP_LOGW(TAG,
|
||||
"[%s] No control service found at device, not an Anova..?\n"
|
||||
"[%s] Note, this component does not currently support Anova Nano.",
|
||||
this->get_name().c_str(), this->get_name().c_str());
|
||||
break;
|
||||
}
|
||||
this->char_handle_ = chr->handle;
|
||||
|
||||
@@ -1874,9 +1874,9 @@ bool APIConnection::schedule_batch_() {
|
||||
}
|
||||
|
||||
void APIConnection::process_batch_() {
|
||||
// Ensure PacketInfo remains trivially destructible for our placement new approach
|
||||
static_assert(std::is_trivially_destructible<PacketInfo>::value,
|
||||
"PacketInfo must remain trivially destructible with this placement-new approach");
|
||||
// Ensure MessageInfo remains trivially destructible for our placement new approach
|
||||
static_assert(std::is_trivially_destructible<MessageInfo>::value,
|
||||
"MessageInfo must remain trivially destructible with this placement-new approach");
|
||||
|
||||
if (this->deferred_batch_.empty()) {
|
||||
this->flags_.batch_scheduled = false;
|
||||
@@ -1916,12 +1916,12 @@ void APIConnection::process_batch_() {
|
||||
return;
|
||||
}
|
||||
|
||||
size_t packets_to_process = std::min(num_items, MAX_PACKETS_PER_BATCH);
|
||||
size_t messages_to_process = std::min(num_items, MAX_MESSAGES_PER_BATCH);
|
||||
|
||||
// Stack-allocated array for packet info
|
||||
alignas(PacketInfo) char packet_info_storage[MAX_PACKETS_PER_BATCH * sizeof(PacketInfo)];
|
||||
PacketInfo *packet_info = reinterpret_cast<PacketInfo *>(packet_info_storage);
|
||||
size_t packet_count = 0;
|
||||
// Stack-allocated array for message info
|
||||
alignas(MessageInfo) char message_info_storage[MAX_MESSAGES_PER_BATCH * sizeof(MessageInfo)];
|
||||
MessageInfo *message_info = reinterpret_cast<MessageInfo *>(message_info_storage);
|
||||
size_t message_count = 0;
|
||||
|
||||
// Cache these values to avoid repeated virtual calls
|
||||
const uint8_t header_padding = this->helper_->frame_header_padding();
|
||||
@@ -1952,7 +1952,7 @@ void APIConnection::process_batch_() {
|
||||
uint32_t current_offset = 0;
|
||||
|
||||
// Process items and encode directly to buffer (up to our limit)
|
||||
for (size_t i = 0; i < packets_to_process; i++) {
|
||||
for (size_t i = 0; i < messages_to_process; i++) {
|
||||
const auto &item = this->deferred_batch_[i];
|
||||
// Try to encode message
|
||||
// The creator will calculate overhead to determine if the message fits
|
||||
@@ -1966,11 +1966,11 @@ void APIConnection::process_batch_() {
|
||||
// Message was encoded successfully
|
||||
// payload_size is header_padding + actual payload size + footer_size
|
||||
uint16_t proto_payload_size = payload_size - header_padding - footer_size;
|
||||
// Use placement new to construct PacketInfo in pre-allocated stack array
|
||||
// This avoids default-constructing all MAX_PACKETS_PER_BATCH elements
|
||||
// Explicit destruction is not needed because PacketInfo is trivially destructible,
|
||||
// Use placement new to construct MessageInfo in pre-allocated stack array
|
||||
// This avoids default-constructing all MAX_MESSAGES_PER_BATCH elements
|
||||
// Explicit destruction is not needed because MessageInfo is trivially destructible,
|
||||
// as ensured by the static_assert in its definition.
|
||||
new (&packet_info[packet_count++]) PacketInfo(item.message_type, current_offset, proto_payload_size);
|
||||
new (&message_info[message_count++]) MessageInfo(item.message_type, current_offset, proto_payload_size);
|
||||
|
||||
// Update tracking variables
|
||||
items_processed++;
|
||||
@@ -1994,9 +1994,9 @@ void APIConnection::process_batch_() {
|
||||
shared_buf.resize(shared_buf.size() + footer_size);
|
||||
}
|
||||
|
||||
// Send all collected packets
|
||||
APIError err = this->helper_->write_protobuf_packets(ProtoWriteBuffer{&shared_buf},
|
||||
std::span<const PacketInfo>(packet_info, packet_count));
|
||||
// Send all collected messages
|
||||
APIError err = this->helper_->write_protobuf_messages(ProtoWriteBuffer{&shared_buf},
|
||||
std::span<const MessageInfo>(message_info, message_count));
|
||||
if (err != APIError::OK && err != APIError::WOULD_BLOCK) {
|
||||
this->fatal_error_with_log_(LOG_STR("Batch write failed"), err);
|
||||
}
|
||||
|
||||
@@ -28,14 +28,9 @@ static constexpr uint32_t KEEPALIVE_TIMEOUT_MS = 60000;
|
||||
// TODO: Remove MAX_INITIAL_PER_BATCH_LEGACY before 2026.7.0 - all clients should support API 1.14 by then
|
||||
static constexpr size_t MAX_INITIAL_PER_BATCH_LEGACY = 24; // For clients < API 1.14 (includes object_id)
|
||||
static constexpr size_t MAX_INITIAL_PER_BATCH = 34; // For clients >= API 1.14 (no object_id)
|
||||
// Maximum number of packets to process in a single batch (platform-dependent)
|
||||
// This limit exists to prevent stack overflow from the PacketInfo array in process_batch_
|
||||
// Each PacketInfo is 8 bytes, so 64 * 8 = 512 bytes, 32 * 8 = 256 bytes
|
||||
#if defined(USE_ESP32) || defined(USE_HOST)
|
||||
static constexpr size_t MAX_PACKETS_PER_BATCH = 64; // ESP32 has 8KB+ stack, HOST has plenty
|
||||
#else
|
||||
static constexpr size_t MAX_PACKETS_PER_BATCH = 32; // ESP8266/RP2040/etc have smaller stacks
|
||||
#endif
|
||||
// Verify MAX_MESSAGES_PER_BATCH (defined in api_frame_helper.h) can hold the initial batch
|
||||
static_assert(MAX_MESSAGES_PER_BATCH >= MAX_INITIAL_PER_BATCH,
|
||||
"MAX_MESSAGES_PER_BATCH must be >= MAX_INITIAL_PER_BATCH");
|
||||
|
||||
class APIConnection final : public APIServerConnection {
|
||||
public:
|
||||
|
||||
@@ -29,6 +29,10 @@ static constexpr uint16_t MAX_MESSAGE_SIZE = 8192; // 8 KiB for ESP8266
|
||||
static constexpr uint16_t MAX_MESSAGE_SIZE = 32768; // 32 KiB for ESP32 and other platforms
|
||||
#endif
|
||||
|
||||
// Maximum number of messages to batch in a single write operation
|
||||
// Must be >= MAX_INITIAL_PER_BATCH in api_connection.h (enforced by static_assert there)
|
||||
static constexpr size_t MAX_MESSAGES_PER_BATCH = 34;
|
||||
|
||||
// Forward declaration
|
||||
struct ClientInfo;
|
||||
|
||||
@@ -40,13 +44,13 @@ struct ReadPacketBuffer {
|
||||
uint16_t type;
|
||||
};
|
||||
|
||||
// Packed packet info structure to minimize memory usage
|
||||
struct PacketInfo {
|
||||
// Packed message info structure to minimize memory usage
|
||||
struct MessageInfo {
|
||||
uint16_t offset; // Offset in buffer where message starts
|
||||
uint16_t payload_size; // Size of the message payload
|
||||
uint8_t message_type; // Message type (0-255)
|
||||
|
||||
PacketInfo(uint8_t type, uint16_t off, uint16_t size) : offset(off), payload_size(size), message_type(type) {}
|
||||
MessageInfo(uint8_t type, uint16_t off, uint16_t size) : offset(off), payload_size(size), message_type(type) {}
|
||||
};
|
||||
|
||||
enum class APIError : uint16_t {
|
||||
@@ -108,10 +112,10 @@ class APIFrameHelper {
|
||||
return APIError::OK;
|
||||
}
|
||||
virtual APIError write_protobuf_packet(uint8_t type, ProtoWriteBuffer buffer) = 0;
|
||||
// Write multiple protobuf packets in a single operation
|
||||
// packets contains (message_type, offset, length) for each message in the buffer
|
||||
// Write multiple protobuf messages in a single operation
|
||||
// messages contains (message_type, offset, length) for each message in the buffer
|
||||
// The buffer contains all messages with appropriate padding before each
|
||||
virtual APIError write_protobuf_packets(ProtoWriteBuffer buffer, std::span<const PacketInfo> packets) = 0;
|
||||
virtual APIError write_protobuf_messages(ProtoWriteBuffer buffer, std::span<const MessageInfo> messages) = 0;
|
||||
// Get the frame header padding required by this protocol
|
||||
uint8_t frame_header_padding() const { return frame_header_padding_; }
|
||||
// Get the frame footer size required by this protocol
|
||||
@@ -127,12 +131,6 @@ class APIFrameHelper {
|
||||
// Use swap trick since shrink_to_fit() is non-binding and may be ignored
|
||||
std::vector<uint8_t>().swap(this->rx_buf_);
|
||||
}
|
||||
// reusable_iovs_: Safe to release unconditionally.
|
||||
// Only used within write_protobuf_packets() calls - cleared at start,
|
||||
// populated with pointers, used for writev(), then function returns.
|
||||
// The iovecs contain stale pointers after the call (data was either sent
|
||||
// or copied to tx_buf_), and are cleared on next write_protobuf_packets().
|
||||
std::vector<struct iovec>().swap(this->reusable_iovs_);
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -186,7 +184,6 @@ class APIFrameHelper {
|
||||
|
||||
// Containers (size varies, but typically 12+ bytes on 32-bit)
|
||||
std::array<std::unique_ptr<SendBuffer>, API_MAX_SEND_QUEUE> tx_buf_;
|
||||
std::vector<struct iovec> reusable_iovs_;
|
||||
std::vector<uint8_t> rx_buf_;
|
||||
|
||||
// Pointer to client info (4 bytes on 32-bit)
|
||||
|
||||
@@ -429,12 +429,12 @@ APIError APINoiseFrameHelper::read_packet(ReadPacketBuffer *buffer) {
|
||||
APIError APINoiseFrameHelper::write_protobuf_packet(uint8_t type, ProtoWriteBuffer buffer) {
|
||||
// Resize to include MAC space (required for Noise encryption)
|
||||
buffer.get_buffer()->resize(buffer.get_buffer()->size() + frame_footer_size_);
|
||||
PacketInfo packet{type, 0,
|
||||
static_cast<uint16_t>(buffer.get_buffer()->size() - frame_header_padding_ - frame_footer_size_)};
|
||||
return write_protobuf_packets(buffer, std::span<const PacketInfo>(&packet, 1));
|
||||
MessageInfo msg{type, 0,
|
||||
static_cast<uint16_t>(buffer.get_buffer()->size() - frame_header_padding_ - frame_footer_size_)};
|
||||
return write_protobuf_messages(buffer, std::span<const MessageInfo>(&msg, 1));
|
||||
}
|
||||
|
||||
APIError APINoiseFrameHelper::write_protobuf_packets(ProtoWriteBuffer buffer, std::span<const PacketInfo> packets) {
|
||||
APIError APINoiseFrameHelper::write_protobuf_messages(ProtoWriteBuffer buffer, std::span<const MessageInfo> messages) {
|
||||
APIError aerr = state_action_();
|
||||
if (aerr != APIError::OK) {
|
||||
return aerr;
|
||||
@@ -444,20 +444,20 @@ APIError APINoiseFrameHelper::write_protobuf_packets(ProtoWriteBuffer buffer, st
|
||||
return APIError::WOULD_BLOCK;
|
||||
}
|
||||
|
||||
if (packets.empty()) {
|
||||
if (messages.empty()) {
|
||||
return APIError::OK;
|
||||
}
|
||||
|
||||
uint8_t *buffer_data = buffer.get_buffer()->data();
|
||||
|
||||
this->reusable_iovs_.clear();
|
||||
this->reusable_iovs_.reserve(packets.size());
|
||||
// Stack-allocated iovec array - no heap allocation
|
||||
StaticVector<struct iovec, MAX_MESSAGES_PER_BATCH> iovs;
|
||||
uint16_t total_write_len = 0;
|
||||
|
||||
// We need to encrypt each packet in place
|
||||
for (const auto &packet : packets) {
|
||||
// We need to encrypt each message in place
|
||||
for (const auto &msg : messages) {
|
||||
// The buffer already has padding at offset
|
||||
uint8_t *buf_start = buffer_data + packet.offset;
|
||||
uint8_t *buf_start = buffer_data + msg.offset;
|
||||
|
||||
// Write noise header
|
||||
buf_start[0] = 0x01; // indicator
|
||||
@@ -465,10 +465,10 @@ APIError APINoiseFrameHelper::write_protobuf_packets(ProtoWriteBuffer buffer, st
|
||||
|
||||
// Write message header (to be encrypted)
|
||||
const uint8_t msg_offset = 3;
|
||||
buf_start[msg_offset] = static_cast<uint8_t>(packet.message_type >> 8); // type high byte
|
||||
buf_start[msg_offset + 1] = static_cast<uint8_t>(packet.message_type); // type low byte
|
||||
buf_start[msg_offset + 2] = static_cast<uint8_t>(packet.payload_size >> 8); // data_len high byte
|
||||
buf_start[msg_offset + 3] = static_cast<uint8_t>(packet.payload_size); // data_len low byte
|
||||
buf_start[msg_offset] = static_cast<uint8_t>(msg.message_type >> 8); // type high byte
|
||||
buf_start[msg_offset + 1] = static_cast<uint8_t>(msg.message_type); // type low byte
|
||||
buf_start[msg_offset + 2] = static_cast<uint8_t>(msg.payload_size >> 8); // data_len high byte
|
||||
buf_start[msg_offset + 3] = static_cast<uint8_t>(msg.payload_size); // data_len low byte
|
||||
// payload data is already in the buffer starting at offset + 7
|
||||
|
||||
// Make sure we have space for MAC
|
||||
@@ -477,8 +477,8 @@ APIError APINoiseFrameHelper::write_protobuf_packets(ProtoWriteBuffer buffer, st
|
||||
// Encrypt the message in place
|
||||
NoiseBuffer mbuf;
|
||||
noise_buffer_init(mbuf);
|
||||
noise_buffer_set_inout(mbuf, buf_start + msg_offset, 4 + packet.payload_size,
|
||||
4 + packet.payload_size + frame_footer_size_);
|
||||
noise_buffer_set_inout(mbuf, buf_start + msg_offset, 4 + msg.payload_size,
|
||||
4 + msg.payload_size + frame_footer_size_);
|
||||
|
||||
int err = noise_cipherstate_encrypt(send_cipher_, &mbuf);
|
||||
APIError aerr =
|
||||
@@ -490,14 +490,14 @@ APIError APINoiseFrameHelper::write_protobuf_packets(ProtoWriteBuffer buffer, st
|
||||
buf_start[1] = static_cast<uint8_t>(mbuf.size >> 8);
|
||||
buf_start[2] = static_cast<uint8_t>(mbuf.size);
|
||||
|
||||
// Add iovec for this encrypted packet
|
||||
size_t packet_len = static_cast<size_t>(3 + mbuf.size); // indicator + size + encrypted data
|
||||
this->reusable_iovs_.push_back({buf_start, packet_len});
|
||||
total_write_len += packet_len;
|
||||
// Add iovec for this encrypted message
|
||||
size_t msg_len = static_cast<size_t>(3 + mbuf.size); // indicator + size + encrypted data
|
||||
iovs.push_back({buf_start, msg_len});
|
||||
total_write_len += msg_len;
|
||||
}
|
||||
|
||||
// Send all encrypted packets in one writev call
|
||||
return this->write_raw_(this->reusable_iovs_.data(), this->reusable_iovs_.size(), total_write_len);
|
||||
// Send all encrypted messages in one writev call
|
||||
return this->write_raw_(iovs.data(), iovs.size(), total_write_len);
|
||||
}
|
||||
|
||||
APIError APINoiseFrameHelper::write_frame_(const uint8_t *data, uint16_t len) {
|
||||
|
||||
@@ -23,7 +23,7 @@ class APINoiseFrameHelper final : public APIFrameHelper {
|
||||
APIError loop() override;
|
||||
APIError read_packet(ReadPacketBuffer *buffer) override;
|
||||
APIError write_protobuf_packet(uint8_t type, ProtoWriteBuffer buffer) override;
|
||||
APIError write_protobuf_packets(ProtoWriteBuffer buffer, std::span<const PacketInfo> packets) override;
|
||||
APIError write_protobuf_messages(ProtoWriteBuffer buffer, std::span<const MessageInfo> messages) override;
|
||||
|
||||
protected:
|
||||
APIError state_action_();
|
||||
|
||||
@@ -230,29 +230,30 @@ APIError APIPlaintextFrameHelper::read_packet(ReadPacketBuffer *buffer) {
|
||||
return APIError::OK;
|
||||
}
|
||||
APIError APIPlaintextFrameHelper::write_protobuf_packet(uint8_t type, ProtoWriteBuffer buffer) {
|
||||
PacketInfo packet{type, 0, static_cast<uint16_t>(buffer.get_buffer()->size() - frame_header_padding_)};
|
||||
return write_protobuf_packets(buffer, std::span<const PacketInfo>(&packet, 1));
|
||||
MessageInfo msg{type, 0, static_cast<uint16_t>(buffer.get_buffer()->size() - frame_header_padding_)};
|
||||
return write_protobuf_messages(buffer, std::span<const MessageInfo>(&msg, 1));
|
||||
}
|
||||
|
||||
APIError APIPlaintextFrameHelper::write_protobuf_packets(ProtoWriteBuffer buffer, std::span<const PacketInfo> packets) {
|
||||
APIError APIPlaintextFrameHelper::write_protobuf_messages(ProtoWriteBuffer buffer,
|
||||
std::span<const MessageInfo> messages) {
|
||||
if (state_ != State::DATA) {
|
||||
return APIError::BAD_STATE;
|
||||
}
|
||||
|
||||
if (packets.empty()) {
|
||||
if (messages.empty()) {
|
||||
return APIError::OK;
|
||||
}
|
||||
|
||||
uint8_t *buffer_data = buffer.get_buffer()->data();
|
||||
|
||||
this->reusable_iovs_.clear();
|
||||
this->reusable_iovs_.reserve(packets.size());
|
||||
// Stack-allocated iovec array - no heap allocation
|
||||
StaticVector<struct iovec, MAX_MESSAGES_PER_BATCH> iovs;
|
||||
uint16_t total_write_len = 0;
|
||||
|
||||
for (const auto &packet : packets) {
|
||||
for (const auto &msg : messages) {
|
||||
// Calculate varint sizes for header layout
|
||||
uint8_t size_varint_len = api::ProtoSize::varint(static_cast<uint32_t>(packet.payload_size));
|
||||
uint8_t type_varint_len = api::ProtoSize::varint(static_cast<uint32_t>(packet.message_type));
|
||||
uint8_t size_varint_len = api::ProtoSize::varint(static_cast<uint32_t>(msg.payload_size));
|
||||
uint8_t type_varint_len = api::ProtoSize::varint(static_cast<uint32_t>(msg.message_type));
|
||||
uint8_t total_header_len = 1 + size_varint_len + type_varint_len;
|
||||
|
||||
// Calculate where to start writing the header
|
||||
@@ -280,25 +281,25 @@ APIError APIPlaintextFrameHelper::write_protobuf_packets(ProtoWriteBuffer buffer
|
||||
//
|
||||
// The message starts at offset + frame_header_padding_
|
||||
// So we write the header starting at offset + frame_header_padding_ - total_header_len
|
||||
uint8_t *buf_start = buffer_data + packet.offset;
|
||||
uint8_t *buf_start = buffer_data + msg.offset;
|
||||
uint32_t header_offset = frame_header_padding_ - total_header_len;
|
||||
|
||||
// Write the plaintext header
|
||||
buf_start[header_offset] = 0x00; // indicator
|
||||
|
||||
// Encode varints directly into buffer
|
||||
ProtoVarInt(packet.payload_size).encode_to_buffer_unchecked(buf_start + header_offset + 1, size_varint_len);
|
||||
ProtoVarInt(packet.message_type)
|
||||
ProtoVarInt(msg.payload_size).encode_to_buffer_unchecked(buf_start + header_offset + 1, size_varint_len);
|
||||
ProtoVarInt(msg.message_type)
|
||||
.encode_to_buffer_unchecked(buf_start + header_offset + 1 + size_varint_len, type_varint_len);
|
||||
|
||||
// Add iovec for this packet (header + payload)
|
||||
size_t packet_len = static_cast<size_t>(total_header_len + packet.payload_size);
|
||||
this->reusable_iovs_.push_back({buf_start + header_offset, packet_len});
|
||||
total_write_len += packet_len;
|
||||
// Add iovec for this message (header + payload)
|
||||
size_t msg_len = static_cast<size_t>(total_header_len + msg.payload_size);
|
||||
iovs.push_back({buf_start + header_offset, msg_len});
|
||||
total_write_len += msg_len;
|
||||
}
|
||||
|
||||
// Send all packets in one writev call
|
||||
return write_raw_(this->reusable_iovs_.data(), this->reusable_iovs_.size(), total_write_len);
|
||||
// Send all messages in one writev call
|
||||
return write_raw_(iovs.data(), iovs.size(), total_write_len);
|
||||
}
|
||||
|
||||
} // namespace esphome::api
|
||||
|
||||
@@ -21,7 +21,7 @@ class APIPlaintextFrameHelper final : public APIFrameHelper {
|
||||
APIError loop() override;
|
||||
APIError read_packet(ReadPacketBuffer *buffer) override;
|
||||
APIError write_protobuf_packet(uint8_t type, ProtoWriteBuffer buffer) override;
|
||||
APIError write_protobuf_packets(ProtoWriteBuffer buffer, std::span<const PacketInfo> packets) override;
|
||||
APIError write_protobuf_messages(ProtoWriteBuffer buffer, std::span<const MessageInfo> messages) override;
|
||||
|
||||
protected:
|
||||
APIError try_read_frame_();
|
||||
|
||||
@@ -305,12 +305,14 @@ bool AS3935Component::calibrate_oscillator() {
|
||||
}
|
||||
|
||||
void AS3935Component::tune_antenna() {
|
||||
ESP_LOGI(TAG, "Starting antenna tuning");
|
||||
uint8_t div_ratio = this->read_div_ratio();
|
||||
uint8_t tune_val = this->read_capacitance();
|
||||
ESP_LOGI(TAG, "Division Ratio is set to: %d", div_ratio);
|
||||
ESP_LOGI(TAG, "Internal Capacitor is set to: %d", tune_val);
|
||||
ESP_LOGI(TAG, "Displaying oscillator on INT pin. Measure its frequency - multiply value by Division Ratio");
|
||||
ESP_LOGI(TAG,
|
||||
"Starting antenna tuning\n"
|
||||
"Division Ratio is set to: %d\n"
|
||||
"Internal Capacitor is set to: %d\n"
|
||||
"Displaying oscillator on INT pin. Measure its frequency - multiply value by Division Ratio",
|
||||
div_ratio, tune_val);
|
||||
this->display_oscillator(true, ANTFREQ);
|
||||
}
|
||||
|
||||
|
||||
@@ -227,15 +227,14 @@ void ATM90E32Component::log_calibration_status_() {
|
||||
}
|
||||
|
||||
if (offset_mismatch) {
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] ", cs);
|
||||
ESP_LOGW(TAG,
|
||||
"[CALIBRATION][%s] ===================== Offset mismatch: using flash values =====================", cs);
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] ------------------------------------------------------------------------------",
|
||||
cs);
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] | Phase | offset_voltage | offset_current |", cs);
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] | | config | flash | config | flash |", cs);
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] ------------------------------------------------------------------------------",
|
||||
cs);
|
||||
"[CALIBRATION][%s] \n"
|
||||
"[CALIBRATION][%s] ===================== Offset mismatch: using flash values =====================\n"
|
||||
"[CALIBRATION][%s] ------------------------------------------------------------------------------\n"
|
||||
"[CALIBRATION][%s] | Phase | offset_voltage | offset_current |\n"
|
||||
"[CALIBRATION][%s] | | config | flash | config | flash |\n"
|
||||
"[CALIBRATION][%s] ------------------------------------------------------------------------------",
|
||||
cs, cs, cs, cs, cs, cs);
|
||||
for (uint8_t phase = 0; phase < 3; ++phase) {
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] | %c | %6d | %6d | %6d | %6d |", cs, 'A' + phase,
|
||||
this->config_offset_phase_[phase].voltage_offset_, this->offset_phase_[phase].voltage_offset_,
|
||||
@@ -245,15 +244,14 @@ void ATM90E32Component::log_calibration_status_() {
|
||||
"[CALIBRATION][%s] ===============================================================================", cs);
|
||||
}
|
||||
if (power_mismatch) {
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] ", cs);
|
||||
ESP_LOGW(TAG,
|
||||
"[CALIBRATION][%s] ================= Power offset mismatch: using flash values =================", cs);
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] ------------------------------------------------------------------------------",
|
||||
cs);
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] | Phase | offset_active_power|offset_reactive_power|", cs);
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] | | config | flash | config | flash |", cs);
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] ------------------------------------------------------------------------------",
|
||||
cs);
|
||||
"[CALIBRATION][%s] \n"
|
||||
"[CALIBRATION][%s] ================= Power offset mismatch: using flash values =================\n"
|
||||
"[CALIBRATION][%s] ------------------------------------------------------------------------------\n"
|
||||
"[CALIBRATION][%s] | Phase | offset_active_power|offset_reactive_power|\n"
|
||||
"[CALIBRATION][%s] | | config | flash | config | flash |\n"
|
||||
"[CALIBRATION][%s] ------------------------------------------------------------------------------",
|
||||
cs, cs, cs, cs, cs, cs);
|
||||
for (uint8_t phase = 0; phase < 3; ++phase) {
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] | %c | %6d | %6d | %6d | %6d |", cs, 'A' + phase,
|
||||
this->config_power_offset_phase_[phase].active_power_offset,
|
||||
@@ -265,15 +263,14 @@ void ATM90E32Component::log_calibration_status_() {
|
||||
"[CALIBRATION][%s] ===============================================================================", cs);
|
||||
}
|
||||
if (gain_mismatch) {
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] ", cs);
|
||||
ESP_LOGW(TAG,
|
||||
"[CALIBRATION][%s] ====================== Gain mismatch: using flash values =====================", cs);
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] ------------------------------------------------------------------------------",
|
||||
cs);
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] | Phase | voltage_gain | current_gain |", cs);
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] | | config | flash | config | flash |", cs);
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] ------------------------------------------------------------------------------",
|
||||
cs);
|
||||
"[CALIBRATION][%s] \n"
|
||||
"[CALIBRATION][%s] ====================== Gain mismatch: using flash values =====================\n"
|
||||
"[CALIBRATION][%s] ------------------------------------------------------------------------------\n"
|
||||
"[CALIBRATION][%s] | Phase | voltage_gain | current_gain |\n"
|
||||
"[CALIBRATION][%s] | | config | flash | config | flash |\n"
|
||||
"[CALIBRATION][%s] ------------------------------------------------------------------------------",
|
||||
cs, cs, cs, cs, cs, cs);
|
||||
for (uint8_t phase = 0; phase < 3; ++phase) {
|
||||
ESP_LOGW(TAG, "[CALIBRATION][%s] | %c | %6u | %6u | %6u | %6u |", cs, 'A' + phase,
|
||||
this->config_gain_phase_[phase].voltage_gain, this->gain_phase_[phase].voltage_gain,
|
||||
@@ -286,11 +283,13 @@ void ATM90E32Component::log_calibration_status_() {
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] Power & Voltage/Current offset calibration is disabled. Using config file values.",
|
||||
cs);
|
||||
} else if (this->restored_offset_calibration_ && !offset_mismatch) {
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ============== Restored offset calibration from memory ==============", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] --------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | Phase | offset_voltage | offset_current |", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] --------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG,
|
||||
"[CALIBRATION][%s]\n"
|
||||
"[CALIBRATION][%s] ============== Restored offset calibration from memory ==============\n"
|
||||
"[CALIBRATION][%s] --------------------------------------------------------------\n"
|
||||
"[CALIBRATION][%s] | Phase | offset_voltage | offset_current |\n"
|
||||
"[CALIBRATION][%s] --------------------------------------------------------------",
|
||||
cs, cs, cs, cs, cs);
|
||||
for (uint8_t phase = 0; phase < 3; phase++) {
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | %c | %6d | %6d |", cs, 'A' + phase,
|
||||
this->offset_phase_[phase].voltage_offset_, this->offset_phase_[phase].current_offset_);
|
||||
@@ -299,11 +298,13 @@ void ATM90E32Component::log_calibration_status_() {
|
||||
}
|
||||
|
||||
if (this->restored_power_offset_calibration_ && !power_mismatch) {
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ============ Restored power offset calibration from memory ============", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ---------------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | Phase | offset_active_power | offset_reactive_power |", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ---------------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG,
|
||||
"[CALIBRATION][%s]\n"
|
||||
"[CALIBRATION][%s] ============ Restored power offset calibration from memory ============\n"
|
||||
"[CALIBRATION][%s] ---------------------------------------------------------------------\n"
|
||||
"[CALIBRATION][%s] | Phase | offset_active_power | offset_reactive_power |\n"
|
||||
"[CALIBRATION][%s] ---------------------------------------------------------------------",
|
||||
cs, cs, cs, cs, cs);
|
||||
for (uint8_t phase = 0; phase < 3; phase++) {
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | %c | %6d | %6d |", cs, 'A' + phase,
|
||||
this->power_offset_phase_[phase].active_power_offset,
|
||||
@@ -314,17 +315,21 @@ void ATM90E32Component::log_calibration_status_() {
|
||||
if (!this->enable_gain_calibration_) {
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] Gain calibration is disabled. Using config file values.", cs);
|
||||
} else if (this->restored_gain_calibration_ && !gain_mismatch) {
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ============ Restoring saved gain calibrations to registers ============", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ---------------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | Phase | voltage_gain | current_gain |", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ---------------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG,
|
||||
"[CALIBRATION][%s]\n"
|
||||
"[CALIBRATION][%s] ============ Restoring saved gain calibrations to registers ============\n"
|
||||
"[CALIBRATION][%s] ---------------------------------------------------------------------\n"
|
||||
"[CALIBRATION][%s] | Phase | voltage_gain | current_gain |\n"
|
||||
"[CALIBRATION][%s] ---------------------------------------------------------------------",
|
||||
cs, cs, cs, cs, cs);
|
||||
for (uint8_t phase = 0; phase < 3; phase++) {
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | %c | %6u | %6u |", cs, 'A' + phase,
|
||||
this->gain_phase_[phase].voltage_gain, this->gain_phase_[phase].current_gain);
|
||||
}
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] =====================================================================\\n", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] Gain calibration loaded and verified successfully.\n", cs);
|
||||
ESP_LOGI(TAG,
|
||||
"[CALIBRATION][%s] =====================================================================\n"
|
||||
"[CALIBRATION][%s] Gain calibration loaded and verified successfully.\n",
|
||||
cs, cs);
|
||||
}
|
||||
this->calibration_message_printed_ = true;
|
||||
}
|
||||
@@ -580,14 +585,14 @@ void ATM90E32Component::run_gain_calibrations() {
|
||||
float ref_currents[3] = {this->get_reference_current(0), this->get_reference_current(1),
|
||||
this->get_reference_current(2)};
|
||||
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ========================= Gain Calibration =========================", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ---------------------------------------------------------------------", cs);
|
||||
ESP_LOGI(
|
||||
TAG,
|
||||
"[CALIBRATION][%s] | Phase | V_meas (V) | I_meas (A) | V_ref | I_ref | V_gain (old→new) | I_gain (old→new) |",
|
||||
cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ---------------------------------------------------------------------", cs);
|
||||
"[CALIBRATION][%s]\n"
|
||||
"[CALIBRATION][%s] ========================= Gain Calibration =========================\n"
|
||||
"[CALIBRATION][%s] ---------------------------------------------------------------------\n"
|
||||
"[CALIBRATION][%s] | Phase | V_meas (V) | I_meas (A) | V_ref | I_ref | V_gain (old→new) | I_gain (old→new) |\n"
|
||||
"[CALIBRATION][%s] ---------------------------------------------------------------------",
|
||||
cs, cs, cs, cs, cs);
|
||||
|
||||
for (uint8_t phase = 0; phase < 3; phase++) {
|
||||
float measured_voltage = this->get_phase_voltage_avg_(phase);
|
||||
@@ -718,11 +723,13 @@ void ATM90E32Component::run_offset_calibrations() {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ======================== Offset Calibration ========================", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ------------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | Phase | offset_voltage | offset_current |", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ------------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG,
|
||||
"[CALIBRATION][%s]\n"
|
||||
"[CALIBRATION][%s] ======================== Offset Calibration ========================\n"
|
||||
"[CALIBRATION][%s] ------------------------------------------------------------------\n"
|
||||
"[CALIBRATION][%s] | Phase | offset_voltage | offset_current |\n"
|
||||
"[CALIBRATION][%s] ------------------------------------------------------------------",
|
||||
cs, cs, cs, cs, cs);
|
||||
|
||||
for (uint8_t phase = 0; phase < 3; phase++) {
|
||||
int16_t voltage_offset = calibrate_offset(phase, true);
|
||||
@@ -749,11 +756,13 @@ void ATM90E32Component::run_power_offset_calibrations() {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ===================== Power Offset Calibration =====================", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ---------------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | Phase | offset_active_power | offset_reactive_power |", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ---------------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG,
|
||||
"[CALIBRATION][%s]\n"
|
||||
"[CALIBRATION][%s] ===================== Power Offset Calibration =====================\n"
|
||||
"[CALIBRATION][%s] ---------------------------------------------------------------------\n"
|
||||
"[CALIBRATION][%s] | Phase | offset_active_power | offset_reactive_power |\n"
|
||||
"[CALIBRATION][%s] ---------------------------------------------------------------------",
|
||||
cs, cs, cs, cs, cs);
|
||||
|
||||
for (uint8_t phase = 0; phase < 3; ++phase) {
|
||||
int16_t active_offset = calibrate_power_offset(phase, false);
|
||||
@@ -953,10 +962,12 @@ void ATM90E32Component::restore_power_offset_calibrations_() {
|
||||
void ATM90E32Component::clear_gain_calibrations() {
|
||||
const char *cs = this->cs_summary_.c_str();
|
||||
if (!this->using_saved_calibrations_) {
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] No stored gain calibrations to clear. Current values:", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ----------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | Phase | voltage_gain | current_gain |", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ----------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG,
|
||||
"[CALIBRATION][%s] No stored gain calibrations to clear. Current values:\n"
|
||||
"[CALIBRATION][%s] ----------------------------------------------------------\n"
|
||||
"[CALIBRATION][%s] | Phase | voltage_gain | current_gain |\n"
|
||||
"[CALIBRATION][%s] ----------------------------------------------------------",
|
||||
cs, cs, cs, cs);
|
||||
for (int phase = 0; phase < 3; phase++) {
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | %c | %6u | %6u |", cs, 'A' + phase,
|
||||
this->gain_phase_[phase].voltage_gain, this->gain_phase_[phase].current_gain);
|
||||
@@ -965,10 +976,12 @@ void ATM90E32Component::clear_gain_calibrations() {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] Clearing stored gain calibrations and restoring config-defined values", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ----------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | Phase | voltage_gain | current_gain |", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ----------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG,
|
||||
"[CALIBRATION][%s] Clearing stored gain calibrations and restoring config-defined values\n"
|
||||
"[CALIBRATION][%s] ----------------------------------------------------------\n"
|
||||
"[CALIBRATION][%s] | Phase | voltage_gain | current_gain |\n"
|
||||
"[CALIBRATION][%s] ----------------------------------------------------------",
|
||||
cs, cs, cs, cs);
|
||||
|
||||
for (int phase = 0; phase < 3; phase++) {
|
||||
uint16_t voltage_gain = this->phase_[phase].voltage_gain_;
|
||||
@@ -1002,10 +1015,12 @@ void ATM90E32Component::clear_gain_calibrations() {
|
||||
void ATM90E32Component::clear_offset_calibrations() {
|
||||
const char *cs = this->cs_summary_.c_str();
|
||||
if (!this->restored_offset_calibration_) {
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] No stored offset calibrations to clear. Current values:", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] --------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | Phase | offset_voltage | offset_current |", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] --------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG,
|
||||
"[CALIBRATION][%s] No stored offset calibrations to clear. Current values:\n"
|
||||
"[CALIBRATION][%s] --------------------------------------------------------------\n"
|
||||
"[CALIBRATION][%s] | Phase | offset_voltage | offset_current |\n"
|
||||
"[CALIBRATION][%s] --------------------------------------------------------------",
|
||||
cs, cs, cs, cs);
|
||||
for (uint8_t phase = 0; phase < 3; phase++) {
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | %c | %6d | %6d |", cs, 'A' + phase,
|
||||
this->offset_phase_[phase].voltage_offset_, this->offset_phase_[phase].current_offset_);
|
||||
@@ -1014,10 +1029,12 @@ void ATM90E32Component::clear_offset_calibrations() {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] Clearing stored offset calibrations and restoring config-defined values", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] --------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | Phase | offset_voltage | offset_current |", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] --------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG,
|
||||
"[CALIBRATION][%s] Clearing stored offset calibrations and restoring config-defined values\n"
|
||||
"[CALIBRATION][%s] --------------------------------------------------------------\n"
|
||||
"[CALIBRATION][%s] | Phase | offset_voltage | offset_current |\n"
|
||||
"[CALIBRATION][%s] --------------------------------------------------------------",
|
||||
cs, cs, cs, cs);
|
||||
|
||||
for (uint8_t phase = 0; phase < 3; phase++) {
|
||||
int16_t voltage_offset =
|
||||
@@ -1044,10 +1061,12 @@ void ATM90E32Component::clear_offset_calibrations() {
|
||||
void ATM90E32Component::clear_power_offset_calibrations() {
|
||||
const char *cs = this->cs_summary_.c_str();
|
||||
if (!this->restored_power_offset_calibration_) {
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] No stored power offsets to clear. Current values:", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ---------------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | Phase | offset_active_power | offset_reactive_power |", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ---------------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG,
|
||||
"[CALIBRATION][%s] No stored power offsets to clear. Current values:\n"
|
||||
"[CALIBRATION][%s] ---------------------------------------------------------------------\n"
|
||||
"[CALIBRATION][%s] | Phase | offset_active_power | offset_reactive_power |\n"
|
||||
"[CALIBRATION][%s] ---------------------------------------------------------------------",
|
||||
cs, cs, cs, cs);
|
||||
for (uint8_t phase = 0; phase < 3; phase++) {
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | %c | %6d | %6d |", cs, 'A' + phase,
|
||||
this->power_offset_phase_[phase].active_power_offset,
|
||||
@@ -1057,10 +1076,12 @@ void ATM90E32Component::clear_power_offset_calibrations() {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] Clearing stored power offsets and restoring config-defined values", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ---------------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] | Phase | offset_active_power | offset_reactive_power |", cs);
|
||||
ESP_LOGI(TAG, "[CALIBRATION][%s] ---------------------------------------------------------------------", cs);
|
||||
ESP_LOGI(TAG,
|
||||
"[CALIBRATION][%s] Clearing stored power offsets and restoring config-defined values\n"
|
||||
"[CALIBRATION][%s] ---------------------------------------------------------------------\n"
|
||||
"[CALIBRATION][%s] | Phase | offset_active_power | offset_reactive_power |\n"
|
||||
"[CALIBRATION][%s] ---------------------------------------------------------------------",
|
||||
cs, cs, cs, cs);
|
||||
|
||||
for (uint8_t phase = 0; phase < 3; phase++) {
|
||||
int16_t active_offset =
|
||||
|
||||
@@ -13,9 +13,10 @@ void ATM90E32GainCalibrationButton::press_action() {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "%s", this->get_name().c_str());
|
||||
ESP_LOGI(TAG,
|
||||
"[CALIBRATION] Use gain_ct: & gain_voltage: under each phase_x: in your config file to save these values");
|
||||
"%s\n"
|
||||
"[CALIBRATION] Use gain_ct: & gain_voltage: under each phase_x: in your config file to save these values",
|
||||
this->get_name().c_str());
|
||||
this->parent_->run_gain_calibrations();
|
||||
}
|
||||
|
||||
@@ -35,10 +36,12 @@ void ATM90E32OffsetCalibrationButton::press_action() {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "%s", this->get_name().c_str());
|
||||
ESP_LOGI(TAG, "[CALIBRATION] **NOTE: CTs and ACVs must be 0 during this process. USB power only**");
|
||||
ESP_LOGI(TAG, "[CALIBRATION] Use offset_voltage: & offset_current: under each phase_x: in your config file to save "
|
||||
"these values");
|
||||
ESP_LOGI(TAG,
|
||||
"%s\n"
|
||||
"[CALIBRATION] **NOTE: CTs and ACVs must be 0 during this process. USB power only**\n"
|
||||
"[CALIBRATION] Use offset_voltage: & offset_current: under each phase_x: in your config file to save "
|
||||
"these values",
|
||||
this->get_name().c_str());
|
||||
this->parent_->run_offset_calibrations();
|
||||
}
|
||||
|
||||
@@ -58,10 +61,12 @@ void ATM90E32PowerOffsetCalibrationButton::press_action() {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "%s", this->get_name().c_str());
|
||||
ESP_LOGI(TAG, "[CALIBRATION] **NOTE: CTs must be 0 during this process. Voltage reference should be present**");
|
||||
ESP_LOGI(TAG, "[CALIBRATION] Use offset_active_power: & offset_reactive_power: under each phase_x: in your config "
|
||||
"file to save these values");
|
||||
ESP_LOGI(TAG,
|
||||
"%s\n"
|
||||
"[CALIBRATION] **NOTE: CTs must be 0 during this process. Voltage reference should be present**\n"
|
||||
"[CALIBRATION] Use offset_active_power: & offset_reactive_power: under each phase_x: in your config "
|
||||
"file to save these values",
|
||||
this->get_name().c_str());
|
||||
this->parent_->run_power_offset_calibrations();
|
||||
}
|
||||
|
||||
|
||||
@@ -216,11 +216,14 @@ bool BedJetHub::discover_characteristics_() {
|
||||
}
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "[%s] Discovered service characteristics: ", this->get_name().c_str());
|
||||
ESP_LOGI(TAG, " - Command char: 0x%x", this->char_handle_cmd_);
|
||||
ESP_LOGI(TAG, " - Status char: 0x%x", this->char_handle_status_);
|
||||
ESP_LOGI(TAG, " - config descriptor: 0x%x", this->config_descr_status_);
|
||||
ESP_LOGI(TAG, " - Name char: 0x%x", this->char_handle_name_);
|
||||
ESP_LOGI(TAG,
|
||||
"[%s] Discovered service characteristics:\n"
|
||||
" - Command char: 0x%x\n"
|
||||
" - Status char: 0x%x\n"
|
||||
" - config descriptor: 0x%x\n"
|
||||
" - Name char: 0x%x",
|
||||
this->get_name().c_str(), this->char_handle_cmd_, this->char_handle_status_, this->config_descr_status_,
|
||||
this->char_handle_name_);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ from logging import getLogger
|
||||
from esphome import automation, core
|
||||
from esphome.automation import Condition, maybe_simple_id
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, web_server
|
||||
from esphome.components import mqtt, web_server, zigbee
|
||||
from esphome.components.const import CONF_ON_STATE_CHANGE
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
@@ -439,6 +439,7 @@ def validate_publish_initial_state(value):
|
||||
_BINARY_SENSOR_SCHEMA = (
|
||||
cv.ENTITY_BASE_SCHEMA.extend(web_server.WEBSERVER_SORTING_SCHEMA)
|
||||
.extend(cv.MQTT_COMPONENT_SCHEMA)
|
||||
.extend(zigbee.BINARY_SENSOR_SCHEMA)
|
||||
.extend(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(BinarySensor),
|
||||
@@ -520,6 +521,7 @@ _BINARY_SENSOR_SCHEMA = (
|
||||
|
||||
|
||||
_BINARY_SENSOR_SCHEMA.add_extra(entity_duplicate_validator("binary_sensor"))
|
||||
_BINARY_SENSOR_SCHEMA.add_extra(zigbee.validate_binary_sensor)
|
||||
|
||||
|
||||
def binary_sensor_schema(
|
||||
@@ -621,6 +623,8 @@ async def setup_binary_sensor_core_(var, config):
|
||||
if web_server_config := config.get(CONF_WEB_SERVER):
|
||||
await web_server.add_entity_config(var, web_server_config)
|
||||
|
||||
await zigbee.setup_binary_sensor(var, config)
|
||||
|
||||
|
||||
async def register_binary_sensor(var, config):
|
||||
if not CORE.has_id(config[CONF_ID]):
|
||||
|
||||
@@ -21,8 +21,10 @@ void MultiClickTrigger::on_state_(bool state) {
|
||||
// Start matching
|
||||
MultiClickTriggerEvent evt = this->timing_[0];
|
||||
if (evt.state == state) {
|
||||
ESP_LOGV(TAG, "START min=%" PRIu32 " max=%" PRIu32, evt.min_length, evt.max_length);
|
||||
ESP_LOGV(TAG, "Multi Click: Starting multi click action!");
|
||||
ESP_LOGV(TAG,
|
||||
"START min=%" PRIu32 " max=%" PRIu32 "\n"
|
||||
"Multi Click: Starting multi click action!",
|
||||
evt.min_length, evt.max_length);
|
||||
this->at_index_ = 1;
|
||||
if (this->timing_.size() == 1 && evt.max_length == 4294967294UL) {
|
||||
this->set_timeout("trigger", evt.min_length, [this]() { this->trigger_(); });
|
||||
|
||||
@@ -103,8 +103,10 @@ void BLENUS::on_log(uint8_t level, const char *tag, const char *message, size_t
|
||||
#endif
|
||||
|
||||
void BLENUS::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "ble nus:");
|
||||
ESP_LOGCONFIG(TAG, " log: %s", YESNO(this->expose_log_));
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"ble nus:\n"
|
||||
" log: %s",
|
||||
YESNO(this->expose_log_));
|
||||
uint32_t mtu = 0;
|
||||
bt_conn *conn = this->conn_.load();
|
||||
if (conn) {
|
||||
|
||||
@@ -22,13 +22,13 @@ void BP1658CJ::setup() {
|
||||
this->pwm_amounts_.resize(5, 0);
|
||||
}
|
||||
void BP1658CJ::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "BP1658CJ:");
|
||||
LOG_PIN(" Data Pin: ", this->data_pin_);
|
||||
LOG_PIN(" Clock Pin: ", this->clock_pin_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"BP1658CJ:\n"
|
||||
" Color Channels Max Power: %u\n"
|
||||
" White Channels Max Power: %u",
|
||||
this->max_power_color_channels_, this->max_power_white_channels_);
|
||||
LOG_PIN(" Data Pin: ", this->data_pin_);
|
||||
LOG_PIN(" Clock Pin: ", this->clock_pin_);
|
||||
}
|
||||
|
||||
void BP1658CJ::loop() {
|
||||
|
||||
@@ -63,14 +63,14 @@ void CAP1188Component::finish_setup_() {
|
||||
}
|
||||
|
||||
void CAP1188Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "CAP1188:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"CAP1188:\n"
|
||||
" Product ID: 0x%x\n"
|
||||
" Manufacture ID: 0x%x\n"
|
||||
" Revision ID: 0x%x",
|
||||
this->cap1188_product_id_, this->cap1188_manufacture_id_, this->cap1188_revision_);
|
||||
LOG_I2C_DEVICE(this);
|
||||
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
||||
|
||||
switch (this->error_code_) {
|
||||
case COMMUNICATION_FAILED:
|
||||
|
||||
@@ -49,9 +49,11 @@ void CaptivePortal::handle_config(AsyncWebServerRequest *request) {
|
||||
void CaptivePortal::handle_wifisave(AsyncWebServerRequest *request) {
|
||||
std::string ssid = request->arg("ssid").c_str(); // NOLINT(readability-redundant-string-cstr)
|
||||
std::string psk = request->arg("psk").c_str(); // NOLINT(readability-redundant-string-cstr)
|
||||
ESP_LOGI(TAG, "Requested WiFi Settings Change:");
|
||||
ESP_LOGI(TAG, " SSID='%s'", ssid.c_str());
|
||||
ESP_LOGI(TAG, " Password=" LOG_SECRET("'%s'"), psk.c_str());
|
||||
ESP_LOGI(TAG,
|
||||
"Requested WiFi Settings Change:\n"
|
||||
" SSID='%s'\n"
|
||||
" Password=" LOG_SECRET("'%s'"),
|
||||
ssid.c_str(), psk.c_str());
|
||||
// Defer save to main loop thread to avoid NVS operations from HTTP thread
|
||||
this->defer([ssid, psk]() { wifi::global_wifi_component->save_wifi_sta(ssid, psk); });
|
||||
request->redirect(ESPHOME_F("/?save"));
|
||||
|
||||
@@ -212,9 +212,8 @@ void CC1101Component::dump_config() {
|
||||
XTAL_FREQUENCY / (1 << 16);
|
||||
float symbol_rate = (((256.0f + this->state_.DRATE_M) * (1 << this->state_.DRATE_E)) / (1 << 28)) * XTAL_FREQUENCY;
|
||||
float bw = XTAL_FREQUENCY / (8.0f * (4 + this->state_.CHANBW_M) * (1 << this->state_.CHANBW_E));
|
||||
ESP_LOGCONFIG(TAG, "CC1101:");
|
||||
LOG_PIN(" CS Pin: ", this->cs_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"CC1101:\n"
|
||||
" Chip ID: 0x%04X\n"
|
||||
" Frequency: %" PRId32 " Hz\n"
|
||||
" Channel: %u\n"
|
||||
@@ -224,6 +223,7 @@ void CC1101Component::dump_config() {
|
||||
" Output Power: %.1f dBm",
|
||||
this->chip_id_, freq, this->state_.CHANNR, MODULATION_NAMES[this->state_.MOD_FORMAT & 0x07],
|
||||
symbol_rate, bw, this->output_power_effective_);
|
||||
LOG_PIN(" CS Pin: ", this->cs_);
|
||||
}
|
||||
|
||||
void CC1101Component::begin_tx() {
|
||||
|
||||
@@ -21,12 +21,14 @@ void CD74HC4067Component::setup() {
|
||||
}
|
||||
|
||||
void CD74HC4067Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "CD74HC4067 Multiplexer:");
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"CD74HC4067 Multiplexer:\n"
|
||||
" switch delay: %" PRIu32,
|
||||
this->switch_delay_);
|
||||
LOG_PIN(" S0 Pin: ", this->pin_s0_);
|
||||
LOG_PIN(" S1 Pin: ", this->pin_s1_);
|
||||
LOG_PIN(" S2 Pin: ", this->pin_s2_);
|
||||
LOG_PIN(" S3 Pin: ", this->pin_s3_);
|
||||
ESP_LOGCONFIG(TAG, "switch delay: %" PRIu32, this->switch_delay_);
|
||||
}
|
||||
|
||||
void CD74HC4067Component::activate_pin(uint8_t pin) {
|
||||
|
||||
@@ -32,14 +32,14 @@ void CHSC6XTouchscreen::update_touches() {
|
||||
}
|
||||
|
||||
void CHSC6XTouchscreen::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "CHSC6X Touchscreen:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
LOG_PIN(" Interrupt Pin: ", this->interrupt_pin_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"CHSC6X Touchscreen:\n"
|
||||
" Touch timeout: %d\n"
|
||||
" x_raw_max_: %d\n"
|
||||
" y_raw_max_: %d",
|
||||
this->touch_timeout_, this->x_raw_max_, this->y_raw_max_);
|
||||
LOG_I2C_DEVICE(this);
|
||||
LOG_PIN(" Interrupt Pin: ", this->interrupt_pin_);
|
||||
}
|
||||
|
||||
} // namespace chsc6x
|
||||
|
||||
@@ -83,14 +83,14 @@ void CST816Touchscreen::update_touches() {
|
||||
}
|
||||
|
||||
void CST816Touchscreen::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "CST816 Touchscreen:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
LOG_PIN(" Interrupt Pin: ", this->interrupt_pin_);
|
||||
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"CST816 Touchscreen:\n"
|
||||
" X Raw Min: %d, X Raw Max: %d\n"
|
||||
" Y Raw Min: %d, Y Raw Max: %d",
|
||||
this->x_raw_min_, this->x_raw_max_, this->y_raw_min_, this->y_raw_max_);
|
||||
LOG_I2C_DEVICE(this);
|
||||
LOG_PIN(" Interrupt Pin: ", this->interrupt_pin_);
|
||||
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
||||
const char *name;
|
||||
switch (this->chip_id_) {
|
||||
case CST716_CHIP_ID:
|
||||
|
||||
@@ -146,8 +146,10 @@ void CurrentBasedCover::dump_config() {
|
||||
if (this->close_obstacle_current_threshold_ != FLT_MAX) {
|
||||
ESP_LOGCONFIG(TAG, " Close obstacle current threshold: %.11fA", this->close_obstacle_current_threshold_);
|
||||
}
|
||||
ESP_LOGCONFIG(TAG, " Close Duration: %.1fs", this->close_duration_ / 1e3f);
|
||||
ESP_LOGCONFIG(TAG, "Obstacle Rollback: %.1f%%", this->obstacle_rollback_ * 100);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
" Close Duration: %.1fs\n"
|
||||
"Obstacle Rollback: %.1f%%",
|
||||
this->close_duration_ / 1e3f, this->obstacle_rollback_ * 100);
|
||||
if (this->max_duration_ != UINT32_MAX) {
|
||||
ESP_LOGCONFIG(TAG, "Maximum duration: %.1fs", this->max_duration_ / 1e3f);
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ void DallasTemperatureSensor::dump_config() {
|
||||
ESP_LOGW(TAG, " Unable to select an address");
|
||||
return;
|
||||
}
|
||||
LOG_ONE_WIRE_DEVICE(this);
|
||||
ESP_LOGCONFIG(TAG, " Resolution: %u bits", this->resolution_);
|
||||
LOG_ONE_WIRE_DEVICE(this);
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,14 +47,17 @@ void DebugComponent::get_device_info_(std::string &device_info) {
|
||||
|
||||
#if !defined(CLANG_TIDY)
|
||||
auto reset_reason = get_reset_reason_();
|
||||
ESP_LOGD(TAG, "Chip ID: 0x%08X", ESP.getChipId());
|
||||
ESP_LOGD(TAG, "SDK Version: %s", ESP.getSdkVersion());
|
||||
ESP_LOGD(TAG, "Core Version: %s", ESP.getCoreVersion().c_str());
|
||||
ESP_LOGD(TAG, "Boot Version=%u Mode=%u", ESP.getBootVersion(), ESP.getBootMode());
|
||||
ESP_LOGD(TAG, "CPU Frequency: %u", ESP.getCpuFreqMHz());
|
||||
ESP_LOGD(TAG, "Flash Chip ID=0x%08X", ESP.getFlashChipId());
|
||||
ESP_LOGD(TAG, "Reset Reason: %s", reset_reason.c_str());
|
||||
ESP_LOGD(TAG, "Reset Info: %s", ESP.getResetInfo().c_str());
|
||||
ESP_LOGD(TAG,
|
||||
"Chip ID: 0x%08X\n"
|
||||
"SDK Version: %s\n"
|
||||
"Core Version: %s\n"
|
||||
"Boot Version=%u Mode=%u\n"
|
||||
"CPU Frequency: %u\n"
|
||||
"Flash Chip ID=0x%08X\n"
|
||||
"Reset Reason: %s\n"
|
||||
"Reset Info: %s",
|
||||
ESP.getChipId(), ESP.getSdkVersion(), ESP.getCoreVersion().c_str(), ESP.getBootVersion(), ESP.getBootMode(),
|
||||
ESP.getCpuFreqMHz(), ESP.getFlashChipId(), reset_reason.c_str(), ESP.getResetInfo().c_str());
|
||||
|
||||
device_info += "|Chip: 0x" + format_hex(ESP.getChipId());
|
||||
device_info += "|SDK: ";
|
||||
|
||||
@@ -13,12 +13,15 @@ uint32_t DebugComponent::get_free_heap_() { return lt_heap_get_free(); }
|
||||
|
||||
void DebugComponent::get_device_info_(std::string &device_info) {
|
||||
std::string reset_reason = get_reset_reason_();
|
||||
ESP_LOGD(TAG, "LibreTiny Version: %s", lt_get_version());
|
||||
ESP_LOGD(TAG, "Chip: %s (%04x) @ %u MHz", lt_cpu_get_model_name(), lt_cpu_get_model(), lt_cpu_get_freq_mhz());
|
||||
ESP_LOGD(TAG, "Chip ID: 0x%06X", lt_cpu_get_mac_id());
|
||||
ESP_LOGD(TAG, "Board: %s", lt_get_board_code());
|
||||
ESP_LOGD(TAG, "Flash: %u KiB / RAM: %u KiB", lt_flash_get_size() / 1024, lt_ram_get_size() / 1024);
|
||||
ESP_LOGD(TAG, "Reset Reason: %s", reset_reason.c_str());
|
||||
ESP_LOGD(TAG,
|
||||
"LibreTiny Version: %s\n"
|
||||
"Chip: %s (%04x) @ %u MHz\n"
|
||||
"Chip ID: 0x%06X\n"
|
||||
"Board: %s\n"
|
||||
"Flash: %u KiB / RAM: %u KiB\n"
|
||||
"Reset Reason: %s",
|
||||
lt_get_version(), lt_cpu_get_model_name(), lt_cpu_get_model(), lt_cpu_get_freq_mhz(), lt_cpu_get_mac_id(),
|
||||
lt_get_board_code(), lt_flash_get_size() / 1024, lt_ram_get_size() / 1024, reset_reason.c_str());
|
||||
|
||||
device_info += "|Version: ";
|
||||
device_info += LT_BANNER_STR + 10;
|
||||
|
||||
@@ -106,13 +106,13 @@ static void fa_cb(const struct flash_area *fa, void *user_data) {
|
||||
void DebugComponent::log_partition_info_() {
|
||||
#if CONFIG_FLASH_MAP_LABELS
|
||||
ESP_LOGCONFIG(TAG, "ID | Device | Device Name "
|
||||
"| Label | Offset | Size");
|
||||
ESP_LOGCONFIG(TAG, "--------------------------------------------"
|
||||
"| Label | Offset | Size\n"
|
||||
"--------------------------------------------"
|
||||
"-----------------------------------------------");
|
||||
#else
|
||||
ESP_LOGCONFIG(TAG, "ID | Device | Device Name "
|
||||
"| Offset | Size");
|
||||
ESP_LOGCONFIG(TAG, "-----------------------------------------"
|
||||
"| Offset | Size\n"
|
||||
"-----------------------------------------"
|
||||
"------------------------------");
|
||||
#endif
|
||||
flash_area_foreach(fa_cb, nullptr);
|
||||
@@ -300,18 +300,18 @@ void DebugComponent::get_device_info_(std::string &device_info) {
|
||||
return "Unspecified";
|
||||
};
|
||||
|
||||
ESP_LOGD(TAG, "Code page size: %u, code size: %u, device id: 0x%08x%08x", NRF_FICR->CODEPAGESIZE, NRF_FICR->CODESIZE,
|
||||
NRF_FICR->DEVICEID[1], NRF_FICR->DEVICEID[0]);
|
||||
ESP_LOGD(TAG, "Encryption root: 0x%08x%08x%08x%08x, Identity Root: 0x%08x%08x%08x%08x", NRF_FICR->ER[0],
|
||||
ESP_LOGD(TAG,
|
||||
"Code page size: %u, code size: %u, device id: 0x%08x%08x\n"
|
||||
"Encryption root: 0x%08x%08x%08x%08x, Identity Root: 0x%08x%08x%08x%08x\n"
|
||||
"Device address type: %s, address: %s\n"
|
||||
"Part code: nRF%x, version: %c%c%c%c, package: %s\n"
|
||||
"RAM: %ukB, Flash: %ukB, production test: %sdone",
|
||||
NRF_FICR->CODEPAGESIZE, NRF_FICR->CODESIZE, NRF_FICR->DEVICEID[1], NRF_FICR->DEVICEID[0], NRF_FICR->ER[0],
|
||||
NRF_FICR->ER[1], NRF_FICR->ER[2], NRF_FICR->ER[3], NRF_FICR->IR[0], NRF_FICR->IR[1], NRF_FICR->IR[2],
|
||||
NRF_FICR->IR[3]);
|
||||
ESP_LOGD(TAG, "Device address type: %s, address: %s", (NRF_FICR->DEVICEADDRTYPE & 0x1 ? "Random" : "Public"),
|
||||
get_mac_address_pretty().c_str());
|
||||
ESP_LOGD(TAG, "Part code: nRF%x, version: %c%c%c%c, package: %s", NRF_FICR->INFO.PART,
|
||||
NRF_FICR->INFO.VARIANT >> 24 & 0xFF, NRF_FICR->INFO.VARIANT >> 16 & 0xFF, NRF_FICR->INFO.VARIANT >> 8 & 0xFF,
|
||||
NRF_FICR->INFO.VARIANT & 0xFF, package(NRF_FICR->INFO.PACKAGE));
|
||||
ESP_LOGD(TAG, "RAM: %ukB, Flash: %ukB, production test: %sdone", NRF_FICR->INFO.RAM, NRF_FICR->INFO.FLASH,
|
||||
(NRF_FICR->PRODTEST[0] == 0xBB42319F ? "" : "not "));
|
||||
NRF_FICR->IR[3], (NRF_FICR->DEVICEADDRTYPE & 0x1 ? "Random" : "Public"), get_mac_address_pretty().c_str(),
|
||||
NRF_FICR->INFO.PART, NRF_FICR->INFO.VARIANT >> 24 & 0xFF, NRF_FICR->INFO.VARIANT >> 16 & 0xFF,
|
||||
NRF_FICR->INFO.VARIANT >> 8 & 0xFF, NRF_FICR->INFO.VARIANT & 0xFF, package(NRF_FICR->INFO.PACKAGE),
|
||||
NRF_FICR->INFO.RAM, NRF_FICR->INFO.FLASH, (NRF_FICR->PRODTEST[0] == 0xBB42319F ? "" : "not "));
|
||||
bool n_reset_enabled = NRF_UICR->PSELRESET[0] == NRF_UICR->PSELRESET[1] &&
|
||||
(NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) == UICR_PSELRESET_CONNECT_Connected
|
||||
<< UICR_PSELRESET_CONNECT_Pos;
|
||||
@@ -329,9 +329,10 @@ void DebugComponent::get_device_info_(std::string &device_info) {
|
||||
#else
|
||||
ESP_LOGD(TAG, "bootloader: Adafruit, version %u.%u.%u", (BOOTLOADER_VERSION_REGISTER >> 16) & 0xFF,
|
||||
(BOOTLOADER_VERSION_REGISTER >> 8) & 0xFF, BOOTLOADER_VERSION_REGISTER & 0xFF);
|
||||
ESP_LOGD(TAG, "MBR bootloader addr 0x%08x, UICR bootloader addr 0x%08x", read_mem_u32(MBR_BOOTLOADER_ADDR),
|
||||
NRF_UICR->NRFFW[0]);
|
||||
ESP_LOGD(TAG, "MBR param page addr 0x%08x, UICR param page addr 0x%08x", read_mem_u32(MBR_PARAM_PAGE_ADDR),
|
||||
ESP_LOGD(TAG,
|
||||
"MBR bootloader addr 0x%08x, UICR bootloader addr 0x%08x\n"
|
||||
"MBR param page addr 0x%08x, UICR param page addr 0x%08x",
|
||||
read_mem_u32(MBR_BOOTLOADER_ADDR), NRF_UICR->NRFFW[0], read_mem_u32(MBR_PARAM_PAGE_ADDR),
|
||||
NRF_UICR->NRFFW[1]);
|
||||
if (is_sd_present()) {
|
||||
uint32_t const sd_id = sd_id_get();
|
||||
@@ -368,8 +369,10 @@ void DebugComponent::get_device_info_(std::string &device_info) {
|
||||
}
|
||||
return res;
|
||||
};
|
||||
ESP_LOGD(TAG, "NRFFW %s", uicr(NRF_UICR->NRFFW, 13).c_str());
|
||||
ESP_LOGD(TAG, "NRFHW %s", uicr(NRF_UICR->NRFHW, 12).c_str());
|
||||
ESP_LOGD(TAG,
|
||||
"NRFFW %s\n"
|
||||
"NRFHW %s",
|
||||
uicr(NRF_UICR->NRFFW, 13).c_str(), uicr(NRF_UICR->NRFHW, 12).c_str());
|
||||
}
|
||||
|
||||
void DebugComponent::update_platform_() {}
|
||||
|
||||
@@ -179,8 +179,10 @@ uint8_t DetRangeCfgCommand::on_message(std::string &message) {
|
||||
ESP_LOGE(TAG, "Cannot configure range config. Sensor is not stopped!");
|
||||
return 1; // Command done
|
||||
} else if (message == "Done") {
|
||||
ESP_LOGI(TAG, "Updated detection area config:");
|
||||
ESP_LOGI(TAG, "Detection area 1 from %.02fm to %.02fm.", this->min1_, this->max1_);
|
||||
ESP_LOGI(TAG,
|
||||
"Updated detection area config:\n"
|
||||
"Detection area 1 from %.02fm to %.02fm.",
|
||||
this->min1_, this->max1_);
|
||||
if (this->min2_ >= 0 && this->max2_ >= 0) {
|
||||
ESP_LOGI(TAG, "Detection area 2 from %.02fm to %.02fm.", this->min2_, this->max2_);
|
||||
}
|
||||
@@ -209,9 +211,11 @@ uint8_t SetLatencyCommand::on_message(std::string &message) {
|
||||
ESP_LOGE(TAG, "Cannot configure output latency. Sensor is not stopped!");
|
||||
return 1; // Command done
|
||||
} else if (message == "Done") {
|
||||
ESP_LOGI(TAG, "Updated output latency config:");
|
||||
ESP_LOGI(TAG, "Signal that someone was detected is delayed by %.03f s.", this->delay_after_detection_);
|
||||
ESP_LOGI(TAG, "Signal that nobody is detected anymore is delayed by %.03f s.", this->delay_after_disappear_);
|
||||
ESP_LOGI(TAG,
|
||||
"Updated output latency config:\n"
|
||||
"Signal that someone was detected is delayed by %.03f s.\n"
|
||||
"Signal that nobody is detected anymore is delayed by %.03f s.",
|
||||
this->delay_after_detection_, this->delay_after_disappear_);
|
||||
ESP_LOGD(TAG, "Used command: %s", this->cmd_.c_str());
|
||||
return 1; // Command done
|
||||
}
|
||||
|
||||
@@ -17,11 +17,14 @@ void DHT::setup() {
|
||||
}
|
||||
|
||||
void DHT::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "DHT:");
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"DHT:\n"
|
||||
" %sModel: %s\n"
|
||||
" Internal pull-up: %s",
|
||||
this->is_auto_detect_ ? "Auto-detected " : "",
|
||||
this->model_ == DHT_MODEL_DHT11 ? "DHT11" : "DHT22 or equivalent",
|
||||
ONOFF(this->t_pin_->get_flags() & gpio::FLAG_PULLUP));
|
||||
LOG_PIN(" Pin: ", this->t_pin_);
|
||||
ESP_LOGCONFIG(TAG, " %sModel: %s", this->is_auto_detect_ ? "Auto-detected " : "",
|
||||
this->model_ == DHT_MODEL_DHT11 ? "DHT11" : "DHT22 or equivalent");
|
||||
ESP_LOGCONFIG(TAG, " Internal pull-up: %s", ONOFF(this->t_pin_->get_flags() & gpio::FLAG_PULLUP));
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
|
||||
LOG_SENSOR(" ", "Humidity", this->humidity_sensor_);
|
||||
|
||||
@@ -153,8 +153,10 @@ void EmmetiClimate::reverse_add_(T val, size_t len, esphome::remote_base::Remote
|
||||
|
||||
bool EmmetiClimate::check_checksum_(uint8_t checksum) {
|
||||
uint8_t expected = this->gen_checksum_();
|
||||
ESP_LOGV(TAG, "Expected checksum: %X", expected);
|
||||
ESP_LOGV(TAG, "Checksum received: %X", checksum);
|
||||
ESP_LOGV(TAG,
|
||||
"Expected checksum: %X\n"
|
||||
"Checksum received: %X",
|
||||
expected, checksum);
|
||||
|
||||
return checksum == expected;
|
||||
}
|
||||
@@ -264,8 +266,10 @@ bool EmmetiClimate::on_receive(remote_base::RemoteReceiveData data) {
|
||||
}
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, "Swing: %d", (curr_state.bitmap >> 1) & 0x01);
|
||||
ESP_LOGD(TAG, "Sleep: %d", (curr_state.bitmap >> 2) & 0x01);
|
||||
ESP_LOGD(TAG,
|
||||
"Swing: %d\n"
|
||||
"Sleep: %d",
|
||||
(curr_state.bitmap >> 1) & 0x01, (curr_state.bitmap >> 2) & 0x01);
|
||||
|
||||
for (size_t pos = 0; pos < 4; pos++) {
|
||||
if (data.expect_item(EMMETI_BIT_MARK, EMMETI_ONE_SPACE)) {
|
||||
@@ -291,10 +295,13 @@ bool EmmetiClimate::on_receive(remote_base::RemoteReceiveData data) {
|
||||
}
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, "Turbo: %d", (curr_state.bitmap >> 3) & 0x01);
|
||||
ESP_LOGD(TAG, "Light: %d", (curr_state.bitmap >> 4) & 0x01);
|
||||
ESP_LOGD(TAG, "Tree: %d", (curr_state.bitmap >> 5) & 0x01);
|
||||
ESP_LOGD(TAG, "Blow: %d", (curr_state.bitmap >> 6) & 0x01);
|
||||
ESP_LOGD(TAG,
|
||||
"Turbo: %d\n"
|
||||
"Light: %d\n"
|
||||
"Tree: %d\n"
|
||||
"Blow: %d",
|
||||
(curr_state.bitmap >> 3) & 0x01, (curr_state.bitmap >> 4) & 0x01, (curr_state.bitmap >> 5) & 0x01,
|
||||
(curr_state.bitmap >> 6) & 0x01);
|
||||
|
||||
uint16_t control_data = 0;
|
||||
for (size_t pos = 0; pos < 11; pos++) {
|
||||
|
||||
@@ -104,10 +104,12 @@ void EndstopCover::loop() {
|
||||
}
|
||||
void EndstopCover::dump_config() {
|
||||
LOG_COVER("", "Endstop Cover", this);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
" Open Duration: %.1fs\n"
|
||||
" Close Duration: %.1fs",
|
||||
this->open_duration_ / 1e3f, this->close_duration_ / 1e3f);
|
||||
LOG_BINARY_SENSOR(" ", "Open Endstop", this->open_endstop_);
|
||||
ESP_LOGCONFIG(TAG, " Open Duration: %.1fs", this->open_duration_ / 1e3f);
|
||||
LOG_BINARY_SENSOR(" ", "Close Endstop", this->close_endstop_);
|
||||
ESP_LOGCONFIG(TAG, " Close Duration: %.1fs", this->close_duration_ / 1e3f);
|
||||
}
|
||||
float EndstopCover::get_setup_priority() const { return setup_priority::DATA; }
|
||||
void EndstopCover::stop_prev_trigger_() {
|
||||
|
||||
@@ -151,14 +151,16 @@ void ENS160Component::update() {
|
||||
}
|
||||
|
||||
// verbose status logging
|
||||
ESP_LOGV(TAG, "Status: ENS160 STATAS bit 0x%x",
|
||||
(ENS160_DATA_STATUS_STATAS & (status_value)) == ENS160_DATA_STATUS_STATAS);
|
||||
ESP_LOGV(TAG, "Status: ENS160 STATER bit 0x%x",
|
||||
(ENS160_DATA_STATUS_STATER & (status_value)) == ENS160_DATA_STATUS_STATER);
|
||||
ESP_LOGV(TAG, "Status: ENS160 VALIDITY FLAG 0x%02x", (ENS160_DATA_STATUS_VALIDITY & status_value) >> 2);
|
||||
ESP_LOGV(TAG, "Status: ENS160 NEWDAT bit 0x%x",
|
||||
(ENS160_DATA_STATUS_NEWDAT & (status_value)) == ENS160_DATA_STATUS_NEWDAT);
|
||||
ESP_LOGV(TAG, "Status: ENS160 NEWGPR bit 0x%x",
|
||||
ESP_LOGV(TAG,
|
||||
"Status: ENS160 STATAS bit 0x%x\n"
|
||||
"Status: ENS160 STATER bit 0x%x\n"
|
||||
"Status: ENS160 VALIDITY FLAG 0x%02x\n"
|
||||
"Status: ENS160 NEWDAT bit 0x%x\n"
|
||||
"Status: ENS160 NEWGPR bit 0x%x",
|
||||
(ENS160_DATA_STATUS_STATAS & (status_value)) == ENS160_DATA_STATUS_STATAS,
|
||||
(ENS160_DATA_STATUS_STATER & (status_value)) == ENS160_DATA_STATUS_STATER,
|
||||
(ENS160_DATA_STATUS_VALIDITY & status_value) >> 2,
|
||||
(ENS160_DATA_STATUS_NEWDAT & (status_value)) == ENS160_DATA_STATUS_NEWDAT,
|
||||
(ENS160_DATA_STATUS_NEWGPR & (status_value)) == ENS160_DATA_STATUS_NEWGPR);
|
||||
|
||||
data_ready = ENS160_DATA_STATUS_NEWDAT & status_value;
|
||||
|
||||
@@ -331,20 +331,21 @@ void HOT EPaperBase::draw_pixel_at(int x, int y, Color color) {
|
||||
|
||||
void EPaperBase::dump_config() {
|
||||
LOG_DISPLAY("", "E-Paper SPI", this);
|
||||
ESP_LOGCONFIG(TAG, " Model: %s", this->name_);
|
||||
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
||||
LOG_PIN(" DC Pin: ", this->dc_pin_);
|
||||
LOG_PIN(" Busy Pin: ", this->busy_pin_);
|
||||
LOG_PIN(" CS Pin: ", this->cs_);
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
" Model: %s\n"
|
||||
" SPI Data Rate: %uMHz\n"
|
||||
" Full update every: %d\n"
|
||||
" Swap X/Y: %s\n"
|
||||
" Mirror X: %s\n"
|
||||
" Mirror Y: %s",
|
||||
(unsigned) (this->data_rate_ / 1000000), this->full_update_every_, YESNO(this->transform_ & SWAP_XY),
|
||||
YESNO(this->transform_ & MIRROR_X), YESNO(this->transform_ & MIRROR_Y));
|
||||
this->name_, (unsigned) (this->data_rate_ / 1000000), this->full_update_every_,
|
||||
YESNO(this->transform_ & SWAP_XY), YESNO(this->transform_ & MIRROR_X),
|
||||
YESNO(this->transform_ & MIRROR_Y));
|
||||
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
||||
LOG_PIN(" DC Pin: ", this->dc_pin_);
|
||||
LOG_PIN(" Busy Pin: ", this->busy_pin_);
|
||||
LOG_PIN(" CS Pin: ", this->cs_);
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
}
|
||||
|
||||
} // namespace esphome::epaper_spi
|
||||
|
||||
@@ -210,9 +210,11 @@ bool ES8388::set_dac_output(DacOutputLine line) {
|
||||
return false;
|
||||
};
|
||||
|
||||
ESP_LOGV(TAG, "Setting ES8388_DACPOWER to 0x%02X", dac_power);
|
||||
ESP_LOGV(TAG, "Setting ES8388_DACCONTROL24 / ES8388_DACCONTROL25 to 0x%02X", reg_out1);
|
||||
ESP_LOGV(TAG, "Setting ES8388_DACCONTROL26 / ES8388_DACCONTROL27 to 0x%02X", reg_out2);
|
||||
ESP_LOGV(TAG,
|
||||
"Setting ES8388_DACPOWER to 0x%02X\n"
|
||||
"Setting ES8388_DACCONTROL24 / ES8388_DACCONTROL25 to 0x%02X\n"
|
||||
"Setting ES8388_DACCONTROL26 / ES8388_DACCONTROL27 to 0x%02X",
|
||||
dac_power, reg_out1, reg_out2);
|
||||
|
||||
ES8388_ERROR_CHECK(this->write_byte(ES8388_DACCONTROL24, reg_out1)); // LOUT1VOL
|
||||
ES8388_ERROR_CHECK(this->write_byte(ES8388_DACCONTROL25, reg_out1)); // ROUT1VOL
|
||||
|
||||
@@ -644,6 +644,7 @@ CONF_DISABLE_VFS_SUPPORT_SELECT = "disable_vfs_support_select"
|
||||
CONF_DISABLE_VFS_SUPPORT_DIR = "disable_vfs_support_dir"
|
||||
CONF_FREERTOS_IN_IRAM = "freertos_in_iram"
|
||||
CONF_RINGBUF_IN_IRAM = "ringbuf_in_iram"
|
||||
CONF_HEAP_IN_IRAM = "heap_in_iram"
|
||||
CONF_LOOP_TASK_STACK_SIZE = "loop_task_stack_size"
|
||||
|
||||
# VFS requirement tracking
|
||||
@@ -745,6 +746,7 @@ FRAMEWORK_SCHEMA = cv.Schema(
|
||||
cv.Optional(CONF_DISABLE_VFS_SUPPORT_DIR, default=True): cv.boolean,
|
||||
cv.Optional(CONF_FREERTOS_IN_IRAM, default=False): cv.boolean,
|
||||
cv.Optional(CONF_RINGBUF_IN_IRAM, default=False): cv.boolean,
|
||||
cv.Optional(CONF_HEAP_IN_IRAM, default=False): cv.boolean,
|
||||
cv.Optional(CONF_EXECUTE_FROM_PSRAM, default=False): cv.boolean,
|
||||
cv.Optional(CONF_LOOP_TASK_STACK_SIZE, default=8192): cv.int_range(
|
||||
min=8192, max=32768
|
||||
@@ -1090,6 +1092,12 @@ async def to_code(config):
|
||||
# Place in flash to save IRAM (default)
|
||||
add_idf_sdkconfig_option("CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH", True)
|
||||
|
||||
# Place heap functions into flash to save IRAM (~4-6KB savings)
|
||||
# Safe as long as heap functions are not called from ISRs (which they shouldn't be)
|
||||
# Users can set heap_in_iram: true as an escape hatch if needed
|
||||
if not conf[CONF_ADVANCED][CONF_HEAP_IN_IRAM]:
|
||||
add_idf_sdkconfig_option("CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH", True)
|
||||
|
||||
# Setup watchdog
|
||||
add_idf_sdkconfig_option("CONFIG_ESP_TASK_WDT", True)
|
||||
add_idf_sdkconfig_option("CONFIG_ESP_TASK_WDT_PANIC", True)
|
||||
|
||||
@@ -23,9 +23,11 @@ struct NVSData {
|
||||
size_t len;
|
||||
|
||||
void set_data(const uint8_t *src, size_t size) {
|
||||
this->data = std::make_unique<uint8_t[]>(size);
|
||||
if (!this->data || this->len != size) {
|
||||
this->data = std::make_unique<uint8_t[]>(size);
|
||||
this->len = size;
|
||||
}
|
||||
memcpy(this->data.get(), src, size);
|
||||
this->len = size;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ from esphome.core import CORE, CoroPriority, TimePeriod, coroutine_with_priority
|
||||
import esphome.final_validate as fv
|
||||
|
||||
DEPENDENCIES = ["esp32"]
|
||||
AUTO_LOAD = ["socket"]
|
||||
CODEOWNERS = ["@jesserockz", "@Rapsssito", "@bdraco"]
|
||||
DOMAIN = "esp32_ble"
|
||||
|
||||
|
||||
@@ -70,9 +70,9 @@ float BLEClientBase::get_setup_priority() const { return setup_priority::AFTER_B
|
||||
void BLEClientBase::dump_config() {
|
||||
ESP_LOGCONFIG(TAG,
|
||||
" Address: %s\n"
|
||||
" Auto-Connect: %s",
|
||||
this->address_str(), TRUEFALSE(this->auto_connect_));
|
||||
ESP_LOGCONFIG(TAG, " State: %s", espbt::client_state_to_string(this->state()));
|
||||
" Auto-Connect: %s\n"
|
||||
" State: %s",
|
||||
this->address_str(), TRUEFALSE(this->auto_connect_), espbt::client_state_to_string(this->state()));
|
||||
if (this->status_ == ESP_GATT_NO_RESOURCES) {
|
||||
ESP_LOGE(TAG, " Failed due to no resources. Try to reduce number of BLE clients in config.");
|
||||
} else if (this->status_ != ESP_GATT_OK) {
|
||||
@@ -415,8 +415,10 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
for (auto &svc : this->services_) {
|
||||
char uuid_buf[espbt::UUID_STR_LEN];
|
||||
svc->uuid.to_str(uuid_buf);
|
||||
ESP_LOGV(TAG, "[%d] [%s] Service UUID: %s", this->connection_index_, this->address_str_, uuid_buf);
|
||||
ESP_LOGV(TAG, "[%d] [%s] start_handle: 0x%x end_handle: 0x%x", this->connection_index_, this->address_str_,
|
||||
ESP_LOGV(TAG,
|
||||
"[%d] [%s] Service UUID: %s\n"
|
||||
"[%d] [%s] start_handle: 0x%x end_handle: 0x%x",
|
||||
this->connection_index_, this->address_str_, uuid_buf, this->connection_index_, this->address_str_,
|
||||
svc->start_handle, svc->end_handle);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -98,7 +98,13 @@ template<typename... Ts> class ESP32BLEStartScanAction : public Action<Ts...> {
|
||||
TEMPLATABLE_VALUE(bool, continuous)
|
||||
void play(const Ts &...x) override {
|
||||
this->parent_->set_scan_continuous(this->continuous_.value(x...));
|
||||
this->parent_->start_scan();
|
||||
// Only call start_scan() if scanner is IDLE
|
||||
// For other states (STARTING, RUNNING, STOPPING, FAILED), the normal state
|
||||
// machine flow will eventually transition back to IDLE, at which point
|
||||
// loop() will see scan_continuous_ and restart scanning if it is true.
|
||||
if (this->parent_->get_scanner_state() == ScannerState::IDLE) {
|
||||
this->parent_->start_scan();
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -657,8 +657,10 @@ void ESP32BLETracker::dump_config() {
|
||||
" Continuous Scanning: %s",
|
||||
this->scan_duration_, this->scan_interval_ * 0.625f, this->scan_window_ * 0.625f,
|
||||
this->scan_active_ ? "ACTIVE" : "PASSIVE", YESNO(this->scan_continuous_));
|
||||
ESP_LOGCONFIG(TAG, " Scanner State: %s", this->scanner_state_to_string_(this->scanner_state_));
|
||||
ESP_LOGCONFIG(TAG, " Connecting: %d, discovered: %d, disconnecting: %d", this->client_state_counts_.connecting,
|
||||
ESP_LOGCONFIG(TAG,
|
||||
" Scanner State: %s\n"
|
||||
" Connecting: %d, discovered: %d, disconnecting: %d",
|
||||
this->scanner_state_to_string_(this->scanner_state_), this->client_state_counts_.connecting,
|
||||
this->client_state_counts_.discovered, this->client_state_counts_.disconnecting);
|
||||
if (this->scan_start_fail_count_) {
|
||||
ESP_LOGCONFIG(TAG, " Scan Start Fail Count: %d", this->scan_start_fail_count_);
|
||||
|
||||
@@ -41,11 +41,13 @@ void Esp32HostedUpdate::setup() {
|
||||
if (this->firmware_size_ >= app_desc_offset + sizeof(esp_app_desc_t)) {
|
||||
esp_app_desc_t *app_desc = (esp_app_desc_t *) (this->firmware_data_ + app_desc_offset);
|
||||
if (app_desc->magic_word == ESP_APP_DESC_MAGIC_WORD) {
|
||||
ESP_LOGD(TAG, "Firmware version: %s", app_desc->version);
|
||||
ESP_LOGD(TAG, "Project name: %s", app_desc->project_name);
|
||||
ESP_LOGD(TAG, "Build date: %s", app_desc->date);
|
||||
ESP_LOGD(TAG, "Build time: %s", app_desc->time);
|
||||
ESP_LOGD(TAG, "IDF version: %s", app_desc->idf_ver);
|
||||
ESP_LOGD(TAG,
|
||||
"Firmware version: %s\n"
|
||||
"Project name: %s\n"
|
||||
"Build date: %s\n"
|
||||
"Build time: %s\n"
|
||||
"IDF version: %s",
|
||||
app_desc->version, app_desc->project_name, app_desc->date, app_desc->time, app_desc->idf_ver);
|
||||
this->update_info_.latest_version = app_desc->version;
|
||||
if (this->update_info_.latest_version != this->update_info_.current_version) {
|
||||
this->state_ = update::UPDATE_STATE_AVAILABLE;
|
||||
|
||||
@@ -98,7 +98,7 @@ void ESP32RMTLEDStripLightOutput::setup() {
|
||||
channel.trans_queue_depth = 1;
|
||||
channel.flags.io_loop_back = 0;
|
||||
channel.flags.io_od_mode = 0;
|
||||
channel.flags.invert_out = 0;
|
||||
channel.flags.invert_out = this->invert_out_;
|
||||
channel.flags.with_dma = this->use_dma_;
|
||||
channel.intr_priority = 0;
|
||||
if (rmt_new_tx_channel(&channel, &this->channel_) != ESP_OK) {
|
||||
|
||||
@@ -49,6 +49,7 @@ class ESP32RMTLEDStripLightOutput : public light::AddressableLight {
|
||||
}
|
||||
|
||||
void set_pin(uint8_t pin) { this->pin_ = pin; }
|
||||
void set_inverted(bool inverted) { this->invert_out_ = inverted; }
|
||||
void set_num_leds(uint16_t num_leds) { this->num_leds_ = num_leds; }
|
||||
void set_is_rgbw(bool is_rgbw) { this->is_rgbw_ = is_rgbw; }
|
||||
void set_is_wrgb(bool is_wrgb) { this->is_wrgb_ = is_wrgb; }
|
||||
@@ -93,6 +94,7 @@ class ESP32RMTLEDStripLightOutput : public light::AddressableLight {
|
||||
bool is_wrgb_{false};
|
||||
bool use_dma_{false};
|
||||
bool use_psram_{false};
|
||||
bool invert_out_{false};
|
||||
|
||||
RGBOrder rgb_order_{ORDER_RGB};
|
||||
|
||||
|
||||
@@ -8,9 +8,11 @@ from esphome.components.const import CONF_USE_PSRAM
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_CHIPSET,
|
||||
CONF_INVERTED,
|
||||
CONF_IS_RGBW,
|
||||
CONF_MAX_REFRESH_RATE,
|
||||
CONF_NUM_LEDS,
|
||||
CONF_NUMBER,
|
||||
CONF_OUTPUT_ID,
|
||||
CONF_PIN,
|
||||
CONF_RGB_ORDER,
|
||||
@@ -71,7 +73,7 @@ CONFIG_SCHEMA = cv.All(
|
||||
light.ADDRESSABLE_LIGHT_SCHEMA.extend(
|
||||
{
|
||||
cv.GenerateID(CONF_OUTPUT_ID): cv.declare_id(ESP32RMTLEDStripLightOutput),
|
||||
cv.Required(CONF_PIN): pins.internal_gpio_output_pin_number,
|
||||
cv.Required(CONF_PIN): pins.internal_gpio_output_pin_schema,
|
||||
cv.Required(CONF_NUM_LEDS): cv.positive_not_null_int,
|
||||
cv.Required(CONF_RGB_ORDER): cv.enum(RGB_ORDERS, upper=True),
|
||||
cv.SplitDefault(
|
||||
@@ -132,7 +134,9 @@ async def to_code(config):
|
||||
await cg.register_component(var, config)
|
||||
|
||||
cg.add(var.set_num_leds(config[CONF_NUM_LEDS]))
|
||||
cg.add(var.set_pin(config[CONF_PIN]))
|
||||
cg.add(var.set_pin(config[CONF_PIN][CONF_NUMBER]))
|
||||
if config[CONF_PIN][CONF_INVERTED]:
|
||||
cg.add(var.set_inverted(True))
|
||||
|
||||
if CONF_MAX_REFRESH_RATE in config:
|
||||
cg.add(var.set_max_refresh_rate(config[CONF_MAX_REFRESH_RATE]))
|
||||
|
||||
@@ -18,9 +18,11 @@ void ESP8266PWM::setup() {
|
||||
this->turn_off();
|
||||
}
|
||||
void ESP8266PWM::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "ESP8266 PWM:");
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"ESP8266 PWM:\n"
|
||||
" Frequency: %.1f Hz",
|
||||
this->frequency_);
|
||||
LOG_PIN(" Pin: ", this->pin_);
|
||||
ESP_LOGCONFIG(TAG, " Frequency: %.1f Hz", this->frequency_);
|
||||
LOG_FLOAT_OUTPUT(this);
|
||||
}
|
||||
void HOT ESP8266PWM::write_state(float state) {
|
||||
|
||||
@@ -21,9 +21,11 @@ void EspLdo::setup() {
|
||||
}
|
||||
}
|
||||
void EspLdo::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "ESP LDO Channel %d:", this->channel_);
|
||||
ESP_LOGCONFIG(TAG, " Voltage: %fV", this->voltage_);
|
||||
ESP_LOGCONFIG(TAG, " Adjustable: %s", YESNO(this->adjustable_));
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"ESP LDO Channel %d:\n"
|
||||
" Voltage: %fV\n"
|
||||
" Adjustable: %s",
|
||||
this->channel_, this->voltage_, YESNO(this->adjustable_));
|
||||
}
|
||||
|
||||
void EspLdo::adjust_voltage(float voltage) {
|
||||
|
||||
@@ -21,9 +21,11 @@ void ESPNowTransport::setup() {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Registering ESP-NOW handlers");
|
||||
ESP_LOGI(TAG, "Peer address: %02X:%02X:%02X:%02X:%02X:%02X", this->peer_address_[0], this->peer_address_[1],
|
||||
this->peer_address_[2], this->peer_address_[3], this->peer_address_[4], this->peer_address_[5]);
|
||||
ESP_LOGI(TAG,
|
||||
"Registering ESP-NOW handlers\n"
|
||||
"Peer address: %02X:%02X:%02X:%02X:%02X:%02X",
|
||||
this->peer_address_[0], this->peer_address_[1], this->peer_address_[2], this->peer_address_[3],
|
||||
this->peer_address_[4], this->peer_address_[5]);
|
||||
|
||||
// Register received handler
|
||||
this->parent_->register_received_handler(this);
|
||||
|
||||
@@ -813,8 +813,10 @@ void EthernetComponent::write_phy_register_(esp_eth_mac_t *mac, PHYRegister regi
|
||||
ESPHL_ERROR_CHECK(err, "Select PHY Register page failed");
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, "Writing to PHY Register Address: 0x%02" PRIX32, register_data.address);
|
||||
ESP_LOGD(TAG, "Writing to PHY Register Value: 0x%04" PRIX32, register_data.value);
|
||||
ESP_LOGD(TAG,
|
||||
"Writing to PHY Register Address: 0x%02" PRIX32 "\n"
|
||||
"Writing to PHY Register Value: 0x%04" PRIX32,
|
||||
register_data.address, register_data.value);
|
||||
err = mac->write_phy_reg(mac, this->phy_addr_, register_data.address, register_data.value);
|
||||
ESPHL_ERROR_CHECK(err, "Writing PHY Register failed");
|
||||
|
||||
|
||||
@@ -148,10 +148,13 @@ void EzoPMP::read_command_result_() {
|
||||
char current_char = response_buffer[i];
|
||||
|
||||
if (current_char == '\0') {
|
||||
ESP_LOGV(TAG, "Read Response from device: %s", (char *) response_buffer);
|
||||
ESP_LOGV(TAG, "First Component: %s", (char *) first_parameter_buffer);
|
||||
ESP_LOGV(TAG, "Second Component: %s", (char *) second_parameter_buffer);
|
||||
ESP_LOGV(TAG, "Third Component: %s", (char *) third_parameter_buffer);
|
||||
ESP_LOGV(TAG,
|
||||
"Read Response from device: %s\n"
|
||||
"First Component: %s\n"
|
||||
"Second Component: %s\n"
|
||||
"Third Component: %s",
|
||||
(char *) response_buffer, (char *) first_parameter_buffer, (char *) second_parameter_buffer,
|
||||
(char *) third_parameter_buffer);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@ static bool was_power_cycled() {
|
||||
void FactoryResetComponent::dump_config() {
|
||||
uint8_t count = 0;
|
||||
this->flash_.load(&count);
|
||||
ESP_LOGCONFIG(TAG, "Factory Reset by Reset:");
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"Factory Reset by Reset:\n"
|
||||
" Max interval between resets: %u seconds\n"
|
||||
" Current count: %u\n"
|
||||
" Factory reset after %u resets",
|
||||
|
||||
@@ -179,8 +179,10 @@ void Fan::add_on_state_callback(std::function<void()> &&callback) { this->state_
|
||||
void Fan::publish_state() {
|
||||
auto traits = this->get_traits();
|
||||
|
||||
ESP_LOGD(TAG, "'%s' - Sending state:", this->name_.c_str());
|
||||
ESP_LOGD(TAG, " State: %s", ONOFF(this->state));
|
||||
ESP_LOGD(TAG,
|
||||
"'%s' - Sending state:\n"
|
||||
" State: %s",
|
||||
this->name_.c_str(), ONOFF(this->state));
|
||||
if (traits.supports_speed()) {
|
||||
ESP_LOGD(TAG, " Speed: %d", this->speed);
|
||||
}
|
||||
|
||||
@@ -95,11 +95,13 @@ void GCJA5Component::parse_data_() {
|
||||
if (!this->first_status_log_) {
|
||||
this->first_status_log_ = true;
|
||||
|
||||
ESP_LOGI(TAG, "GCJA5 Status");
|
||||
ESP_LOGI(TAG, "Overall Status : %i", (status >> 6) & 0x03);
|
||||
ESP_LOGI(TAG, "PD Status : %i", (status >> 4) & 0x03);
|
||||
ESP_LOGI(TAG, "LD Status : %i", (status >> 2) & 0x03);
|
||||
ESP_LOGI(TAG, "Fan Status : %i", (status >> 0) & 0x03);
|
||||
ESP_LOGI(TAG,
|
||||
"GCJA5 Status\n"
|
||||
"Overall Status : %i\n"
|
||||
"PD Status : %i\n"
|
||||
"LD Status : %i\n"
|
||||
"Fan Status : %i",
|
||||
(status >> 6) & 0x03, (status >> 4) & 0x03, (status >> 2) & 0x03, (status >> 0) & 0x03);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,10 @@ void GLR01I2CComponent::setup() {
|
||||
}
|
||||
|
||||
void GLR01I2CComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "GL-R01 I2C:");
|
||||
ESP_LOGCONFIG(TAG, " Firmware Version: 0x%04X", this->version_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"GL-R01 I2C:\n"
|
||||
" Firmware Version: 0x%04X",
|
||||
this->version_);
|
||||
LOG_I2C_DEVICE(this);
|
||||
LOG_SENSOR(" ", "Distance", this);
|
||||
}
|
||||
|
||||
@@ -89,11 +89,12 @@ void HC8Component::calibrate(uint16_t baseline) {
|
||||
float HC8Component::get_setup_priority() const { return setup_priority::DATA; }
|
||||
|
||||
void HC8Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "HC8:");
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"HC8:\n"
|
||||
" Warmup time: %" PRIu32 " s",
|
||||
this->warmup_seconds_);
|
||||
LOG_SENSOR(" ", "CO2", this->co2_sensor_);
|
||||
this->check_uart_settings(9600);
|
||||
|
||||
ESP_LOGCONFIG(TAG, " Warmup time: %" PRIu32 " s", this->warmup_seconds_);
|
||||
}
|
||||
|
||||
} // namespace esphome::hc8
|
||||
|
||||
@@ -33,15 +33,15 @@ void HLW8012Component::setup() {
|
||||
}
|
||||
}
|
||||
void HLW8012Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "HLW8012:");
|
||||
LOG_PIN(" SEL Pin: ", this->sel_pin_);
|
||||
LOG_PIN(" CF Pin: ", this->cf_pin_);
|
||||
LOG_PIN(" CF1 Pin: ", this->cf1_pin_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"HLW8012:\n"
|
||||
" Change measurement mode every %" PRIu32 "\n"
|
||||
" Current resistor: %.1f mΩ\n"
|
||||
" Voltage Divider: %.1f",
|
||||
this->change_mode_every_, this->current_resistor_ * 1000.0f, this->voltage_divider_);
|
||||
LOG_PIN(" SEL Pin: ", this->sel_pin_);
|
||||
LOG_PIN(" CF Pin: ", this->cf_pin_);
|
||||
LOG_PIN(" CF1 Pin: ", this->cf1_pin_);
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Voltage", this->voltage_sensor_);
|
||||
LOG_SENSOR(" ", "Current", this->current_sensor_);
|
||||
|
||||
@@ -35,8 +35,10 @@ uint8_t HONEYWELLABPSensor::readsensor_() {
|
||||
pressure_count_ = ((uint16_t) (buf_[0]) << 8 & 0x3F00) | ((uint16_t) (buf_[1]) & 0xFF);
|
||||
// 11 - bit temperature is all of byte 2 (lowest 8 bits) and the first three bits of byte 3
|
||||
temperature_count_ = (((uint16_t) (buf_[2]) << 3) & 0x7F8) | (((uint16_t) (buf_[3]) >> 5) & 0x7);
|
||||
ESP_LOGV(TAG, "Sensor pressure_count_ %d", pressure_count_);
|
||||
ESP_LOGV(TAG, "Sensor temperature_count_ %d", temperature_count_);
|
||||
ESP_LOGV(TAG,
|
||||
"Sensor pressure_count_ %d\n"
|
||||
"Sensor temperature_count_ %d",
|
||||
pressure_count_, temperature_count_);
|
||||
}
|
||||
return status_;
|
||||
}
|
||||
|
||||
@@ -105,9 +105,8 @@ uint8_t OtaHttpRequestComponent::do_ota_() {
|
||||
|
||||
// we will compute MD5 on the fly for verification -- Arduino OTA seems to ignore it
|
||||
md5_receive.init();
|
||||
ESP_LOGV(TAG, "MD5Digest initialized");
|
||||
|
||||
ESP_LOGV(TAG, "OTA backend begin");
|
||||
ESP_LOGV(TAG, "MD5Digest initialized\n"
|
||||
"OTA backend begin");
|
||||
auto backend = ota::make_ota_backend();
|
||||
auto error_code = backend->begin(container->content_length);
|
||||
if (error_code != ota::OTA_RESPONSE_OK) {
|
||||
|
||||
@@ -15,6 +15,7 @@ from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_LAMBDA,
|
||||
CONF_OE_PIN,
|
||||
CONF_ROTATION,
|
||||
CONF_UPDATE_INTERVAL,
|
||||
)
|
||||
from esphome.core import ID
|
||||
@@ -134,6 +135,14 @@ CLOCK_SPEEDS = {
|
||||
"20MHZ": Hub75ClockSpeed.HZ_20M,
|
||||
}
|
||||
|
||||
Hub75Rotation = cg.global_ns.enum("Hub75Rotation", is_class=True)
|
||||
ROTATIONS = {
|
||||
0: Hub75Rotation.ROTATE_0,
|
||||
90: Hub75Rotation.ROTATE_90,
|
||||
180: Hub75Rotation.ROTATE_180,
|
||||
270: Hub75Rotation.ROTATE_270,
|
||||
}
|
||||
|
||||
HUB75Display = hub75_ns.class_("HUB75Display", cg.PollingComponent, display.Display)
|
||||
Hub75Config = cg.global_ns.struct("Hub75Config")
|
||||
Hub75Pins = cg.global_ns.struct("Hub75Pins")
|
||||
@@ -361,6 +370,8 @@ CONFIG_SCHEMA = cv.All(
|
||||
display.FULL_DISPLAY_SCHEMA.extend(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(HUB75Display),
|
||||
# Override rotation - store Hub75Rotation directly (driver handles rotation)
|
||||
cv.Optional(CONF_ROTATION): cv.enum(ROTATIONS, int=True),
|
||||
# Board preset (optional - provides default pin mappings)
|
||||
cv.Optional(CONF_BOARD): cv.one_of(*BOARDS.keys(), lower=True),
|
||||
# Panel dimensions
|
||||
@@ -378,7 +389,7 @@ CONFIG_SCHEMA = cv.All(
|
||||
# Display configuration
|
||||
cv.Optional(CONF_DOUBLE_BUFFER): cv.boolean,
|
||||
cv.Optional(CONF_BRIGHTNESS): cv.int_range(min=0, max=255),
|
||||
cv.Optional(CONF_BIT_DEPTH): cv.int_range(min=6, max=12),
|
||||
cv.Optional(CONF_BIT_DEPTH): cv.int_range(min=4, max=12),
|
||||
cv.Optional(CONF_GAMMA_CORRECT): cv.enum(
|
||||
{"LINEAR": 0, "CIE1931": 1, "GAMMA_2_2": 2}, upper=True
|
||||
),
|
||||
@@ -490,10 +501,11 @@ def _build_config_struct(
|
||||
Fields must be added in declaration order (see hub75_types.h) to satisfy
|
||||
C++ designated initializer requirements. The order is:
|
||||
1. fields_before_pins (panel_width through layout)
|
||||
2. pins
|
||||
3. output_clock_speed
|
||||
4. min_refresh_rate
|
||||
5. fields_after_min_refresh (latch_blanking through brightness)
|
||||
2. rotation
|
||||
3. pins
|
||||
4. output_clock_speed
|
||||
5. min_refresh_rate
|
||||
6. fields_after_min_refresh (latch_blanking through brightness)
|
||||
"""
|
||||
fields_before_pins = [
|
||||
(CONF_PANEL_WIDTH, "panel_width"),
|
||||
@@ -516,6 +528,10 @@ def _build_config_struct(
|
||||
|
||||
_append_config_fields(config, fields_before_pins, config_fields)
|
||||
|
||||
# Rotation - config already contains Hub75Rotation enum from cv.enum
|
||||
if CONF_ROTATION in config:
|
||||
config_fields.append(("rotation", config[CONF_ROTATION]))
|
||||
|
||||
config_fields.append(("pins", pins_struct))
|
||||
|
||||
if CONF_CLOCK_SPEED in config:
|
||||
@@ -531,7 +547,7 @@ def _build_config_struct(
|
||||
async def to_code(config: ConfigType) -> None:
|
||||
add_idf_component(
|
||||
name="esphome/esp-hub75",
|
||||
ref="0.1.7",
|
||||
ref="0.2.2",
|
||||
)
|
||||
|
||||
# Set compile-time configuration via defines
|
||||
@@ -570,6 +586,11 @@ async def to_code(config: ConfigType) -> None:
|
||||
pins_struct = _build_pins_struct(pin_expressions, e_pin_num)
|
||||
hub75_config = _build_config_struct(config, pins_struct, min_refresh)
|
||||
|
||||
# Rotation is handled by the hub75 driver (config_.rotation already set above).
|
||||
# Force rotation to 0 for ESPHome's Display base class to avoid double-rotation.
|
||||
if CONF_ROTATION in config:
|
||||
config[CONF_ROTATION] = 0
|
||||
|
||||
# Create display and register
|
||||
var = cg.new_Pvariable(config[CONF_ID], hub75_config)
|
||||
await display.register_display(var, config)
|
||||
|
||||
@@ -92,14 +92,25 @@ void HUB75Display::fill(Color color) {
|
||||
if (!this->enabled_) [[unlikely]]
|
||||
return;
|
||||
|
||||
// Special case: black (off) - use fast hardware clear
|
||||
if (!color.is_on()) {
|
||||
// Start with full display rect
|
||||
display::Rect fill_rect(0, 0, this->get_width_internal(), this->get_height_internal());
|
||||
|
||||
// Apply clipping using Rect::shrink() to intersect
|
||||
display::Rect clip = this->get_clipping();
|
||||
if (clip.is_set()) {
|
||||
fill_rect.shrink(clip);
|
||||
if (!fill_rect.is_set())
|
||||
return; // Completely clipped
|
||||
}
|
||||
|
||||
// Fast path: black filling entire display
|
||||
if (!color.is_on() && fill_rect.x == 0 && fill_rect.y == 0 && fill_rect.w == this->get_width_internal() &&
|
||||
fill_rect.h == this->get_height_internal()) {
|
||||
driver_->clear();
|
||||
return;
|
||||
}
|
||||
|
||||
// For non-black colors, fall back to base class (pixel-by-pixel)
|
||||
Display::fill(color);
|
||||
driver_->fill(fill_rect.x, fill_rect.y, fill_rect.w, fill_rect.h, color.r, color.g, color.b);
|
||||
}
|
||||
|
||||
void HOT HUB75Display::draw_pixel_at(int x, int y, Color color) {
|
||||
|
||||
@@ -39,8 +39,8 @@ class HUB75Display : public display::Display {
|
||||
|
||||
protected:
|
||||
// Display internal methods
|
||||
int get_width_internal() override { return config_.panel_width * config_.layout_cols; }
|
||||
int get_height_internal() override { return config_.panel_height * config_.layout_rows; }
|
||||
int get_width_internal() override { return this->driver_ != nullptr ? this->driver_->get_width() : 0; }
|
||||
int get_height_internal() override { return this->driver_ != nullptr ? this->driver_->get_height() : 0; }
|
||||
|
||||
// Member variables
|
||||
Hub75Driver *driver_{nullptr};
|
||||
|
||||
@@ -61,13 +61,13 @@ void INA260Component::setup() {
|
||||
}
|
||||
|
||||
void INA260Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "INA260:");
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"INA260:\n"
|
||||
" Manufacture ID: 0x%x\n"
|
||||
" Device ID: 0x%x",
|
||||
this->manufacture_id_, this->device_id_);
|
||||
LOG_I2C_DEVICE(this);
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
|
||||
ESP_LOGCONFIG(TAG, " Manufacture ID: 0x%x", this->manufacture_id_);
|
||||
ESP_LOGCONFIG(TAG, " Device ID: 0x%x", this->device_id_);
|
||||
|
||||
LOG_SENSOR(" ", "Bus Voltage", this->bus_voltage_sensor_);
|
||||
LOG_SENSOR(" ", "Current", this->current_sensor_);
|
||||
LOG_SENSOR(" ", "Power", this->power_sensor_);
|
||||
|
||||
@@ -364,8 +364,10 @@ bool INA2XX::configure_shunt_() {
|
||||
ESP_LOGW(TAG, "Shunt value too high");
|
||||
}
|
||||
this->shunt_cal_ &= 0x7FFF;
|
||||
ESP_LOGV(TAG, "Given Rshunt=%f Ohm and Max_current=%.3f", this->shunt_resistance_ohm_, this->max_current_a_);
|
||||
ESP_LOGV(TAG, "New CURRENT_LSB=%f, SHUNT_CAL=%u", this->current_lsb_, this->shunt_cal_);
|
||||
ESP_LOGV(TAG,
|
||||
"Given Rshunt=%f Ohm and Max_current=%.3f\n"
|
||||
"New CURRENT_LSB=%f, SHUNT_CAL=%u",
|
||||
this->shunt_resistance_ohm_, this->max_current_a_, this->current_lsb_, this->shunt_cal_);
|
||||
return this->write_unsigned_16_(RegisterMap::REG_SHUNT_CAL, this->shunt_cal_);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,19 +146,14 @@ void Lc709203f::update() {
|
||||
}
|
||||
|
||||
void Lc709203f::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "LC709203F:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"LC709203F:\n"
|
||||
" Pack Size: %d mAH\n"
|
||||
" Pack APA: 0x%02X",
|
||||
this->pack_size_, this->apa_);
|
||||
|
||||
// This is only true if the pack_voltage_ is either 0x0000 or 0x0001. The config validator
|
||||
// should have already verified this.
|
||||
ESP_LOGCONFIG(TAG, " Pack Rated Voltage: 3.%sV", this->pack_voltage_ == 0x0000 ? "8" : "7");
|
||||
|
||||
" Pack APA: 0x%02X\n"
|
||||
" Pack Rated Voltage: 3.%sV",
|
||||
this->pack_size_, this->apa_, this->pack_voltage_ == 0x0000 ? "8" : "7");
|
||||
LOG_I2C_DEVICE(this);
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Voltage", this->voltage_sensor_);
|
||||
LOG_SENSOR(" ", "Battery Remaining", this->battery_remaining_sensor_);
|
||||
|
||||
|
||||
@@ -130,8 +130,10 @@ void LEDCOutput::setup() {
|
||||
}
|
||||
int hpoint = ledc_angle_to_htop(this->phase_angle_, this->bit_depth_);
|
||||
|
||||
ESP_LOGV(TAG, "Configured frequency %f with a bit depth of %u bits", this->frequency_, this->bit_depth_);
|
||||
ESP_LOGV(TAG, "Angle of %.1f° results in hpoint %u", this->phase_angle_, hpoint);
|
||||
ESP_LOGV(TAG,
|
||||
"Configured frequency %f with a bit depth of %u bits\n"
|
||||
"Angle of %.1f° results in hpoint %u",
|
||||
this->frequency_, this->bit_depth_, this->phase_angle_, hpoint);
|
||||
|
||||
ledc_channel_config_t chan_conf{};
|
||||
chan_conf.gpio_num = this->pin_->get_pin();
|
||||
@@ -147,25 +149,30 @@ void LEDCOutput::setup() {
|
||||
}
|
||||
|
||||
void LEDCOutput::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "Output:");
|
||||
LOG_PIN(" Pin ", this->pin_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"Output:\n"
|
||||
" Channel: %u\n"
|
||||
" PWM Frequency: %.1f Hz\n"
|
||||
" Phase angle: %.1f°\n"
|
||||
" Bit depth: %u",
|
||||
this->channel_, this->frequency_, this->phase_angle_, this->bit_depth_);
|
||||
ESP_LOGV(TAG, " Max frequency for bit depth: %f", ledc_max_frequency_for_bit_depth(this->bit_depth_));
|
||||
ESP_LOGV(TAG, " Min frequency for bit depth: %f",
|
||||
ledc_min_frequency_for_bit_depth(this->bit_depth_, (this->frequency_ < 100)));
|
||||
ESP_LOGV(TAG, " Max frequency for bit depth-1: %f", ledc_max_frequency_for_bit_depth(this->bit_depth_ - 1));
|
||||
ESP_LOGV(TAG, " Min frequency for bit depth-1: %f",
|
||||
ledc_min_frequency_for_bit_depth(this->bit_depth_ - 1, (this->frequency_ < 100)));
|
||||
ESP_LOGV(TAG, " Max frequency for bit depth+1: %f", ledc_max_frequency_for_bit_depth(this->bit_depth_ + 1));
|
||||
ESP_LOGV(TAG, " Min frequency for bit depth+1: %f",
|
||||
ledc_min_frequency_for_bit_depth(this->bit_depth_ + 1, (this->frequency_ < 100)));
|
||||
ESP_LOGV(TAG, " Max res bits: %d", MAX_RES_BITS);
|
||||
ESP_LOGV(TAG, " Clock frequency: %f", CLOCK_FREQUENCY);
|
||||
LOG_PIN(" Pin ", this->pin_);
|
||||
ESP_LOGV(TAG,
|
||||
" Max frequency for bit depth: %f\n"
|
||||
" Min frequency for bit depth: %f\n"
|
||||
" Max frequency for bit depth-1: %f\n"
|
||||
" Min frequency for bit depth-1: %f\n"
|
||||
" Max frequency for bit depth+1: %f\n"
|
||||
" Min frequency for bit depth+1: %f\n"
|
||||
" Max res bits: %d\n"
|
||||
" Clock frequency: %f",
|
||||
ledc_max_frequency_for_bit_depth(this->bit_depth_),
|
||||
ledc_min_frequency_for_bit_depth(this->bit_depth_, (this->frequency_ < 100)),
|
||||
ledc_max_frequency_for_bit_depth(this->bit_depth_ - 1),
|
||||
ledc_min_frequency_for_bit_depth(this->bit_depth_ - 1, (this->frequency_ < 100)),
|
||||
ledc_max_frequency_for_bit_depth(this->bit_depth_ + 1),
|
||||
ledc_min_frequency_for_bit_depth(this->bit_depth_ + 1, (this->frequency_ < 100)), MAX_RES_BITS,
|
||||
CLOCK_FREQUENCY);
|
||||
}
|
||||
|
||||
void LEDCOutput::update_frequency(float frequency) {
|
||||
|
||||
@@ -22,9 +22,11 @@ struct NVSData {
|
||||
size_t len;
|
||||
|
||||
void set_data(const uint8_t *src, size_t size) {
|
||||
this->data = std::make_unique<uint8_t[]>(size);
|
||||
if (!this->data || this->len != size) {
|
||||
this->data = std::make_unique<uint8_t[]>(size);
|
||||
this->len = size;
|
||||
}
|
||||
memcpy(this->data.get(), src, size);
|
||||
this->len = size;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -31,9 +31,11 @@ void LibreTinyPWM::setup() {
|
||||
}
|
||||
|
||||
void LibreTinyPWM::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "PWM Output:");
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"PWM Output:\n"
|
||||
" Frequency: %.1f Hz",
|
||||
this->frequency_);
|
||||
LOG_PIN(" Pin ", this->pin_);
|
||||
ESP_LOGCONFIG(TAG, " Frequency: %.1f Hz", this->frequency_);
|
||||
}
|
||||
|
||||
void LibreTinyPWM::update_frequency(float frequency) {
|
||||
|
||||
@@ -66,6 +66,8 @@ void Logger::pre_setup() {
|
||||
void HOT Logger::write_msg_(const char *msg, size_t len) {
|
||||
// Single write with newline already in buffer (added by caller)
|
||||
#ifdef CONFIG_PRINTK
|
||||
// Requires the debug component and an active SWD connection.
|
||||
// It is used for pyocd rtt -t nrf52840
|
||||
k_str_out(const_cast<char *>(msg), len);
|
||||
#endif
|
||||
if (this->uart_dev_ == nullptr) {
|
||||
|
||||
@@ -26,9 +26,11 @@ void M5Stack8AngleComponent::setup() {
|
||||
}
|
||||
|
||||
void M5Stack8AngleComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "M5STACK_8ANGLE:");
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"M5STACK_8ANGLE:\n"
|
||||
" Firmware version: %d",
|
||||
this->fw_version_);
|
||||
LOG_I2C_DEVICE(this);
|
||||
ESP_LOGCONFIG(TAG, " Firmware version: %d ", this->fw_version_);
|
||||
}
|
||||
|
||||
float M5Stack8AngleComponent::read_knob_pos(uint8_t channel, AnalogBits bits) {
|
||||
|
||||
@@ -80,14 +80,14 @@ void MAX31865Sensor::setup() {
|
||||
|
||||
void MAX31865Sensor::dump_config() {
|
||||
LOG_SENSOR("", "MAX31865", this);
|
||||
LOG_PIN(" CS Pin: ", this->cs_);
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
" Reference Resistance: %.2fΩ\n"
|
||||
" RTD: %u-wire %.2fΩ\n"
|
||||
" Mains Filter: %s",
|
||||
reference_resistance_, rtd_wires_, rtd_nominal_resistance_,
|
||||
(filter_ == FILTER_60HZ ? "60 Hz" : (filter_ == FILTER_50HZ ? "50 Hz" : "Unknown!")));
|
||||
LOG_PIN(" CS Pin: ", this->cs_);
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
}
|
||||
|
||||
float MAX31865Sensor::get_setup_priority() const { return setup_priority::DATA; }
|
||||
|
||||
@@ -17,8 +17,10 @@ void MAX6956LedChannel::setup() {
|
||||
}
|
||||
|
||||
void MAX6956LedChannel::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "MAX6956 current:");
|
||||
ESP_LOGCONFIG(TAG, " MAX6956 pin: %d", this->pin_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"MAX6956 current:\n"
|
||||
" MAX6956 pin: %d",
|
||||
this->pin_);
|
||||
LOG_FLOAT_OUTPUT(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,11 @@ float MCP3204::get_setup_priority() const { return setup_priority::HARDWARE; }
|
||||
void MCP3204::setup() { this->spi_setup(); }
|
||||
|
||||
void MCP3204::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "MCP3204:");
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"MCP3204:\n"
|
||||
" Reference Voltage: %.2fV",
|
||||
this->reference_voltage_);
|
||||
LOG_PIN(" CS Pin:", this->cs_);
|
||||
ESP_LOGCONFIG(TAG, " Reference Voltage: %.2fV", this->reference_voltage_);
|
||||
}
|
||||
|
||||
float MCP3204::read_data(uint8_t pin, bool differential) {
|
||||
|
||||
@@ -11,8 +11,10 @@ float MCP3204Sensor::get_setup_priority() const { return setup_priority::DATA; }
|
||||
|
||||
void MCP3204Sensor::dump_config() {
|
||||
LOG_SENSOR("", "MCP3204 Sensor", this);
|
||||
ESP_LOGCONFIG(TAG, " Pin: %u", this->pin_);
|
||||
ESP_LOGCONFIG(TAG, " Differential Mode: %s", YESNO(this->differential_mode_));
|
||||
ESP_LOGCONFIG(TAG,
|
||||
" Pin: %u\n"
|
||||
" Differential Mode: %s",
|
||||
this->pin_, YESNO(this->differential_mode_));
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
}
|
||||
float MCP3204Sensor::sample() { return this->parent_->read_data(this->pin_, this->differential_mode_); }
|
||||
|
||||
@@ -63,12 +63,12 @@ void MCP9600Component::setup() {
|
||||
}
|
||||
|
||||
void MCP9600Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "MCP9600:");
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"MCP9600:\n"
|
||||
" Device ID: 0x%x",
|
||||
this->device_id_);
|
||||
LOG_I2C_DEVICE(this);
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
|
||||
ESP_LOGCONFIG(TAG, " Device ID: 0x%x", this->device_id_);
|
||||
|
||||
LOG_SENSOR(" ", "Hot Junction Temperature", this->hot_junction_sensor_);
|
||||
LOG_SENSOR(" ", "Cold Junction Temperature", this->cold_junction_sensor_);
|
||||
|
||||
|
||||
@@ -196,12 +196,12 @@ bool Modbus::parse_modbus_byte_(uint8_t byte) {
|
||||
}
|
||||
|
||||
void Modbus::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "Modbus:");
|
||||
LOG_PIN(" Flow Control Pin: ", this->flow_control_pin_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"Modbus:\n"
|
||||
" Send Wait Time: %d ms\n"
|
||||
" CRC Disabled: %s",
|
||||
this->send_wait_time_, YESNO(this->disable_crc_));
|
||||
LOG_PIN(" Flow Control Pin: ", this->flow_control_pin_);
|
||||
}
|
||||
float Modbus::get_setup_priority() const {
|
||||
// After UART bus
|
||||
|
||||
@@ -17,10 +17,12 @@ static const uint16_t MANUFACTURER_ID = 0x000D;
|
||||
static constexpr size_t MOPEKA_MAX_LOG_BYTES = 32;
|
||||
|
||||
void MopekaStdCheck::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "Mopeka Std Check");
|
||||
ESP_LOGCONFIG(TAG, " Propane Butane mix: %.0f%%", this->propane_butane_mix_ * 100);
|
||||
ESP_LOGCONFIG(TAG, " Tank distance empty: %" PRIi32 "mm", this->empty_mm_);
|
||||
ESP_LOGCONFIG(TAG, " Tank distance full: %" PRIi32 "mm", this->full_mm_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"Mopeka Std Check\n"
|
||||
" Propane Butane mix: %.0f%%\n"
|
||||
" Tank distance empty: %" PRIi32 "mm\n"
|
||||
" Tank distance full: %" PRIi32 "mm",
|
||||
this->propane_butane_mix_ * 100, this->empty_mm_, this->full_mm_);
|
||||
LOG_SENSOR(" ", "Level", this->level_);
|
||||
LOG_SENSOR(" ", "Temperature", this->temperature_);
|
||||
LOG_SENSOR(" ", "Battery Level", this->battery_level_);
|
||||
|
||||
@@ -166,10 +166,12 @@ void MQTTBackendESP32::mqtt_event_handler_(const Event &event) {
|
||||
case MQTT_EVENT_ERROR:
|
||||
ESP_LOGE(TAG, "MQTT_EVENT_ERROR");
|
||||
if (event.error_handle.error_type == MQTT_ERROR_TYPE_TCP_TRANSPORT) {
|
||||
ESP_LOGE(TAG, "Last error code reported from esp-tls: 0x%x", event.error_handle.esp_tls_last_esp_err);
|
||||
ESP_LOGE(TAG, "Last tls stack error number: 0x%x", event.error_handle.esp_tls_stack_err);
|
||||
ESP_LOGE(TAG, "Last captured errno : %d (%s)", event.error_handle.esp_transport_sock_errno,
|
||||
strerror(event.error_handle.esp_transport_sock_errno));
|
||||
ESP_LOGE(TAG,
|
||||
"Last error code reported from esp-tls: 0x%x\n"
|
||||
"Last tls stack error number: 0x%x\n"
|
||||
"Last captured errno : %d (%s)",
|
||||
event.error_handle.esp_tls_last_esp_err, event.error_handle.esp_tls_stack_err,
|
||||
event.error_handle.esp_transport_sock_errno, strerror(event.error_handle.esp_transport_sock_errno));
|
||||
} else if (event.error_handle.error_type == MQTT_ERROR_TYPE_CONNECTION_REFUSED) {
|
||||
ESP_LOGE(TAG, "Connection refused error: 0x%x", event.error_handle.connect_return_code);
|
||||
} else {
|
||||
|
||||
@@ -154,15 +154,17 @@ void MQTTClientComponent::on_log(uint8_t level, const char *tag, const char *mes
|
||||
|
||||
void MQTTClientComponent::dump_config() {
|
||||
char ip_buf[network::IP_ADDRESS_BUFFER_SIZE];
|
||||
// clang-format off
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"MQTT:\n"
|
||||
" Server Address: %s:%u (%s)\n"
|
||||
" Username: " LOG_SECRET("'%s'") "\n"
|
||||
" Client ID: " LOG_SECRET("'%s'") "\n"
|
||||
" Clean Session: %s",
|
||||
" Client ID: " LOG_SECRET("'%s'") "\n"
|
||||
" Clean Session: %s",
|
||||
this->credentials_.address.c_str(), this->credentials_.port, this->ip_.str_to(ip_buf),
|
||||
this->credentials_.username.c_str(), this->credentials_.client_id.c_str(),
|
||||
YESNO(this->credentials_.clean_session));
|
||||
// clang-format on
|
||||
if (this->is_discovery_ip_enabled()) {
|
||||
ESP_LOGCONFIG(TAG, " Discovery IP enabled");
|
||||
}
|
||||
|
||||
@@ -58,14 +58,14 @@ void MY9231OutputComponent::setup() {
|
||||
}
|
||||
}
|
||||
void MY9231OutputComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "MY9231:");
|
||||
LOG_PIN(" DI Pin: ", this->pin_di_);
|
||||
LOG_PIN(" DCKI Pin: ", this->pin_dcki_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"MY9231:\n"
|
||||
" Total number of channels: %u\n"
|
||||
" Number of chips: %u\n"
|
||||
" Bit depth: %u",
|
||||
this->num_channels_, this->num_chips_, this->bit_depth_);
|
||||
LOG_PIN(" DI Pin: ", this->pin_di_);
|
||||
LOG_PIN(" DCKI Pin: ", this->pin_dcki_);
|
||||
}
|
||||
void MY9231OutputComponent::loop() {
|
||||
if (!this->update_)
|
||||
|
||||
@@ -395,10 +395,8 @@ void OpenthermHub::dump_config() {
|
||||
this->write_initial_messages_(initial_messages);
|
||||
this->write_repeating_messages_(repeating_messages);
|
||||
|
||||
ESP_LOGCONFIG(TAG, "OpenTherm:");
|
||||
LOG_PIN(" In: ", this->in_pin_);
|
||||
LOG_PIN(" Out: ", this->out_pin_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"OpenTherm:\n"
|
||||
" Sync mode: %s\n"
|
||||
" Sensors: %s\n"
|
||||
" Binary sensors: %s\n"
|
||||
@@ -409,6 +407,8 @@ void OpenthermHub::dump_config() {
|
||||
YESNO(this->sync_mode_), SHOW(OPENTHERM_SENSOR_LIST(ID, )), SHOW(OPENTHERM_BINARY_SENSOR_LIST(ID, )),
|
||||
SHOW(OPENTHERM_SWITCH_LIST(ID, )), SHOW(OPENTHERM_INPUT_SENSOR_LIST(ID, )),
|
||||
SHOW(OPENTHERM_OUTPUT_LIST(ID, )), SHOW(OPENTHERM_NUMBER_LIST(ID, )));
|
||||
LOG_PIN(" In: ", this->in_pin_);
|
||||
LOG_PIN(" Out: ", this->out_pin_);
|
||||
ESP_LOGCONFIG(TAG, " Initial requests:");
|
||||
for (auto type : initial_messages) {
|
||||
ESP_LOGCONFIG(TAG, " - %d (%s)", type, this->opentherm_->message_id_to_str(type));
|
||||
|
||||
@@ -126,9 +126,12 @@ void OpenThreadComponent::ot_main() {
|
||||
ESP_LOGE(TAG, "Failed to set OpenThread linkmode.");
|
||||
}
|
||||
link_mode_config = otThreadGetLinkMode(esp_openthread_get_instance());
|
||||
ESP_LOGD(TAG, "Link Mode Device Type: %s", link_mode_config.mDeviceType ? "true" : "false");
|
||||
ESP_LOGD(TAG, "Link Mode Network Data: %s", link_mode_config.mNetworkData ? "true" : "false");
|
||||
ESP_LOGD(TAG, "Link Mode RX On When Idle: %s", link_mode_config.mRxOnWhenIdle ? "true" : "false");
|
||||
ESP_LOGD(TAG,
|
||||
"Link Mode Device Type: %s\n"
|
||||
"Link Mode Network Data: %s\n"
|
||||
"Link Mode RX On When Idle: %s",
|
||||
link_mode_config.mDeviceType ? "true" : "false", link_mode_config.mNetworkData ? "true" : "false",
|
||||
link_mode_config.mRxOnWhenIdle ? "true" : "false");
|
||||
|
||||
// Run the main loop
|
||||
#if CONFIG_OPENTHREAD_CLI
|
||||
@@ -144,8 +147,8 @@ void OpenThreadComponent::ot_main() {
|
||||
// Make sure the length is 0 so we fallback to the configuration
|
||||
dataset.mLength = 0;
|
||||
} else {
|
||||
ESP_LOGI(TAG, "Found OpenThread-managed dataset, ignoring esphome configuration");
|
||||
ESP_LOGI(TAG, "(set force_dataset: true to override)");
|
||||
ESP_LOGI(TAG, "Found OpenThread-managed dataset, ignoring esphome configuration\n"
|
||||
"(set force_dataset: true to override)");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -21,9 +21,11 @@ void PCF8574Component::loop() {
|
||||
this->reset_pin_cache_();
|
||||
}
|
||||
void PCF8574Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "PCF8574:");
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"PCF8574:\n"
|
||||
" Is PCF8575: %s",
|
||||
YESNO(this->pcf8575_));
|
||||
LOG_I2C_DEVICE(this)
|
||||
ESP_LOGCONFIG(TAG, " Is PCF8575: %s", YESNO(this->pcf8575_));
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
}
|
||||
|
||||
@@ -138,20 +138,21 @@ PIDAutotuner::PIDAutotuneResult PIDAutotuner::update(float setpoint, float proce
|
||||
}
|
||||
void PIDAutotuner::dump_config() {
|
||||
if (this->state_ == AUTOTUNE_SUCCEEDED) {
|
||||
ESP_LOGI(TAG, "%s: PID Autotune:", this->id_.c_str());
|
||||
ESP_LOGI(TAG, " State: Succeeded!");
|
||||
ESP_LOGI(TAG,
|
||||
"%s: PID Autotune:\n"
|
||||
" State: Succeeded!",
|
||||
this->id_.c_str());
|
||||
bool has_issue = false;
|
||||
if (!this->amplitude_detector_.is_amplitude_convergent()) {
|
||||
ESP_LOGW(TAG, " Could not reliably determine oscillation amplitude, PID parameters may be inaccurate!");
|
||||
ESP_LOGW(TAG, " Please make sure you eliminate all outside influences on the measured temperature.");
|
||||
ESP_LOGW(TAG, " Could not reliably determine oscillation amplitude, PID parameters may be inaccurate!\n"
|
||||
" Please make sure you eliminate all outside influences on the measured temperature.");
|
||||
has_issue = true;
|
||||
}
|
||||
if (!this->frequency_detector_.is_increase_decrease_symmetrical()) {
|
||||
ESP_LOGW(TAG, " Oscillation Frequency is not symmetrical. PID parameters may be inaccurate!");
|
||||
ESP_LOGW(
|
||||
TAG,
|
||||
" This is usually because the heat and cool processes do not change the temperature at the same rate.");
|
||||
ESP_LOGW(TAG,
|
||||
" Oscillation Frequency is not symmetrical. PID parameters may be inaccurate!\n"
|
||||
" This is usually because the heat and cool processes do not change the temperature at the same "
|
||||
"rate.\n"
|
||||
" Please try reducing the positive_output value (or increase negative_output in case of a cooler)");
|
||||
has_issue = true;
|
||||
}
|
||||
@@ -160,18 +161,23 @@ void PIDAutotuner::dump_config() {
|
||||
}
|
||||
|
||||
auto fac = get_ziegler_nichols_pid_();
|
||||
ESP_LOGI(TAG, " Calculated PID parameters (\"Ziegler-Nichols PID\" rule):");
|
||||
ESP_LOGI(TAG, " ");
|
||||
ESP_LOGI(TAG, " control_parameters:");
|
||||
ESP_LOGI(TAG, " kp: %.5f", fac.kp);
|
||||
ESP_LOGI(TAG, " ki: %.5f", fac.ki);
|
||||
ESP_LOGI(TAG, " kd: %.5f", fac.kd);
|
||||
ESP_LOGI(TAG, " ");
|
||||
ESP_LOGI(TAG, " Please copy these values into your YAML configuration! They will reset on the next reboot.");
|
||||
ESP_LOGI(TAG,
|
||||
" Calculated PID parameters (\"Ziegler-Nichols PID\" rule):\n"
|
||||
"\n"
|
||||
" control_parameters:\n"
|
||||
" kp: %.5f\n"
|
||||
" ki: %.5f\n"
|
||||
" kd: %.5f\n"
|
||||
"\n"
|
||||
" Please copy these values into your YAML configuration! They will reset on the next reboot.",
|
||||
fac.kp, fac.ki, fac.kd);
|
||||
|
||||
ESP_LOGV(TAG, " Oscillation Period: %f", this->frequency_detector_.get_mean_oscillation_period());
|
||||
ESP_LOGV(TAG, " Oscillation Amplitude: %f", this->amplitude_detector_.get_mean_oscillation_amplitude());
|
||||
ESP_LOGV(TAG, " Ku: %f, Pu: %f", this->ku_, this->pu_);
|
||||
ESP_LOGV(TAG,
|
||||
" Oscillation Period: %f\n"
|
||||
" Oscillation Amplitude: %f\n"
|
||||
" Ku: %f, Pu: %f",
|
||||
this->frequency_detector_.get_mean_oscillation_period(),
|
||||
this->amplitude_detector_.get_mean_oscillation_amplitude(), this->ku_, this->pu_);
|
||||
|
||||
ESP_LOGD(TAG, " Alternative Rules:");
|
||||
// http://www.mstarlabs.com/control/znrule.html
|
||||
@@ -183,13 +189,16 @@ void PIDAutotuner::dump_config() {
|
||||
}
|
||||
|
||||
if (this->state_ == AUTOTUNE_RUNNING) {
|
||||
ESP_LOGD(TAG, "%s: PID Autotune:", this->id_.c_str());
|
||||
ESP_LOGD(TAG, " Autotune is still running!");
|
||||
ESP_LOGD(TAG, " Status: Trying to reach %.2f °C", setpoint_ - relay_function_.current_target_error());
|
||||
ESP_LOGD(TAG, " Stats so far:");
|
||||
ESP_LOGD(TAG, " Phases: %" PRIu32, relay_function_.phase_count);
|
||||
ESP_LOGD(TAG, " Detected %zu zero-crossings", frequency_detector_.zerocrossing_intervals.size());
|
||||
ESP_LOGD(TAG, " Current Phase Min: %.2f, Max: %.2f", amplitude_detector_.phase_min,
|
||||
ESP_LOGD(TAG,
|
||||
"%s: PID Autotune:\n"
|
||||
" Autotune is still running!\n"
|
||||
" Status: Trying to reach %.2f °C\n"
|
||||
" Stats so far:\n"
|
||||
" Phases: %" PRIu32 "\n"
|
||||
" Detected %zu zero-crossings\n"
|
||||
" Current Phase Min: %.2f, Max: %.2f",
|
||||
this->id_.c_str(), setpoint_ - relay_function_.current_target_error(), relay_function_.phase_count,
|
||||
frequency_detector_.zerocrossing_intervals.size(), amplitude_detector_.phase_min,
|
||||
amplitude_detector_.phase_max);
|
||||
}
|
||||
}
|
||||
@@ -205,8 +214,10 @@ PIDAutotuner::PIDResult PIDAutotuner::calculate_pid_(float kp_factor, float ki_f
|
||||
}
|
||||
void PIDAutotuner::print_rule_(const char *name, float kp_factor, float ki_factor, float kd_factor) {
|
||||
auto fac = calculate_pid_(kp_factor, ki_factor, kd_factor);
|
||||
ESP_LOGD(TAG, " Rule '%s':", name);
|
||||
ESP_LOGD(TAG, " kp: %.5f, ki: %.5f, kd: %.5f", fac.kp, fac.ki, fac.kd);
|
||||
ESP_LOGD(TAG,
|
||||
" Rule '%s':\n"
|
||||
" kp: %.5f, ki: %.5f, kd: %.5f",
|
||||
name, fac.kp, fac.ki, fac.kd);
|
||||
}
|
||||
|
||||
// ================== RelayFunction ==================
|
||||
|
||||
@@ -31,8 +31,10 @@ void PN532::setup() {
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
ESP_LOGD(TAG, "Found chip PN5%02X", version_data[0]);
|
||||
ESP_LOGD(TAG, "Firmware ver. %d.%d", version_data[1], version_data[2]);
|
||||
ESP_LOGD(TAG,
|
||||
"Found chip PN5%02X\n"
|
||||
"Firmware ver. %d.%d",
|
||||
version_data[0], version_data[1], version_data[2]);
|
||||
|
||||
if (!this->write_command_({
|
||||
PN532_COMMAND_SAMCONFIGURATION,
|
||||
|
||||
@@ -240,8 +240,11 @@ uint8_t PN7150::reset_core_(const bool reset_config, const bool power) {
|
||||
return nfc::STATUS_FAILED;
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, "Configuration %s", rx.get_message()[nfc::NCI_PKT_PAYLOAD_OFFSET + 2] ? "reset" : "retained");
|
||||
ESP_LOGD(TAG, "NCI version: %s", rx.get_message()[nfc::NCI_PKT_PAYLOAD_OFFSET + 1] == 0x20 ? "2.0" : "1.0");
|
||||
ESP_LOGD(TAG,
|
||||
"Configuration %s\n"
|
||||
"NCI version: %s",
|
||||
rx.get_message()[nfc::NCI_PKT_PAYLOAD_OFFSET + 2] ? "reset" : "retained",
|
||||
rx.get_message()[nfc::NCI_PKT_PAYLOAD_OFFSET + 1] == 0x20 ? "2.0" : "1.0");
|
||||
|
||||
return nfc::STATUS_OK;
|
||||
}
|
||||
@@ -266,11 +269,13 @@ uint8_t PN7150::init_core_() {
|
||||
uint8_t flash_major_version = rx.get_message()[18 + rx.get_message()[8]];
|
||||
uint8_t flash_minor_version = rx.get_message()[19 + rx.get_message()[8]];
|
||||
|
||||
ESP_LOGD(TAG, "Manufacturer ID: 0x%02X", manf_id);
|
||||
ESP_LOGD(TAG, "Hardware version: 0x%02X", hw_version);
|
||||
ESP_LOGD(TAG, "ROM code version: 0x%02X", rom_code_version);
|
||||
ESP_LOGD(TAG, "FLASH major version: 0x%02X", flash_major_version);
|
||||
ESP_LOGD(TAG, "FLASH minor version: 0x%02X", flash_minor_version);
|
||||
ESP_LOGD(TAG,
|
||||
"Manufacturer ID: 0x%02X\n"
|
||||
"Hardware version: 0x%02X\n"
|
||||
"ROM code version: 0x%02X\n"
|
||||
"FLASH major version: 0x%02X\n"
|
||||
"FLASH minor version: 0x%02X",
|
||||
manf_id, hw_version, rom_code_version, flash_major_version, flash_minor_version);
|
||||
|
||||
return rx.get_simple_status_response();
|
||||
}
|
||||
@@ -847,8 +852,8 @@ void PN7150::process_rf_intf_activated_oid_(nfc::NciMessage &rx) { // an endpoi
|
||||
|
||||
case EP_WRITE:
|
||||
if (this->next_task_message_to_write_ != nullptr) {
|
||||
ESP_LOGD(TAG, " Tag writing");
|
||||
ESP_LOGD(TAG, " Tag formatting");
|
||||
ESP_LOGD(TAG, " Tag writing\n"
|
||||
" Tag formatting");
|
||||
if (this->format_endpoint_(working_endpoint.tag->get_uid()) != nfc::STATUS_OK) {
|
||||
ESP_LOGE(TAG, " Tag could not be formatted for writing");
|
||||
} else {
|
||||
|
||||
@@ -262,9 +262,12 @@ uint8_t PN7160::reset_core_(const bool reset_config, const bool power) {
|
||||
return nfc::STATUS_FAILED;
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, "Configuration %s", rx.get_message()[4] ? "reset" : "retained");
|
||||
ESP_LOGD(TAG, "NCI version: %s", rx.get_message()[5] == 0x20 ? "2.0" : "1.0");
|
||||
ESP_LOGD(TAG, "Manufacturer ID: 0x%02X", rx.get_message()[6]);
|
||||
ESP_LOGD(TAG,
|
||||
"Configuration %s\n"
|
||||
"NCI version: %s\n"
|
||||
"Manufacturer ID: 0x%02X",
|
||||
rx.get_message()[4] ? "reset" : "retained", rx.get_message()[5] == 0x20 ? "2.0" : "1.0",
|
||||
rx.get_message()[6]);
|
||||
rx.get_message().erase(rx.get_message().begin(), rx.get_message().begin() + 8);
|
||||
ESP_LOGD(TAG, "Manufacturer info: %s", nfc::format_bytes(rx.get_message()).c_str());
|
||||
|
||||
@@ -291,11 +294,13 @@ uint8_t PN7160::init_core_() {
|
||||
uint8_t flash_minor_version = rx.get_message()[20 + rx.get_message()[8]];
|
||||
std::vector<uint8_t> features(rx.get_message().begin() + 4, rx.get_message().begin() + 8);
|
||||
|
||||
ESP_LOGD(TAG, "Hardware version: %u", hw_version);
|
||||
ESP_LOGD(TAG, "ROM code version: %u", rom_code_version);
|
||||
ESP_LOGD(TAG, "FLASH major version: %u", flash_major_version);
|
||||
ESP_LOGD(TAG, "FLASH minor version: %u", flash_minor_version);
|
||||
ESP_LOGD(TAG, "Features: %s", nfc::format_bytes(features).c_str());
|
||||
ESP_LOGD(TAG,
|
||||
"Hardware version: %u\n"
|
||||
"ROM code version: %u\n"
|
||||
"FLASH major version: %u\n"
|
||||
"FLASH minor version: %u\n"
|
||||
"Features: %s",
|
||||
hw_version, rom_code_version, flash_major_version, flash_minor_version, nfc::format_bytes(features).c_str());
|
||||
|
||||
return rx.get_simple_status_response();
|
||||
}
|
||||
@@ -871,8 +876,8 @@ void PN7160::process_rf_intf_activated_oid_(nfc::NciMessage &rx) { // an endpoi
|
||||
|
||||
case EP_WRITE:
|
||||
if (this->next_task_message_to_write_ != nullptr) {
|
||||
ESP_LOGD(TAG, " Tag writing");
|
||||
ESP_LOGD(TAG, " Tag formatting");
|
||||
ESP_LOGD(TAG, " Tag writing\n"
|
||||
" Tag formatting");
|
||||
if (this->format_endpoint_(working_endpoint.tag->get_uid()) != nfc::STATUS_OK) {
|
||||
ESP_LOGE(TAG, " Tag could not be formatted for writing");
|
||||
} else {
|
||||
|
||||
@@ -68,8 +68,10 @@ bool HwPulseCounterStorage::pulse_counter_setup(InternalGPIOPin *pin) {
|
||||
next_pcnt_channel = pcnt_channel_t(int(next_pcnt_channel) + 1);
|
||||
}
|
||||
|
||||
ESP_LOGCONFIG(TAG, " PCNT Unit Number: %u", this->pcnt_unit);
|
||||
ESP_LOGCONFIG(TAG, " PCNT Channel Number: %u", this->pcnt_channel);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
" PCNT Unit Number: %u\n"
|
||||
" PCNT Channel Number: %u",
|
||||
this->pcnt_unit, this->pcnt_channel);
|
||||
|
||||
pcnt_count_mode_t rising = PCNT_COUNT_DIS, falling = PCNT_COUNT_DIS;
|
||||
switch (this->rising_edge_mode) {
|
||||
|
||||
@@ -127,9 +127,11 @@ bool QMP6988Component::get_calibration_data_() {
|
||||
qmp6988_data_.qmp6988_cali.COE_b21 = (int16_t) encode_uint16(a_data_uint8_tr[14], a_data_uint8_tr[15]);
|
||||
qmp6988_data_.qmp6988_cali.COE_bp3 = (int16_t) encode_uint16(a_data_uint8_tr[16], a_data_uint8_tr[17]);
|
||||
|
||||
ESP_LOGV(TAG, "<-----------calibration data-------------->\r\n");
|
||||
ESP_LOGV(TAG, "COE_a0[%d] COE_a1[%d] COE_a2[%d] COE_b00[%d]\r\n", qmp6988_data_.qmp6988_cali.COE_a0,
|
||||
qmp6988_data_.qmp6988_cali.COE_a1, qmp6988_data_.qmp6988_cali.COE_a2, qmp6988_data_.qmp6988_cali.COE_b00);
|
||||
ESP_LOGV(TAG,
|
||||
"<-----------calibration data-------------->\n"
|
||||
"COE_a0[%d] COE_a1[%d] COE_a2[%d] COE_b00[%d]",
|
||||
qmp6988_data_.qmp6988_cali.COE_a0, qmp6988_data_.qmp6988_cali.COE_a1, qmp6988_data_.qmp6988_cali.COE_a2,
|
||||
qmp6988_data_.qmp6988_cali.COE_b00);
|
||||
ESP_LOGV(TAG, "COE_bt1[%d] COE_bt2[%d] COE_bp1[%d] COE_b11[%d]\r\n", qmp6988_data_.qmp6988_cali.COE_bt1,
|
||||
qmp6988_data_.qmp6988_cali.COE_bt2, qmp6988_data_.qmp6988_cali.COE_bp1, qmp6988_data_.qmp6988_cali.COE_b11);
|
||||
ESP_LOGV(TAG, "COE_bp2[%d] COE_b12[%d] COE_b21[%d] COE_bp3[%d]\r\n", qmp6988_data_.qmp6988_cali.COE_bp2,
|
||||
@@ -150,9 +152,10 @@ bool QMP6988Component::get_calibration_data_() {
|
||||
qmp6988_data_.ik.b12 = 6846L * (int64_t) qmp6988_data_.qmp6988_cali.COE_b12 + 85590281L; // 29Q53
|
||||
qmp6988_data_.ik.b21 = 13836L * (int64_t) qmp6988_data_.qmp6988_cali.COE_b21 + 79333336L; // 29Q60
|
||||
qmp6988_data_.ik.bp3 = 2915L * (int64_t) qmp6988_data_.qmp6988_cali.COE_bp3 + 157155561L; // 28Q65
|
||||
ESP_LOGV(TAG, "<----------- int calibration data -------------->\r\n");
|
||||
ESP_LOGV(TAG, "a0[%d] a1[%d] a2[%d] b00[%d]\r\n", qmp6988_data_.ik.a0, qmp6988_data_.ik.a1, qmp6988_data_.ik.a2,
|
||||
qmp6988_data_.ik.b00);
|
||||
ESP_LOGV(TAG,
|
||||
"<----------- int calibration data -------------->\n"
|
||||
"a0[%d] a1[%d] a2[%d] b00[%d]",
|
||||
qmp6988_data_.ik.a0, qmp6988_data_.ik.a1, qmp6988_data_.ik.a2, qmp6988_data_.ik.b00);
|
||||
ESP_LOGV(TAG, "bt1[%lld] bt2[%lld] bp1[%lld] b11[%lld]\r\n", qmp6988_data_.ik.bt1, qmp6988_data_.ik.bt2,
|
||||
qmp6988_data_.ik.bp1, qmp6988_data_.ik.b11);
|
||||
ESP_LOGV(TAG, "bp2[%lld] b12[%lld] b21[%lld] bp3[%lld]\r\n", qmp6988_data_.ik.bp2, qmp6988_data_.ik.b12,
|
||||
@@ -330,8 +333,10 @@ void QMP6988Component::dump_config() {
|
||||
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
|
||||
ESP_LOGCONFIG(TAG, " Temperature Oversampling: %s", oversampling_to_str(this->temperature_oversampling_));
|
||||
LOG_SENSOR(" ", "Pressure", this->pressure_sensor_);
|
||||
ESP_LOGCONFIG(TAG, " Pressure Oversampling: %s", oversampling_to_str(this->pressure_oversampling_));
|
||||
ESP_LOGCONFIG(TAG, " IIR Filter: %s", iir_filter_to_str(this->iir_filter_));
|
||||
ESP_LOGCONFIG(TAG,
|
||||
" Pressure Oversampling: %s\n"
|
||||
" IIR Filter: %s",
|
||||
oversampling_to_str(this->pressure_oversampling_), iir_filter_to_str(this->iir_filter_));
|
||||
}
|
||||
|
||||
void QMP6988Component::update() {
|
||||
|
||||
@@ -216,12 +216,14 @@ void QspiDbi::write_sequence_(const std::vector<uint8_t> &vec) {
|
||||
void QspiDbi::dump_config() {
|
||||
ESP_LOGCONFIG("", "QSPI_DBI Display");
|
||||
ESP_LOGCONFIG("", "Model: %s", this->model_);
|
||||
ESP_LOGCONFIG(TAG, " Height: %u", this->height_);
|
||||
ESP_LOGCONFIG(TAG, " Width: %u", this->width_);
|
||||
ESP_LOGCONFIG(TAG, " Draw rounding: %u", this->draw_rounding_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
" Height: %u\n"
|
||||
" Width: %u\n"
|
||||
" Draw rounding: %u\n"
|
||||
" SPI Data rate: %uMHz",
|
||||
this->height_, this->width_, this->draw_rounding_, (unsigned) (this->data_rate_ / 1000000));
|
||||
LOG_PIN(" CS Pin: ", this->cs_);
|
||||
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
||||
ESP_LOGCONFIG(TAG, " SPI Data rate: %dMHz", (unsigned) (this->data_rate_ / 1000000));
|
||||
}
|
||||
|
||||
} // namespace qspi_dbi
|
||||
|
||||
@@ -118,10 +118,11 @@ void RadonEyeRD200::read_sensors_(uint8_t *value, uint16_t value_len) {
|
||||
radon_long_term_sensor_->publish_state(radon_day);
|
||||
}
|
||||
|
||||
ESP_LOGV(TAG, " Measurements (Bq/m³) now: %0.03f, day: %0.03f, month: %0.03f", radon_now, radon_day, radon_month);
|
||||
|
||||
ESP_LOGV(TAG, " Measurements (pCi/L) now: %0.03f, day: %0.03f, month: %0.03f", radon_now / convert_to_bwpm3,
|
||||
radon_day / convert_to_bwpm3, radon_month / convert_to_bwpm3);
|
||||
ESP_LOGV(TAG,
|
||||
" Measurements (Bq/m³) now: %0.03f, day: %0.03f, month: %0.03f\n"
|
||||
" Measurements (pCi/L) now: %0.03f, day: %0.03f, month: %0.03f",
|
||||
radon_now, radon_day, radon_month, radon_now / convert_to_bwpm3, radon_day / convert_to_bwpm3,
|
||||
radon_month / convert_to_bwpm3);
|
||||
|
||||
// This instance must not stay connected
|
||||
// so other clients can connect to it (e.g. the
|
||||
|
||||
@@ -104,8 +104,10 @@ void ProntoProtocol::send_pronto_(RemoteTransmitData *dst, const std::vector<uin
|
||||
|
||||
uint16_t intros = 2 * data[2];
|
||||
uint16_t repeats = 2 * data[3];
|
||||
ESP_LOGD(TAG, "Send Pronto: intros=%d", intros);
|
||||
ESP_LOGD(TAG, "Send Pronto: repeats=%d", repeats);
|
||||
ESP_LOGD(TAG,
|
||||
"Send Pronto: intros=%d\n"
|
||||
"Send Pronto: repeats=%d",
|
||||
intros, repeats);
|
||||
if (NUMBERS_IN_PREAMBLE + intros + repeats != data.size()) { // inconsistent sizes
|
||||
ESP_LOGE(TAG, "Inconsistent data, not sending");
|
||||
return;
|
||||
|
||||
@@ -76,9 +76,8 @@ void RemoteReceiverComponent::setup() {
|
||||
}
|
||||
|
||||
void RemoteReceiverComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "Remote Receiver:");
|
||||
LOG_PIN(" Pin: ", this->pin_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"Remote Receiver:\n"
|
||||
" Buffer Size: %u\n"
|
||||
" Tolerance: %u%s\n"
|
||||
" Filter out pulses shorter than: %u us\n"
|
||||
@@ -86,6 +85,7 @@ void RemoteReceiverComponent::dump_config() {
|
||||
this->buffer_size_, this->tolerance_,
|
||||
(this->tolerance_mode_ == remote_base::TOLERANCE_MODE_TIME) ? " us" : "%", this->filter_us_,
|
||||
this->idle_us_);
|
||||
LOG_PIN(" Pin: ", this->pin_);
|
||||
}
|
||||
|
||||
void RemoteReceiverComponent::loop() {
|
||||
|
||||
@@ -117,9 +117,8 @@ void RemoteReceiverComponent::setup() {
|
||||
}
|
||||
|
||||
void RemoteReceiverComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "Remote Receiver:");
|
||||
LOG_PIN(" Pin: ", this->pin_);
|
||||
ESP_LOGCONFIG(TAG,
|
||||
"Remote Receiver:\n"
|
||||
" Clock resolution: %" PRIu32 " hz\n"
|
||||
" RMT symbols: %" PRIu32 "\n"
|
||||
" Filter symbols: %" PRIu32 "\n"
|
||||
@@ -132,6 +131,7 @@ void RemoteReceiverComponent::dump_config() {
|
||||
this->clock_resolution_, this->rmt_symbols_, this->filter_symbols_, this->receive_symbols_,
|
||||
this->tolerance_, (this->tolerance_mode_ == remote_base::TOLERANCE_MODE_TIME) ? " us" : "%",
|
||||
this->carrier_frequency_, this->carrier_duty_percent_, this->filter_us_, this->idle_us_);
|
||||
LOG_PIN(" Pin: ", this->pin_);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, "Configuring RMT driver failed: %s (%s)", esp_err_to_name(this->error_code_),
|
||||
this->error_string_.c_str());
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user