@@ -104,9 +104,6 @@ void Adafruit_UC8151D::begin(bool reset) {
104
104
setBlackBuffer (1 , true ); // black defaults to inverted
105
105
setColorBuffer (0 , true ); // red defaults to inverted
106
106
107
- Serial.printf (" Buffer1 %04x: " , &buffer1);
108
- Serial.printf (" Buffer2 %04x: " , &buffer2);
109
-
110
107
powerDown ();
111
108
}
112
109
@@ -255,13 +252,12 @@ void Adafruit_UC8151D::displayPartial(uint16_t x1, uint16_t y1, uint16_t x2, uin
255
252
256
253
#ifdef EPD_DEBUG
257
254
Serial.println (" Powering Up Partial" );
255
+ Serial.print (" Partials since last full update: " );
256
+ Serial.println (partialsSinceLastFullUpdate);
258
257
#endif
259
258
260
259
powerUp ();
261
260
262
- Serial.print (" Partials since last full update: " );
263
- Serial.println (partialsSinceLastFullUpdate);
264
-
265
261
// This command makes the display enter partial mode
266
262
EPD_command (UC8151D_PTIN);
267
263
@@ -305,32 +301,22 @@ void Adafruit_UC8151D::displayPartial(uint16_t x1, uint16_t y1, uint16_t x2, uin
305
301
Serial.println (" Update" );
306
302
#endif
307
303
update ();
308
-
304
+
305
+ // Serial.println("Partial, saving old data to secondary buffer");
309
306
if (use_sram) {
310
- Serial.println (" MEME FIX" );
311
- while (1 );
307
+ uint32_t remaining = buffer1_size;
308
+ uint32_t offset = 0 ;
309
+ uint8_t mcp_buf[16 ];
310
+ while (remaining) {
311
+ uint8_t to_xfer = min (sizeof (mcp_buf), remaining);
312
+
313
+ sram.read (buffer2_addr+offset, mcp_buf, to_xfer);
314
+ sram.write (buffer1_addr+offset, mcp_buf, to_xfer);
315
+ offset += to_xfer;
316
+ remaining -= to_xfer;
317
+ }
312
318
} else {
313
- Serial.println (" Partial, saving old data to secondary buffer" );
314
319
memcpy (buffer1, buffer2, buffer1_size); // buffer1 has the backup
315
-
316
- /*
317
- Serial.println("Buffer 1");
318
- for (uint16_t i = 0; i < buffer1_size; i++) {
319
- uint8_t d = buffer1[i];
320
- Serial.printf("%02x", d);
321
- if ((i+1) % (WIDTH/8) == 0)
322
- Serial.println();
323
- }
324
- Serial.println();
325
- Serial.println("Buffer 2");
326
- for (uint16_t i = 0; i < buffer2_size; i++) {
327
- uint8_t d = buffer2[i];
328
- Serial.printf("%02x", d);
329
- if ((i+1) % (WIDTH/8) == 0)
330
- Serial.println();
331
- }
332
- */
333
- Serial.println ();
334
320
}
335
321
336
322
partialsSinceLastFullUpdate++;
0 commit comments