@@ -214,22 +214,22 @@ void Adafruit_UC8151D::displayPartial(uint16_t x1, uint16_t y1, uint16_t x2, uin
214
214
case 0 :
215
215
EPD_swap (x1, y1);
216
216
EPD_swap (x2, y2);
217
- y1 = WIDTH - y1;
218
- y2 = WIDTH - y2;
217
+ y1 = WIDTH - y1 - 1 ;
218
+ y2 = WIDTH - y2 - 1 ;
219
219
break ;
220
220
case 1 :
221
221
break ;
222
222
case 2 :
223
223
EPD_swap (x1, y1);
224
224
EPD_swap (x2, y2);
225
- x1 = HEIGHT - x1;
226
- x2 = HEIGHT - x2;
225
+ x1 = HEIGHT - x1 - 1 ;
226
+ x2 = HEIGHT - x2 - 1 ;
227
227
break ;
228
228
case 3 :
229
- y1 = WIDTH - y1;
230
- y2 = WIDTH - y2;
231
- x1 = HEIGHT - x1;
232
- x2 = HEIGHT - x2;
229
+ y1 = WIDTH - y1 - 1 ;
230
+ y2 = WIDTH - y2 - 1 ;
231
+ x1 = HEIGHT - x1 - 1 ;
232
+ x2 = HEIGHT - x2 - 1 ;
233
233
}
234
234
if (x1 > x2)
235
235
EPD_swap (x1, x2);
@@ -247,11 +247,6 @@ void Adafruit_UC8151D::displayPartial(uint16_t x1, uint16_t y1, uint16_t x2, uin
247
247
Serial.println(y2);
248
248
*/
249
249
250
- // x1 and x2 must be on byte boundaries
251
- x1 -= x1 % 8 ; // round down;
252
- x2 = (x2 + 7 ) & ~0b111 ; // round up
253
-
254
-
255
250
// backup & change init to the partial code
256
251
const uint8_t *init_code_backup = _epd_init_code;
257
252
const uint8_t *lut_code_backup = _epd_lut_code;
@@ -271,44 +266,28 @@ void Adafruit_UC8151D::displayPartial(uint16_t x1, uint16_t y1, uint16_t x2, uin
271
266
EPD_command (UC8151D_PTIN);
272
267
273
268
buf[0 ] = x1;
274
- buf[1 ] = x2- 1 ;
269
+ buf[1 ] = x2;
275
270
buf[2 ] = y1 >> 8 ;
276
271
buf[3 ] = y1 & 0xFF ;
277
- buf[4 ] = (y2- 1 ) >> 8 ;
278
- buf[5 ] = (y2- 1 ) & 0xFF ;
272
+ buf[4 ] = (y2) >> 8 ;
273
+ buf[5 ] = (y2) & 0xFF ;
279
274
buf[6 ] = 0x28 ;
280
275
281
276
EPD_command (UC8151D_PTL, buf, 7 ); // resolution setting
282
277
283
- Serial.printf (" Buffer=1 %04x: " , &buffer1);
284
- Serial.printf (" Buffer=2 %04x: " , &buffer2);
285
-
286
278
// buffer 1 has the old data from the last update
287
279
if (use_sram) {
288
280
if (partialsSinceLastFullUpdate == 0 ) {
289
281
// first partial update
290
- Serial.println (" Erasing SRAM buffer 1" );
291
282
sram.erase (buffer1_addr, buffer1_size, 0xFF );
292
283
}
293
284
writeSRAMFramebufferToEPD (buffer1_addr, buffer1_size, 0 , true );
294
285
} else {
295
286
if (partialsSinceLastFullUpdate == 0 ) {
296
287
// first partial update
297
- Serial.println (" Erasing RAM buffer 1" );
298
288
memset (buffer1, 0xFF , buffer1_size);
299
289
}
300
290
301
- /*
302
- Serial.println("Buffer 1)");
303
- for (uint16_t i = 0; i < buffer1_size; i++) {
304
- uint8_t d = buffer1[i];
305
- Serial.printf("%02x", d);
306
- if ((i+1) % (WIDTH/8) == 0)
307
- Serial.println();
308
- }
309
- Serial.println();
310
- */
311
-
312
291
writeRAMFramebufferToEPD (buffer1, buffer1_size, 0 , true );
313
292
}
314
293
0 commit comments