Skip to content

Commit 0b26d43

Browse files
committed
Add setPanelDeepSleep(0) in each example that uses deep sleep
it's not tested on the Inkplate that works properly! Only RTC alarm with deep sleep had around 20 uA, others had 350 uA deep sleep current
1 parent c5f1912 commit 0b26d43

File tree

14 files changed

+115
-38
lines changed

14 files changed

+115
-38
lines changed

examples/Inkplate6COLOR/Advanced/DeepSleep/Inkplate6COLOR_RTC_Alarm_With_Deep_Sleep/Inkplate6COLOR_RTC_Alarm_With_Deep_Sleep.ino

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
This example will show you how to use RTC alarm interrupt with deep sleep.
99
Inkplate features RTC chip with interrupt for alarm connected to GPIO39
10-
Inkplate board will wake up every 10 seconds, refresh screen and go back to sleep.
10+
Inkplate board will wake up every 60 seconds, refresh screen and go back to sleep.
1111
1212
Want to learn more about Inkplate? Visit www.inkplate.io
1313
Looking to get support? Write on our forums: https://forum.soldered.com/
@@ -43,12 +43,15 @@ void setup()
4343
printCurrentTime(); // Display current time and date
4444
display.display();
4545

46-
display.rtcSetAlarmEpoch(display.rtcGetEpoch() + 60, RTC_ALARM_MATCH_DHHMMSS); // Set RTC alarm 10 seconds from now
46+
display.rtcSetAlarmEpoch(display.rtcGetEpoch() + 60, RTC_ALARM_MATCH_DHHMMSS); // Set RTC alarm 60 seconds from now
4747

4848
// Enable wakup from deep sleep on gpio 39 where RTC interrupt is connected
4949
esp_sleep_enable_ext0_wakeup(GPIO_NUM_39, 0);
5050

51-
// Go to sleep
51+
// Put the panel in the deep sleep
52+
display.setPanelDeepSleep(0);
53+
54+
// Start deep sleep (this function does not return). Program stops here.
5255
esp_deep_sleep_start();
5356
}
5457

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,14 @@ void setup()
5353
// Uncomment this line if your Inkplate is older than Aug 2021 as older Inkplates have ESP32 wrover-e chips
5454
// rtc_gpio_isolate(GPIO_NUM_12); // Isolate/disable GPIO12 on ESP32 (only to reduce power consumption in sleep)
5555

56-
display.setPanelDeepSleep(false);
57-
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR); // Activate wake-up timer -- wake up after 20s here
58-
esp_deep_sleep_start(); // Put ESP32 into deep sleep. Program stops here.
56+
// Activate wake-up timer -- wake up after 20s here
57+
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
58+
59+
// Put the panel in the deep sleep
60+
display.setPanelDeepSleep(0);
61+
62+
// Put ESP32 into deep sleep. Program stops here.
63+
esp_deep_sleep_start();
5964
}
6065

6166
void loop()

examples/Inkplate6COLOR/Advanced/DeepSleep/Inkplate6COLOR_Wake_Up_Button/Inkplate6COLOR_Wake_Up_Button.ino

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,28 @@
2929
Inkplate display;
3030

3131
// Store int in rtc data, to remain persistent during deep sleep
32-
RTC_DATA_ATTR int bootCount = 0;
32+
//RTC_DATA_ATTR int bootCount = 0;
3333

3434
void setup()
3535
{
3636
display.begin();
37-
display.setTextColor(INKPLATE_BLACK);
37+
//display.setTextColor(INKPLATE_BLACK);
3838

39-
++bootCount;
39+
//++bootCount;
4040

4141
// Our function declared below
42-
displayInfo();
42+
//displayInfo();
4343

4444
// Go to sleep for TIME_TO_SLEEP seconds
45-
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
45+
//esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
4646

4747
// Enable wakeup from deep sleep on gpio 36 (wake button)
48-
esp_sleep_enable_ext0_wakeup(GPIO_NUM_36, LOW);
48+
//esp_sleep_enable_ext0_wakeup(GPIO_NUM_36, 0);
4949

50-
// Go to sleep
50+
// Put the panel in the deep sleep
51+
//display.setPanelDeepSleep(0);
52+
53+
// Start deep sleep (this function does not return). Program stops here.
5154
esp_deep_sleep_start();
5255
}
5356

