Skip to content

Commit 9402106

Browse files
author
Your Name
committed
falling back to e-ink v1 for now
1 parent 2e38b5f commit 9402106

File tree

2 files changed

+10
-52
lines changed

2 files changed

+10
-52
lines changed

components/display/waveshare2in9/display.cpp

+9-51
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ Display::Display()
5959
void Display::start() {
6060
prettyClean();
6161

62-
// if (epd_.Init(/*lut_partial_update*/) != 0) {
63-
// ESP_LOGE(TAG, "e-Paper init failed");
64-
// return;
65-
// }
62+
if (epd_.Init(lut_partial_update) != 0) {
63+
ESP_LOGE(TAG, "e-Paper init failed");
64+
return;
65+
}
6666

6767
start_execution(TAG);
6868
}
@@ -112,31 +112,14 @@ void Display::draw() {
112112
std::chrono::system_clock::now();
113113
#endif
114114

115-
// epd_.SetFrameMemory(front_, 0, 0, epd_.width, epd_.height);
116-
117-
static int cnt = 0;
118-
const int msg_size = 128;
119-
char message[msg_size];
120-
121-
cnt++;
122-
123-
snprintf(message, msg_size, "%d %d %d", cnt, 10 * cnt + cnt, rand());
124-
125-
paint_.SetWidth(128);
126-
paint_.SetHeight(296);
127-
paint_.SetRotate(ROTATE_90);
128-
129-
paint_.Clear(UNCOLORED);
130-
paint_.DrawStringAt(0, 0, message, &Font24, COLORED);
131-
epd_.SetFrameMemory_Partial(paint_.GetImage(), 0, 0, paint_.GetWidth(), paint_.GetHeight());
115+
epd_.SetFrameMemory(front_, 0, 0, epd_.width, epd_.height);
132116

133117
#if defined(PERF)
134118
std::chrono::time_point<std::chrono::system_clock> after_set_frame =
135119
std::chrono::system_clock::now();
136120
#endif
137121

138-
epd_.DisplayFrame_Partial();
139-
// epd_.DisplayFrame();
122+
epd_.DisplayFrame();
140123

141124
std::chrono::time_point<std::chrono::system_clock> after_display =
142125
std::chrono::system_clock::now();
@@ -174,40 +157,15 @@ void Display::prepareCanvas(const Rect& rect) {
174157
}
175158

176159
void Display::prettyClean() {
177-
if (epd_.Init(/*lut_full_update*/) != 0) {
160+
if (epd_.Init(lut_full_update) != 0) {
178161
ESP_LOGE(TAG, "e-Paper initialization failed");
179162
return;
180163
}
181164

182165
epd_.ClearFrameMemory(0xFF);
183166
epd_.DisplayFrame();
184-
// epd_.ClearFrameMemory(0xFF);
185-
// epd_.DisplayFrame();
186-
187-
paint_.SetRotate(ROTATE_90);
188-
paint_.SetWidth(128);
189-
paint_.SetHeight(296);
190-
191-
// /* For simplicity, the arguments are explicit numerical coordinates */
192-
// paint_.Clear(COLORED);
193-
// paint_.DrawStringAt(0, 4, "Hello world!", &Font12, UNCOLORED);
194-
// epd_.SetFrameMemory(paint_.GetImage(), 0, 10, paint_.GetWidth(), paint_.GetHeight());
195-
196-
// paint_.Clear(UNCOLORED);
197-
// paint_.DrawStringAt(0, 4, "e-Paper Demo", &Font24, COLORED);
198-
// epd_.SetFrameMemory_Partial(paint_.GetImage(), 0, 0, paint_.GetWidth(),
199-
// paint_.GetHeight());
200-
// epd_.DisplayFrame();
201-
// epd_.DisplayFrame_Partial();
202-
203-
// paint_.SetWidth(32);
204-
// paint_.SetHeight(96);
205-
// paint_.SetRotate(ROTATE_90);
206-
207-
// paint_.Clear(UNCOLORED);
208-
// paint_.DrawStringAt(0, 4, "TESTO", &Font24, COLORED);
209-
// epd_.SetFrameMemory_Partial(paint_.GetImage(), 80, 72, paint_.GetWidth(),
210-
// paint_.GetHeight()); epd_.DisplayFrame_Partial();
167+
epd_.ClearFrameMemory(0xFF);
168+
epd_.DisplayFrame();
211169
}
212170

213171
void Display::swapBuffers() {

components/display/waveshare2in9/display.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class Display : public AbstractTask, public IDisplay {
8181
protected:
8282
static constexpr const char *TAG = "Display";
8383

84-
EpdV2 epd_;
84+
Epd epd_;
8585

8686
std::uint8_t *front_;
8787
std::uint8_t *back_;

0 commit comments

Comments
 (0)