|
|
@@ -137,6 +137,20 @@ class CycleEngine {
|
|
|
ESP_LOGD("gxepd2", "Display update finished");
|
|
|
this->set_state_(State::IDLE);
|
|
|
return;
|
|
|
+
|
|
|
+ case State::ABORTED:
|
|
|
+ // A busy timeout means the panel isn't behaving as wired/expected
|
|
|
+ // (unplugged, dead, wrong busy polarity, ...) - pressing ahead
|
|
|
+ // with the rest of the sequence (more command bytes, another
|
|
|
+ // busy-wait) is very unlikely to "just work" and only obscures
|
|
|
+ // which step actually failed. Bail the whole cycle here instead of
|
|
|
+ // continuing to whatever state the timed-out wait was headed to.
|
|
|
+ ESP_LOGE("gxepd2", "Aborting display update: busy timeout");
|
|
|
+ this->cursor_ = 0;
|
|
|
+ this->plane_ = 0;
|
|
|
+ this->cmd_phase_ = CmdPhase::BEFORE_DELAY;
|
|
|
+ this->set_state_(State::IDLE);
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -155,6 +169,7 @@ class CycleEngine {
|
|
|
POST_DELAY,
|
|
|
WAIT_BUSY,
|
|
|
DONE,
|
|
|
+ ABORTED,
|
|
|
};
|
|
|
enum class CmdPhase { BEFORE_DELAY, ISSUE };
|
|
|
|
|
|
@@ -295,7 +310,7 @@ class CycleEngine {
|
|
|
}
|
|
|
if (millis() >= this->busy_wait_deadline_) {
|
|
|
ESP_LOGW("gxepd2", "Busy timeout waiting for panel");
|
|
|
- this->set_state_(this->busy_wait_next_);
|
|
|
+ this->set_state_(State::ABORTED);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -338,6 +353,8 @@ class CycleEngine {
|
|
|
return "WAIT_BUSY";
|
|
|
case State::DONE:
|
|
|
return "DONE";
|
|
|
+ case State::ABORTED:
|
|
|
+ return "ABORTED";
|
|
|
}
|
|
|
return "?";
|
|
|
}
|