@@ -56,7 +59,7 @@ void loop()
5659
// Never here! If you use deep sleep, the whole program should be in setup() because the board restarts each
5760
// time. loop() must be empty!
5861
}
59-
62+
/*
6063
// Function that will write number of boots and boot reason to screen
6164
void displayInfo()
6265
{
@@ -90,4 +93,4 @@ void displayInfo()
9093
}
9194
9295
display.display();
93-
}
96+
}*/

examples/Inkplate6COLOR/Diagnostics/Inkplate6COLOR_Gallery/Inkplate6COLOR_Gallery.ino

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,19 @@ void setup()
8080

8181
// Go to sleep for DELAY_MS
8282
esp_sleep_enable_timer_wakeup(1000L * DELAY_MS);
83+
84+
// Put the panel in the deep sleep
85+
display.setPanelDeepSleep(0);
86+
87+
// Put SD card into deep sleep
88+
display.sdCardSleep();
89+
90+
// Start deep sleep (this function does not return). Program stops here.
8391
(void)esp_deep_sleep_start();
8492
}
8593

8694
void loop()
8795
{
88-
// Nothing...
96+
// Never here! If you are using deep sleep, the whole program should be in setup() because the board restarts each
97+
// time. loop() must be empty!
8998
}

examples/Inkplate6COLOR/Diagnostics/Inkplate6COLOR_Mapbox_API/Inkplate6COLOR_Mapbox_API.ino

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
#include "Inkplate.h"
2222

23-
#define ssid "" // Name of the WiFi network (SSID) that you want to connect Inkplate to
24-
#define pass "" // Password of that WiFi network
23+
#define ssid "Soldered" // Name of the WiFi network (SSID) that you want to connect Inkplate to
24+
#define pass "dasduino" // Password of that WiFi network
2525

2626
// Fill in these using api key from https://www.mapbox.com/ and coordinates you want to draw
2727
// http://bboxfinder.com/ might help you :)
@@ -60,10 +60,16 @@ void setup()
6060

6161
// Go to sleep for DELAY_MS
6262
esp_sleep_enable_timer_wakeup(1000L * DELAY_MS);
63-
(void)esp_deep_sleep_start();
63+
64+
// Put the panel in the deep sleep
65+
display.setPanelDeepSleep(0);
66+
67+
// Start deep sleep (this function does not return). Program stops here.
68+
esp_deep_sleep_start();
6469
}
6570

6671
void loop()
6772
{
68-
// Nothing...
73+
// Never here! If you are using deep sleep, the whole program should be in setup() because the board restarts each
74+
// time. loop() must be empty!
6975
}

examples/Inkplate6COLOR/Projects/Inkplate6COLOR_Crowdsupply_Campaing_Tracker/Inkplate6COLOR_Crowdsupply_Campaing_Tracker.ino

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#include "generatedUI.h" // include generated UI
2323

2424
// Change here to your wifi ssid and pass and the url to display info for
25-
#define ssid "" // Name of the WiFi network (SSID) that you want to connect Inkplate to
26-
#define pass "" // Password of that WiFi network
25+
#define ssid "Soldered" // Name of the WiFi network (SSID) that you want to connect Inkplate to
26+
#define pass "dasduino" // Password of that WiFi network
2727

2828
#define DELAY_MS 60000 * 60 // Delay between fetching data
2929
#define URL "https://www.crowdsupply.com/soldered/inkplate-6color" // Link to the Inkplate 6COLOR crowdsupply campaign
@@ -119,12 +119,18 @@ void setup()
119119

