Explorar o código

Fix CycleEngine's own plane_bytes_ to respect packed_2bpp_plane

It recomputed width*height/8 unconditionally in request_full_update(),
ignoring the descriptor flag GxEPD2Display's own (correct) width*height/4
sizing already accounted for - meant only the first half of a packed 4-
color buffer was ever clocked out before the engine jumped straight to
REFRESH_CMD. Found auditing the code after a real-hardware bring-up
problem on GDEY029F51, not yet confirmed as the cause of that problem.
ZiB hai 1 mes
pai
achega
12fbe73a5f
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      components/gxepd2/cycle_engine.h

+ 3 - 1
components/gxepd2/cycle_engine.h

@@ -56,7 +56,9 @@ class CycleEngine {
   void request_full_update(const uint8_t *plane0, const uint8_t *plane1) {
     this->planes_[0] = plane0;
     this->planes_[1] = plane1;
-    this->plane_bytes_ = (static_cast<uint32_t>(this->desc_->width) * this->desc_->height) / 8;
+    this->plane_bytes_ = this->desc_->packed_2bpp_plane
+                              ? (static_cast<uint32_t>(this->desc_->width) * this->desc_->height) / 4
+                              : (static_cast<uint32_t>(this->desc_->width) * this->desc_->height) / 8;
     this->cursor_ = 0;
     this->cmd_phase_ = CmdPhase::BEFORE_DELAY;
     this->set_state_(this->rst_ != nullptr ? State::RESET_LOW : State::INIT_CMD);