Skip to content

Commit

Permalink
fix: paged fastmode for GDEP015OC1 and GDE029A1
Browse files Browse the repository at this point in the history
An obscure bug. setWindow() was breaking fastmode support for two very old displays. The controller IC moves the contents of "new" RAM to "old" RAM, requiring both sections to be re-written in the fastmode secondpass. In the newer displays, this behavior of moving the image is disabled by default.
  • Loading branch information
todd-herbert committed Feb 27, 2024
1 parent d9c49af commit 2beb1d4
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 32 deletions.
4 changes: 3 additions & 1 deletion src/Displays/GDE029A1/GDE029A1.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ class GDE029A1 : public BaseDisplay {
private:
void configFull(); // Configure panel to use full refresh
void configPartial(); // Configure panel to use partial refresh
void configPingPong(); // Enable Ping-Pong - single pass partial refresh for Uno
void activate(); // Command sequence to trigger display update

// Display specific formatting of memory locations
void calculateMemoryArea( int16_t &sx, int16_t &sy, int16_t &ex, int16_t &ey,
int16_t region_left, int16_t region_top, int16_t region_right, int16_t region_bottom );

void endImageTxQuiet(); // SPI command for this controller is different from BaseDisplay
void sendImageData(); // Need to write old AND new buffer in fastmode secondpass
};
50 changes: 50 additions & 0 deletions src/Displays/GDE029A1/hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,54 @@ void GDE029A1::activate() {

// Block while the command runs
wait();
}

void GDE029A1::endImageTxQuiet() {
sendCommand(0xFF); // Terminate frame write without update
wait();
return;
}

// Prepare display controller to receive image data, then transfer
void GDE029A1::sendImageData() {

// IF Fastmode OFF
// -------------
if (fastmode_state == OFF) {

// Send black
sendCommand(0x24); // Write "NEW" memory
for (uint16_t i = 0; i < pagefile_length; i++)
sendData(page_black[i]);

sendCommand(0x26); // Write "OLD" memory
for (uint16_t i = 0; i < pagefile_length; i++)
sendData(page_black[i]);

}

// IF Fastmode ON - first pass
// OR Fastmode TURBO
// -------------------------
else if (!fastmode_secondpass) {
// Send black
sendCommand(0x24); // Write "NEW" memory
for (uint16_t i = 0; i < pagefile_length; i++)
sendData(page_black[i]);
}

// IF Fastmode OFF - second pass
// ----------------------------
else {
// Send black data to "OLD" memory, for differential update
sendCommand(0x26);
for (uint16_t i = 0; i < pagefile_length; i++)
sendData(page_black[i]);

// Display's controller moves NEW mem into OLD at update
// so we need to refill it now, in case of setWindow() / fastmodeOff()
sendCommand(0x24); // Write "NEW" memory, AGAIN
for (uint16_t i = 0; i < pagefile_length; i++)
sendData(page_black[i]);
}
}
14 changes: 0 additions & 14 deletions src/Displays/GDE029A1/mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,3 @@ void GDE029A1::configPartial() {

wait();
}

void GDE029A1::configPingPong() {
sendCommand(0x37); // "Write Register for Display Option"
sendData(0x00); // Ping-Pong mode. Image writes to black ram,
sendData(0x00); // display updates, then image is copied to red ram.
sendData(0x00); // On next image, red ram is used as a mask,
sendData(0x00); // To determine which parts of new black ram
sendData(0x00); // should not be set to white...
sendData(0x40);
sendData(0x00);
sendData(0x00);
sendData(0x00);
sendData(0x00);
}
6 changes: 4 additions & 2 deletions src/Displays/GDEP015OC1/GDEP015OC1.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ class GDEP015OC1 : public BaseDisplay {
private:
void configFull(); // Configure panel to use full refresh
void configPartial(); // Configure panel to use partial refresh
void configPingPong(); // Enable Ping-Pong - single pass partial refresh for Uno
void activate(); // Command sequence to trigger display update

// Display specific formatting of memory locations
void calculateMemoryArea( int16_t &sx, int16_t &sy, int16_t &ex, int16_t &ey,
int16_t region_left, int16_t region_top, int16_t region_right, int16_t region_bottom );
int16_t region_left, int16_t region_top, int16_t region_right, int16_t region_bottom );

void endImageTxQuiet(); // SPI command for this controller is different from BaseDisplay
void sendImageData(); // Need to write old AND new buffer in fastmode secondpass
};
51 changes: 51 additions & 0 deletions src/Displays/GDEP015OC1/hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,55 @@ void GDEP015OC1::activate() {

// Block while the command runs
wait();
}


void GDEP015OC1::endImageTxQuiet() {
sendCommand(0xFF); // Terminate frame write without update
wait();
return;
}

// Prepare display controller to receive image data, then transfer
void GDEP015OC1::sendImageData() {

// IF Fastmode OFF
// -------------
if (fastmode_state == OFF) {

// Send black
sendCommand(0x24); // Write "NEW" memory
for (uint16_t i = 0; i < pagefile_length; i++)
sendData(page_black[i]);

sendCommand(0x26); // Write "OLD" memory
for (uint16_t i = 0; i < pagefile_length; i++)
sendData(page_black[i]);

}

// IF Fastmode ON - first pass
// OR Fastmode TURBO
// -------------------------
else if (!fastmode_secondpass) {
// Send black
sendCommand(0x24); // Write "NEW" memory
for (uint16_t i = 0; i < pagefile_length; i++)
sendData(page_black[i]);
}

// IF Fastmode OFF - second pass
// ----------------------------
else {
// Send black data to "OLD" memory, for differential update
sendCommand(0x26);
for (uint16_t i = 0; i < pagefile_length; i++)
sendData(page_black[i]);

// Display's controller moves NEW mem into OLD at update
// so we need to refill it now, in case of setWindow() / fastmodeOff()
sendCommand(0x24); // Write "NEW" memory, AGAIN
for (uint16_t i = 0; i < pagefile_length; i++)
sendData(page_black[i]);
}
}
16 changes: 1 addition & 15 deletions src/Displays/GDEP015OC1/mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,4 @@ void GDEP015OC1::configPartial() {
sendData(pgm_read_byte_near(lut_partial + i));

wait();
}

void GDEP015OC1::configPingPong() {
sendCommand(0x37); // "Write Register for Display Option"
sendData(0x00); // Ping-Pong mode. Image writes to black ram,
sendData(0x00); // display updates, then image is copied to red ram.
sendData(0x00); // On next image, red ram is used as a mask,
sendData(0x00); // To determine which parts of new black ram
sendData(0x00); // should not be set to white...
sendData(0x40);
sendData(0x00);
sendData(0x00);
sendData(0x00);
sendData(0x00);
}
}

0 comments on commit 2beb1d4

Please sign in to comment.