Skip to content

Commit 0fd256b

Browse files
committed
Added setPanelDeepSleep function in all examples that uses deep sleep
1 parent 5229097 commit 0fd256b

File tree

15 files changed

+65
-38
lines changed

15 files changed

+65
-38
lines changed

examples/Inkplate2/Advanced/DeepSleep/Inkplate2_RTC_Alarm_With_Deep_Sleep/Inkplate2_RTC_Alarm_With_Deep_Sleep.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,6 @@ void deepSleep()
162162
// Put the panel in the deep sleep
163163
display.setPanelDeepSleep(0);
164164

165-
// Start deep sleep (this function does not return)
165+
// Start deep sleep (this function does not return). Program stops here.
166166
esp_deep_sleep_start();
167167
}

examples/Inkplate2/Advanced/DeepSleep/Inkplate2_Simple_Deep_Sleep/Inkplate2_Simple_Deep_Sleep.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ void setup()
5252

5353
// rtc_gpio_isolate(GPIO_NUM_12); // Isolate/disable GPIO12 on ESP32 (only to reduce power consumption in sleep)
5454
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR); // Activate wake-up timer -- wake up after 20s here
55-
esp_deep_sleep_start(); // Put ESP32 into deep sleep. Program stops here.
55+
56+
display.setPanelDeepSleep(0); // Put the panel into deep sleep
57+
esp_deep_sleep_start(); // Put ESP32 into deep sleep. Program stops here.
5658
}
5759

5860
void loop()

examples/Inkplate2/Advanced/Other/Inkplate2_Picture_From_RAM/Inkplate2_Picture_From_RAM.ino

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ void setup()
5050
display.drawImage(picture3, 0, 0, 212, 104); // Display selected picture at location X=0, Y=0.
5151
display.display(); // Refresh the screen with new picture
5252

53-
// Go to deep sleep
53+
// Put the panel to deep sleep
54+
display.setPanelDeepSleep(0);
55+
56+
// Put ESP32 into deep sleep. Program stops here
5457
esp_deep_sleep_start();
5558
}
5659

5760

5861
void loop()
5962
{
60-
// Nothing! If you use deep sleep, whole program should be in setup() because each time the board restarts, not in a
61-
// loop()! loop() must be empty!
63+
// Nothing!
6264
}

examples/Inkplate2/Advanced/RTC/Inkplate2_RTC_Alarm_Periodic/Inkplate2_RTC_Alarm_Periodic.ino

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,18 @@ void setup()
9292

9393
rtc.setWakeUpTimer(wakeHours, wakeMinutes, currentTime);
9494

95-
// Start sleep, this function never returns
95+
// Put the panel in deep sleep
96+
display.setPanelDeepSleep(0);
97+
98+
// Start sleep, this function never returns, program stops here
9699
esp_deep_sleep_start();
97100
}
98101
}
99102

100103
void loop()
101104
{
102-
// Nothing. Loop must be empty!
105+
// Never here! If you are using deep sleep, the whole program should be in setup() because the board restarts each
106+
// time. loop() must be empty!
103107
}
104108

105109
void waitingScreen()

examples/Inkplate2/Advanced/WEB_WiFi/Inkplate2_Show_Pictures_From_Web/Inkplate2_Show_Pictures_From_Web.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ void setup()
144144

145145
// Go to deep sleep
146146
Serial.println("Going to sleep..");
147-
esp_deep_sleep_start();
147+
display.setPanelDeepSleep(0); // Put the panel to deep sleep
148+
esp_deep_sleep_start(); // Put ESP32 into deep sleep. Program stops here
148149
}
149150

150151
void loop()

examples/Inkplate2/Projects/Inkplate2_Clock/Inkplate2_Clock.ino

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,15 @@ void setup()
8484

8585
// Go to sleep before checking again
8686
// rtc_gpio_isolate(GPIO_NUM_12); // Isolate/disable GPIO12 on ESP32 (only to reduce power consumption in sleep)
87-
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
88-
esp_deep_sleep_start();
87+
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR); // Activate wake-up timer
88+
display.setPanelDeepSleep(0); // Put the panel into deep sleep
89+
esp_deep_sleep_start(); // Put ESP32 into deep sleep. Program stops here.
8990
}
9091

9192
void loop()
9293
{
93-
// Never here
94+
// Never here! If you are using deep sleep, the whole program should be in setup() because the board restarts each
95+
// time. loop() must be empty!
9496
}
9597
// Function to draw time
9698
void drawTime()

