Skip to content

Commit 231d305

Browse files
committed
Saving progress, ready for optimizing current
1 parent 3f02d95 commit 231d305

File tree

2 files changed

+46
-10
lines changed

2 files changed

+46
-10
lines changed

examples/Inkplate6COLOR/Advanced/DeepSleep/Inkplate6COLOR_Simple_Deep_Sleep/Inkplate6COLOR_Simple_Deep_Sleep.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ const uint8_t *pictures[] = {picture1, picture2,
3232
// so we can easly select it by selecting index in array
3333

3434
#define uS_TO_S_FACTOR 1000000 // Conversion factor for micro seconds to seconds
35-
#define TIME_TO_SLEEP 120 // How long ESP32 will be in deep sleep (in seconds)
35+
#define TIME_TO_SLEEP 600 // How long ESP32 will be in deep sleep (in seconds)
3636
RTC_DATA_ATTR int slide = 0;
3737

3838
Inkplate display; // Create an object on Inkplate library and also set library into 3 Bit mode (gray)
3939

4040
void setup()
4141
{
4242
Serial.begin(115200);
43-
Serial.println("about begin..."); Serial.flush();
43+
Serial.println("about to begin..."); Serial.flush();
4444
display.begin(); // Init Inkplate library (you should call this function ONLY ONCE)
4545
display.clearDisplay(); // Clear frame buffer of display
4646
display.drawImage(
@@ -65,6 +65,9 @@ void setup()
6565

6666

6767
// Put ESP32 into deep sleep. Program stops here.
68+
delay(3000);
69+
Serial.println("just before deep sleep start aaa!");
70+
Serial.flush();
6871
esp_deep_sleep_start();
6972
}
7073

src/boards/Inkplate6Color.cpp

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ void Inkplate::setIOExpanderForLowPower()
363363

364364
// Battery voltage Switch MOSFET
365365
pinModeInternal(IO_INT_ADDR, ioRegsInt, IO_PIN_B1, OUTPUT);
366+
digitalWriteInternal(IO_INT_ADDR, ioRegsInt, IO_PIN_B1, LOW);
366367

367368
// Rest of pins go to OUTPUT LOW state because in deepSleep mode they are
368369
// using least amount of power
@@ -395,16 +396,48 @@ void Inkplate::setIOExpanderForLowPower()
395396

396397
void Inkplate::sleepColorPanel()
397398
{
398-
// First wake the panel
399-
setPanelDeepSleep(false);
399+
Serial.println("In sleep colorpanel!");
400+
401+
delay(3000);
402+
Serial.println("JUST BEFORE SET PANEL DEEP SLEEP FALSE!");
403+
Serial.flush();
404+
405+
setPanelDeepSleep(false); // First, wake the panel back up
406+
407+
delay(3000);
408+
Serial.println("JUST BEFORE SENDING SLEEP STUFF!");
409+
Serial.flush();
400410

401-
// Now send the sleep command delay(10);
411+
// put the panel to sleep via command
412+
delay(10);
402413
sendCommand(DEEP_SLEEP_REGISTER);
403414
sendData(0xA5);
404-
delay(100);
405-
digitalWrite(EPAPER_DC_PIN, LOW);
406-
digitalWrite(EPAPER_CS_PIN, LOW);
407-
digitalWrite(EPAPER_RST_PIN, HIGH); // Make sure this is HIGH so the display is on
408-
gpio_deep_sleep_hold_en(); // Make sure RST pin stays high during sleep
415+
delay(100); // Wait a bit until it's surely in sleep
416+
417+
delay(3000);
418+
Serial.println("JUST BEFORE SDCARD SLEEP!");
419+
Serial.flush();
420+
421+
422+
// Make sure the SD card is in sleep
423+
sdCardSleep();
424+
delay(10);
425+
426+
delay(3000);
427+
Serial.println("JUST BEFORE WRITING HIGH RST PIN!");
428+
Serial.flush();
429+
430+
431+
digitalWrite(EPAPER_RST_PIN, HIGH);
432+
433+
delay(3000);
434+
Serial.println("just before sleep hold en!");
435+
Serial.flush();
436+
437+
gpio_deep_sleep_hold_en(); // Make sure RST pin stays high during sleep
438+
439+
delay(3000);
440+
Serial.println("just after sleep hold en!");
441+
Serial.flush();
409442
}
410443
#endif

0 commit comments

Comments
 (0)