Skip to content

Commit 9e63c7e

Browse files
authored
Merge pull request #50 from e-radionicacom/revision
Fixed many bugs - Version 1.1.0
2 parents 75e3767 + b6f326d commit 9e63c7e

File tree

115 files changed

+27095
-86
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+27095
-86
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ If you are looking for micropython support, please find all details [here](https
8282

8383
This repo uses the source code from another repositories. All their license files are located in "licences" folder.
8484

85+
### Open-source
86+
87+
All of Inkplate-related development is open-sourced:
88+
- [Arduino library](https://github.com/e-radionicacom/Inkplate-6-Arduino-library)
89+
- [Inkplate 6 hardware](https://github.com/e-radionicacom/Inkplate-6-hardware)
90+
- [micropython Inkplate](https://github.com/e-radionicacom/Inkplate-6-micropython)
91+
- [OSHWA certificate](https://certification.oshwa.org/hr000003.html)
92+
8593
### Where to buy & other
8694

8795
Inkplate 6 is available for purchase via:
@@ -92,7 +100,5 @@ Inkplate 6 is available for purchase via:
92100
- [Sparkfun](https://www.sparkfun.com/search/results?term=inkplate)
93101
- [Pimoroni](https://shop.pimoroni.com/products/inkplate-6)
94102

95-
Inkplate 6 is open-source. If you are looking for hardware design of the board, check the [Hardware repo](https://github.com/e-radionicacom/Inkplate-6-hardware). You will find 3D printable [enclosure](https://github.com/e-radionicacom/Inkplate-6-hardware/tree/master/3D%20printable%20case) there, as well as [detailed dimensions](https://github.com/e-radionicacom/Inkplate-6-hardware/tree/master/Technical%20drawings). In this repo you will find code for driving the ED060SC7 e-paper display used by Inkplate.
96-
97103
For all questions and issues, please use our [forum](http://forum.e-radionica.com/en) to ask an question.
98104
For sales & collaboration, please reach us via [e-mail](mailto:[email protected]).
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
Inkplate_Partial_Update_With_Deep_Sleep example for e-radionica Inkplate 6
3+
For this example you will need only USB cable and Inkplate 6
4+
Select "Inkplate 6(ESP32)" from Tools -> Board menu.
5+
Don't have "Inkplate 6(ESP32)" option? Follow our tutorial and add it:
6+
https://e-radionica.com/en/blog/add-inkplate-6-to-arduino-ide/
7+
8+
In this example we will show how to use partial update of epaper screen with deep sleep functionality of ESP32.
9+
This example is not same as Inkplate-basic_partial_update! Do not use Inkplate-basic_partial_update with deep sleep, IT WON'T WORK!
10+
Reason why you have to use this method with deep sleep is down how partail update works. It saves content from screen in RAM.
11+
By calling partialUpdate() function, code finds difference between what is currently on screen and what will be written and sends only that.
12+
When deep sleep is used, all content form the RAM has been deleted, so ESP32 doesn't know what is currently on the screen, so
13+
you have to "rewrite" what is currently on the screen, preload that and then create new screen that will be updated with partial update.
14+
NOTE: Partial update is only available on 1 Bit mode (BW) and it is not recommended to use it on first refresh after
15+
power up. It is recommended to do a full refresh every 5-10 partial refresh to maintain good picture quality.
16+
17+
Want to learn more about Inkplate? Visit www.inkplate.io
18+
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/
19+
4 November 2020 by e-radionica.com
20+
*/
21+
22+
#include "Inkplate.h" // Include Inkplate library to the sketch
23+
#include <rom/rtc.h> // Include ESP32 library for RTC (needed for rtc_get_reset_reason() function)
24+
#include "driver/rtc_io.h" // Include ESP32 library for RTC pin I/O (needed for rtc_gpio_isolate() function)
25+
26+
#define uS_TO_S_FACTOR 1000000 // Conversion factor for micro seconds to seconds
27+
#define TIME_TO_SLEEP 10 // Time how long ESP32 will be in deep sleep (in seconds). In this case 10 seconds.
28+
29+
Inkplate display(INKPLATE_1BIT); // Create an object on Inkplate library and also set library into 1-bit mode (BW)
30+
31+
// Counter variable (stored in RTC RAM that stores variable even if deep sleep is used)
32+
// Variables that are changed after each partial update has to be stored in RTC RAM in order to recreate screen before deep sleep
33+
RTC_DATA_ATTR int counter = 0;
34+
RTC_DATA_ATTR float decimal = PI;
35+
36+
void setup()
37+
{
38+
display.begin(); // Init Inkplate library (you should call this function ONLY ONCE)
39+
createScreen(); // Function that contains everything that has to be written on screen
40+
41+
if (rtc_get_reset_reason(0) == DEEPSLEEP_RESET) // Check if ESP32 is reseted by deep sleep or power up / user manual reset (or some other reason)
42+
{
43+
display.preloadScreen(); // If is woken up by deep sleep, recreate whole screen to be same as was before deep sleep
44+
counter++; // Update variable / variables
45+
decimal*=1.23;
46+
display.clearDisplay(); // Clear everything in buffer
47+
createScreen(); // Create new screen with new variables
48+
display.partialUpdate(INKPLATE_FORCE_PARTIAL); // Force partial update of screen. (Use this only in this scenario, otherwise YOU CAN DAMAGE YOUR SCRREN)
49+
}
50+
else // If is not deep sleep reset, that must be some thing else, so use normal update procerude (full screen update)
51+
{
52+
display.display();
53+
}
54+
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR); // Set EPS32 to be woken up in 10 seconds (in this case)
55+
rtc_gpio_isolate(GPIO_NUM_12); // Isolate/disable GPIO12 on ESP32 (only to reduce power consumption in sleep)
56+
esp_deep_sleep_start(); //Put ESP32 into deep sleep (low power mode)
57+
}
58+
59+
void loop()
60+
{
61+
// Nothing should be here while using deep sleep!
62+
}
63+
64+
void createScreen()
65+
{
66+
display.setCursor(200, 300); // Set text cursor @ X = 200, Y = 300
67+
display.setTextSize(3); // Set font to be scaled up three times
68+
display.print("First variable:"); // Write first variable to buffer
69+
display.print(counter, DEC);
70+
display.setCursor(200, 340); // Set text cursor @ X = 200, Y = 340
71+
display.print("Second variable:"); // Write second variable to buffer (use two decimals places)
72+
display.print(decimal, 2);
73+
}

examples/Projects/Hourly_weather_station_example/Hourly_weather_station_example.ino

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ char *lat = "18.5947808";
3333
char *ssid = "";
3434
char *pass = "";
3535

36+
// Uncomment this for MPH and Fahrenheit output, also uncomment it in the begining of Network.cpp
37+
// #define AMERICAN
38+
3639
// Change to your api key, if you don't have one, head over to:
3740
// https://openweathermap.org/guide , register and copy the key provided
3841
char *apiKey = "";
@@ -325,7 +328,12 @@ void drawCurrent()
325328
display.setTextSize(1);
326329

327330
display.setCursor(x, y);
331+
332+
#ifdef AMERICAN
333+
display.println(F("F"));
334+
#else
328335
display.println(F("C"));
336+
#endif
329337

330338
// Wind:
331339
display.setFont(&Roboto_Light_120);
@@ -342,7 +350,12 @@ void drawCurrent()
342350
display.setTextSize(1);
343351

344352
display.setCursor(x, y);
353+
354+
#ifdef AMERICAN
355+
display.println(F("mph"));
356+
#else
345357
display.println(F("m/s"));
358+
#endif
346359

347360
// Labels underneath
348361
display.setFont(&Roboto_Light_36);

examples/Projects/Hourly_weather_station_example/Network.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ If you have any questions about licensing, please contact techsupport@e-radionic
1414
Distributed as-is; no warranty is given.
1515
*/
1616

17+
// Uncomment for American output
18+
// #define AMERICAN
19+
1720
// Network.cpp contains various functions and classes that enable Weather station
1821
// They have been declared in seperate file to increase readability
1922
#include "Network.h"
@@ -83,12 +86,22 @@ void Network::getTime(char *timeStr)
8386

8487
void formatTemp(char *str, float temp)
8588
{
89+
// Converting to Fahrenheit
90+
#ifdef AMERICAN
91+
temp = (temp * 9.0 / 5.0 + 32.0);
92+
#endif
93+
8694
// Built in function for float to char* conversion
8795
dtostrf(temp, 2, 0, str);
8896
}
8997

9098
void formatWind(char *str, float wind)
9199
{
100+
// Converting to MPH
101+
#ifdef AMERICAN
102+
wind = wind * 2.237;
103+
#endif
104+
92105
// Built in function for float to char* conversion
93106
dtostrf(wind, 2, 0, str);
94107
}
@@ -135,7 +148,7 @@ bool Network::getData(char *city, char *temp1, char *temp2, char *temp3, char *t
135148

136149
// Add woeid to api call
137150
char url[256];
138-
sprintf(url, "https://api.openweathermap.org/data/2.5/onecall?lat=%s&lon=%s&appid=%s", lon, lat, apiKey);
151+
sprintf(url, "https://api.openweathermap.org/data/2.5/onecall?lat=%s&lon=%s&appid=%s", lat, lon, apiKey);
139152

140153
// Initiate http
141154
http.begin(url);

0 commit comments

Comments
 (0)