examples/Inkplate2/Projects/Inkplate2_Crypto_Currency_Tracker/Inkplate2_Crypto_Currency_Tracker.ino

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,21 @@ void setup()
126126

127127
// Our main drawing function
128128
drawAll();
129+
129130
// Refresh
130131
display.display();
131132

132133
// Go to sleep before checking again
133134
// rtc_gpio_isolate(GPIO_NUM_12); // Isolate/disable GPIO12 on ESP32 (only to reduce power consumption in sleep)
134-
esp_sleep_enable_timer_wakeup(1000ll * DELAY_MS);
135-
esp_deep_sleep_start();
135+
esp_sleep_enable_timer_wakeup(1000ll * DELAY_MS); // Activate wake-up timer
136+
display.setPanelDeepSleep(0); // Put the panel into deep sleep
137+
esp_deep_sleep_start(); // Put ESP32 into deep sleep. Program stops here
136138
}
137139

138140
void loop()
139141
{
140-
// Never here
142+
// Never here! If you are using deep sleep, the whole program should be in setup() because the board restarts each
143+
// time. loop() must be empty!
141144
}
142145

143146
void getCurrencyData()

examples/Inkplate2/Projects/Inkplate2_Daily_Weather_Station/Inkplate2_Daily_Weather_Station.ino

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ String apiKey = "";
4242
#define WAKEUP 30 * 60 * 1000 // The time that ESP will be in deep sleep - refresh weather every 30 minutes
4343

4444
Inkplate display;
45-
4645
Network network;
4746

4847
struct tm timeinfo; // Current time info -> human-readable
@@ -93,9 +92,9 @@ void setup()
9392

9493
// Go to deep sleep
9594
Serial.println("Going to deep sleep, bye");
96-
esp_sleep_enable_timer_wakeup(1000LL * WAKEUP);
97-
display.setPanelDeepSleep(0);
98-
(void)esp_deep_sleep_start();
95+
esp_sleep_enable_timer_wakeup(1000LL * WAKEUP); // Activate wake-up timer
96+
display.setPanelDeepSleep(0); // Put the panel into deep sleep
97+
(void)esp_deep_sleep_start(); // Put ESP32 into deep sleep. Program stops here.
9998
}
10099

101100

examples/Inkplate2/Projects/Inkplate2_Google_Calendar/Inkplate2_Google_Calendar.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ void setup()
128128
// rtc_gpio_isolate(GPIO_NUM_12); // Isolate/disable GPIO12 on ESP32 (only to reduce power consumption in sleep)
129129
esp_sleep_enable_timer_wakeup(1000L * DELAY_MS); // Enable wake up while sleep is enabled after 4 minutes
130130
// 1000L * is here because function accepts microseconds
131-
esp_deep_sleep_start();
131+
display.setPanelDeepSleep(0); // Put the panel into deep sleep
132+
esp_deep_sleep_start(); // Put ESP32 into deep sleep. Program stops here
132133
}
133134

134135
/**
@@ -138,7 +139,8 @@ void setup()
138139
*/
139140
void loop()
140141
{
141-
// Never here
142+
// Never here! If you are using deep sleep, the whole program should be in setup() because the board restarts each
143+
// time. loop() must be empty!
142144
}
143145

144146
/**

examples/Inkplate2/Projects/Inkplate2_Hourly_Weather_Station/Inkplate2_Hourly_Weather_Station.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,15 @@ void setup()
120120

121121
// Go to sleep before checking again
122122
// rtc_gpio_isolate(GPIO_NUM_12); // Isolate/disable GPIO12 on ESP32 (only to reduce power consumption in sleep)
123-
esp_sleep_enable_timer_wakeup(1000L * DELAY_MS);
124-
esp_deep_sleep_start();
123+
esp_sleep_enable_timer_wakeup(1000L * DELAY_MS); // Activate wake-up timer
124+
display.setPanelDeepSleep(0); // Put the panel into deep sleep
125+
esp_deep_sleep_start(); // Put ESP32 into deep sleep. Program stops here
125126
}
126127

127128
void loop()
128129
{
130+
// Never here! If you are using deep sleep, the whole program should be in setup() because the board restarts each
131+
// time. loop() must be empty!
129132
}
130133

131134
// Function for drawing temperatures

0 commit comments

Comments
 (0)