|
|
@@ -1,6 +1,7 @@
|
|
|
#pragma once
|
|
|
|
|
|
#include <cstdint>
|
|
|
+#include <cstdio>
|
|
|
|
|
|
#include "esphome/core/gpio.h"
|
|
|
#include "esphome/core/hal.h"
|
|
|
@@ -168,6 +169,19 @@ class CycleEngine {
|
|
|
}
|
|
|
|
|
|
void write_command_(uint8_t cmd, const uint8_t *data, uint8_t data_len) {
|
|
|
+#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_DEBUG
|
|
|
+ // Command-level skeleton trace - deliberately left in (not gated to
|
|
|
+ // VERY_VERBOSE) while diagnosing a real-hardware content bug: this is
|
|
|
+ // the exact byte-for-byte counterpart to compare against a captured
|
|
|
+ // epaper_spi trace on the same panel. Bulk plane data isn't logged
|
|
|
+ // here (see step_write_plane_) - only the command skeleton matters for
|
|
|
+ // that comparison.
|
|
|
+ char buf[32];
|
|
|
+ int n = 0;
|
|
|
+ for (uint8_t i = 0; i < data_len && n < (int) sizeof(buf) - 3; i++)
|
|
|
+ n += snprintf(buf + n, sizeof(buf) - n, "%02X ", data[i]);
|
|
|
+ ESP_LOGD("gxepd2", "cmd 0x%02X data[%u]: %s", cmd, data_len, buf);
|
|
|
+#endif
|
|
|
this->write_byte_(cmd, false);
|
|
|
for (uint8_t i = 0; i < data_len; i++)
|
|
|
this->write_byte_(data[i], true);
|
|
|
@@ -227,8 +241,12 @@ class CycleEngine {
|
|
|
static constexpr uint32_t BYTE_BUDGET = 64;
|
|
|
|
|
|
void step_write_plane_() {
|
|
|
- if (this->cursor_ == 0)
|
|
|
+ if (this->cursor_ == 0) {
|
|
|
+ ESP_LOGD("gxepd2", "plane %u: cmd 0x%02X, %u bytes, invert=%d", this->plane_,
|
|
|
+ this->desc_->plane_write_cmd[this->plane_], (unsigned) this->plane_bytes_,
|
|
|
+ this->desc_->plane_invert[this->plane_]);
|
|
|
this->write_byte_(this->desc_->plane_write_cmd[this->plane_], false);
|
|
|
+ }
|
|
|
const uint8_t *buf = this->planes_[this->plane_];
|
|
|
bool invert = this->desc_->plane_invert[this->plane_];
|
|
|
uint32_t end = this->cursor_ + BYTE_BUDGET;
|