diff --git a/esp_idf/Spectra6/main/Spectra6.cpp b/esp_idf/Spectra6/main/Spectra6.cpp index 52d11fb..79c4c79 100644 --- a/esp_idf/Spectra6/main/Spectra6.cpp +++ b/esp_idf/Spectra6/main/Spectra6.cpp @@ -37,6 +37,16 @@ extern "C" void app_main(void) bbep.writePlane(); bbep.refresh(REFRESH_FULL); bbep.sleep(1); // deep sleep + vTaskDelay(200); // wait 2 seconds +// try different content + bbep.fillScreen(BBEP_YELLOW); + bbep.setTextColor(BBEP_GREEN); + bbep.setCursor(200, 300); + bbep.print("Second time is broken?"); + bbep.writePlane(); + bbep.refresh(REFRESH_FULL); + bbep.sleep(1); + while (1) { vTaskDelay(1); } diff --git a/esp_idf/esp_generic.inl b/esp_idf/esp_generic.inl index 912f9cf..212a401 100644 --- a/esp_idf/esp_generic.inl +++ b/esp_idf/esp_generic.inl @@ -200,6 +200,14 @@ void bbepWriteCmd(BBEPDISP *pBBEP, uint8_t cmd) // if it's asleep, it can't receive commands bbepWakeUp(pBBEP); pBBEP->is_awake = 1; + if (pBBEP->iFlags & BBEP_7COLOR) { // need to send before you can send it data + bbepSendCMDSequence(pBBEP, pBBEP->pInitFull); + if (pBBEP->iFlags & BBEP_SPLIT_BUFFER) { // dual cable EPD + pBBEP->iCSPin = pBBEP->iCS2Pin; + bbepSendCMDSequence(pBBEP, pBBEP->pInitFull); // second controller + pBBEP->iCSPin = pBBEP->iCS1Pin; + } + } } digitalWrite(pBBEP->iDCPin, LOW); delay(1); @@ -281,8 +289,15 @@ void bbepInitIO(BBEPDISP *pBBEP, uint8_t u8DC, uint8_t u8RST, uint8_t u8BUSY, ui assert(ret==ESP_OK); if (pBBEP->iFlags & BBEP_7COLOR) { // need to send before you can send it data + pBBEP->is_awake = 1; bbepSendCMDSequence(pBBEP, pBBEP->pInitFull); + if (pBBEP->iFlags & BBEP_SPLIT_BUFFER) { + // Send the same sequence to the second controller + pBBEP->iCSPin = pBBEP->iCS2Pin; + bbepSendCMDSequence(pBBEP, pBBEP->pInitFull); + pBBEP->iCSPin = pBBEP->iCS1Pin; + } } -} /* spi_init() */ +} /* bbepInitIO() */ #endif // __ESP_IDF_IO__ diff --git a/src/arduino_io.inl b/src/arduino_io.inl index 71e09e0..09e9fd7 100644 --- a/src/arduino_io.inl +++ b/src/arduino_io.inl @@ -66,7 +66,14 @@ void bbepInitIO(BBEPDISP *pBBEP, uint8_t u8DC, uint8_t u8RST, uint8_t u8BUSY, ui SPI.beginTransaction(SPISettings(u32Speed, MSBFIRST, SPI_MODE0)); SPI.endTransaction(); // N.B. - if you call beginTransaction() again without a matching endTransaction(), it will hang on ESP32 if (pBBEP->iFlags & BBEP_7COLOR) { // need to send before you can send it data + pBBEP->is_awake = 1; bbepSendCMDSequence(pBBEP, pBBEP->pInitFull); + if (pBBEP->iFlags & BBEP_SPLIT_BUFFER) { + // Send the same sequence to the second controller + pBBEP->iCSPin = pBBEP->iCS2Pin; + bbepSendCMDSequence(pBBEP, pBBEP->pInitFull); + pBBEP->iCSPin = pBBEP->iCS1Pin; + } } } /* bbepInitIO() */ diff --git a/src/bb_ep.inl b/src/bb_ep.inl index 9dd6fb0..070d089 100644 --- a/src/bb_ep.inl +++ b/src/bb_ep.inl @@ -1725,6 +1725,11 @@ void bbepSleep(BBEPDISP *pBBEP, int bDeep) if (pBBEP->chip_type == BBEP_CHIP_UC81xx) { if (pBBEP->iFlags & BBEP_7COLOR) { bbepCMD2(pBBEP, UC8151_POFF, 0x00); // power off + if (pBBEP->iFlags & BBEP_SPLIT_BUFFER) { // dual cable EPD + pBBEP->iCSPin = pBBEP->iCS2Pin; + bbepCMD2(pBBEP, UC8151_POFF, 0x00); // second controller + pBBEP->iCSPin = pBBEP->iCS1Pin; + } } else { bbepCMD2(pBBEP, UC8151_CDI, 0x17); // border floating bbepWriteCmd(pBBEP, UC8151_POFF); // power off