120120
// Go to sleep
121121
esp_sleep_enable_timer_wakeup(1000LL * DELAY_MS);
122-
(void)esp_deep_sleep_start();
122+
123+
// Put the panel in the deep sleep
124+
display.setPanelDeepSleep(0);
125+
126+
// Start deep sleep (this function does not return). Program stops here.
127+
esp_deep_sleep_start();
123128
}
124129

125130
void loop()
126131
{
127-
// Never here
132+
// Never here! If you are using deep sleep, the whole program should be in setup() because the board restarts each
133+
// time. loop() must be empty!
128134
}
129135

130136
/**

examples/Inkplate6COLOR/Projects/Inkplate6COLOR_Crypto_Currency_Tracker/Inkplate6COLOR_Crypto_Currency_Tracker.ino

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
int timeZone = 2;
3131

3232
// Put in your ssid and password
33-
char ssid[] = "";
34-
char pass[] = "";
33+
char ssid[] = "Soldered";
34+
char pass[] = "dasduino";
3535

3636
// Delay between API calls in miliseconds
3737
#define DELAY_MS 3 * 60 * 1000
@@ -155,7 +155,12 @@ void loop()
155155

156156
// Go to sleep before checking again
157157
esp_sleep_enable_timer_wakeup(1000L * DELAY_MS);
158-
(void)esp_light_sleep_start();
158+
159+
// Put the panel in the deep sleep
160+
display.setPanelDeepSleep(0);
161+
162+
// Start deep sleep (this function does not return). Program stops here.
163+
esp_deep_sleep_start();
159164
}
160165

161166
// Function to draw our graph

examples/Inkplate6COLOR/Projects/Inkplate6COLOR_Daily_Weather_Station/Inkplate6COLOR_Daily_Weather_Station.ino

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,20 @@ void setup()
137137
// Refresh full screen every fullRefresh times, defined above
138138
display.display();
139139

140-
// Go to sleep before checking again
140+
// Activate wakeup timer
141141
esp_sleep_enable_timer_wakeup(1000L * DELAY_MS);
142+
143+
// Put the panel in the deep sleep
144+
display.setPanelDeepSleep(0);
145+
146+
// Start deep sleep (this function does not return). Program stops here.
142147
esp_deep_sleep_start();
143148
}
144149

145150
void loop()
146151
{
152+
// Never here! If you are using deep sleep, the whole program should be in setup() because the board restarts each
153+
// time. loop() must be empty!
147154
}
148155

149156
// Function for drawing weather info

examples/Inkplate6COLOR/Projects/Inkplate6COLOR_Google_Calendar/Inkplate6COLOR_Google_Calendar.ino

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,18 @@ void setup()
122122

123123
// Go to sleep before checking again
124124
esp_sleep_enable_timer_wakeup(1000L * DELAY_MS);
125+
126+
// Put the panel in the deep sleep
127+
display.setPanelDeepSleep(0);
128+
129+
// Start deep sleep (this function does not return). Program stops here.
125130
esp_deep_sleep_start();
126131
}
127132

128133
void loop()
129134
{
130-
// Never here
135+
// Never here! If you are using deep sleep, the whole program should be in setup() because the board restarts each
136+
// time. loop() must be empty!
131137
}
132138

133139
// Function for drawing calendar info

examples/Inkplate6COLOR/Projects/Inkplate6COLOR_Hourly_Weather_Station/Inkplate6COLOR_Hourly_Weather_Station.ino

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,14 @@ void loop()
160160
// Refresh full screen
161161
display.display();
162162

163-
// Go to sleep before checking again
163+
// Activate wakeup timer
164164
esp_sleep_enable_timer_wakeup(1000L * DELAY_MS);
165-
(void)esp_light_sleep_start();
165+
166+
// Put the panel in the deep sleep
167+
display.setPanelDeepSleep(0);
168+
169+
// Start deep sleep (this function does not return). Program stops here.
170+
esp_deep_sleep_start();
166171
}
167172

168173
// Function for drawing weather info

0 commit comments

Comments
 (0)