|
|
|
@@ -399,11 +399,21 @@ void EInkDisplay::copyGrayscaleBuffers(const uint8_t* lsbBuffer, const uint8_t*
|
|
|
|
#ifdef EINK_DISPLAY_SINGLE_BUFFER_MODE
|
|
|
|
#ifdef EINK_DISPLAY_SINGLE_BUFFER_MODE
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* In single buffer mode, this should be called with the previously written BW buffer
|
|
|
|
* In single buffer mode, this should be called with the previously written BW buffer
|
|
|
|
* to reconstruct the RED buffer for proper differential fast refreshes following a
|
|
|
|
* to restore proper BW state after a grayscale display.
|
|
|
|
* grayscale display.
|
|
|
|
*
|
|
|
|
|
|
|
|
* The approach: Don't call grayscaleRevert() at all. Instead, just sync the RAMs with
|
|
|
|
|
|
|
|
* BW data and clear the grayscale mode flag. The physical pixels will stay in their
|
|
|
|
|
|
|
|
* current grayscale states, but subsequent refreshes will naturally transition them
|
|
|
|
|
|
|
|
* as the new BW content is displayed.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void EInkDisplay::cleanupGrayscaleBuffers(const uint8_t* bwBuffer) {
|
|
|
|
void EInkDisplay::cleanupGrayscaleBuffers(const uint8_t* bwBuffer) {
|
|
|
|
|
|
|
|
// Clear grayscale mode - we don't want grayscaleRevert to be called later
|
|
|
|
|
|
|
|
// because the RAMs won't have valid grayscale data anymore
|
|
|
|
|
|
|
|
inGrayscaleMode = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Sync both RAMs with BW content for proper fast refresh behavior
|
|
|
|
setRamArea(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT);
|
|
|
|
setRamArea(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT);
|
|
|
|
|
|
|
|
writeRamBuffer(CMD_WRITE_RAM_BW, bwBuffer, BUFFER_SIZE);
|
|
|
|
writeRamBuffer(CMD_WRITE_RAM_RED, bwBuffer, BUFFER_SIZE);
|
|
|
|
writeRamBuffer(CMD_WRITE_RAM_RED, bwBuffer, BUFFER_SIZE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
@@ -416,8 +426,7 @@ void EInkDisplay::displayBuffer(RefreshMode mode) {
|
|
|
|
|
|
|
|
|
|
|
|
// If currently in grayscale mode, revert first to black/white
|
|
|
|
// If currently in grayscale mode, revert first to black/white
|
|
|
|
if (inGrayscaleMode) {
|
|
|
|
if (inGrayscaleMode) {
|
|
|
|
inGrayscaleMode = false;
|
|
|
|
grayscaleRevert(); // grayscaleRevert() sets inGrayscaleMode = false internally
|
|
|
|
grayscaleRevert();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Set up full screen RAM area
|
|
|
|
// Set up full screen RAM area
|
|
|
|
@@ -477,8 +486,7 @@ void EInkDisplay::displayWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
|
|
|
|
|
|
|
|
|
|
|
|
// displayWindow is not supported while the rest of the screen has grayscale content, revert it
|
|
|
|
// displayWindow is not supported while the rest of the screen has grayscale content, revert it
|
|
|
|
if (inGrayscaleMode) {
|
|
|
|
if (inGrayscaleMode) {
|
|
|
|
inGrayscaleMode = false;
|
|
|
|
grayscaleRevert(); // grayscaleRevert() sets inGrayscaleMode = false internally
|
|
|
|
grayscaleRevert();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Calculate window buffer size
|
|
|
|
// Calculate window buffer size
|
|
|
|
|