Skip to content

Commit c7618b2

Browse files
committed
Added prototypes for world clock
1 parent c250544 commit c7618b2

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

examples/WorldClockDemo/WorldClockDemo.ino

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ See more at http://blog.squix.ch
3939
* Begin Settings
4040
**************************/
4141
// WIFI
42-
const char* WIFI_SSID = "yourssid";
42+
const char* WIFI_SSID = "yourssid";
4343
const char* WIFI_PWD = "yourpassw0rd";
4444

4545
// Setup
@@ -65,6 +65,12 @@ String timeZoneIds [] = {"America/New_York", "Europe/London", "Europe/Paris", "A
6565
WorldClockClient worldClockClient("de", "CH", "E, dd. MMMMM yyyy", 4, timeZoneIds);
6666

6767

68+
// declaring prototypes
69+
bool drawFrame1(SSD1306 *display, SSD1306UiState* state, int x, int y);
70+
bool drawFrame2(SSD1306 *display, SSD1306UiState* state, int x, int y);
71+
bool drawFrame3(SSD1306 *display, SSD1306UiState* state, int x, int y);
72+
bool drawFrame4(SSD1306 *display, SSD1306UiState* state, int x, int y);
73+
6874
// this array keeps function pointers to all frames
6975
// frames are the single views that slide from right to left
7076
bool (*frames[])(SSD1306 *display, SSD1306UiState* state, int x, int y) = { drawFrame1, drawFrame2, drawFrame3, drawFrame4};
@@ -93,7 +99,7 @@ void setup() {
9399
display.setContrast(255);
94100

95101
WiFi.begin(WIFI_SSID, WIFI_PWD);
96-
102+
97103
int counter = 0;
98104
while (WiFi.status() != WL_CONNECTED) {
99105
delay(500);
@@ -104,7 +110,7 @@ void setup() {
104110
display.drawXbm(60, 30, 8, 8, counter % 3 == 1 ? ANIMATION_activeSymbole : ANIMATION_inactiveSymbole);
105111
display.drawXbm(74, 30, 8, 8, counter % 3 == 2 ? ANIMATION_activeSymbole : ANIMATION_inactiveSymbole);
106112
display.display();
107-
113+
108114
counter++;
109115
}
110116

@@ -178,7 +184,7 @@ void drawClock(SSD1306 *display, int x, int y, int timeZoneIndex, String city, c
178184
display->setFont(ArialMT_Plain_10);
179185
display->drawString(x + 60, y + 5, city);
180186
display->setFont(Crushed_Plain_36);
181-
display->drawXbm(x, y, 60, 60, icon);
187+
display->drawXbm(x, y, 60, 60, icon);
182188
display->drawString(x + 60, y + 15, worldClockClient.getHours(timeZoneIndex) + ":" + worldClockClient.getMinutes(timeZoneIndex));
183189

184190
}
@@ -204,5 +210,3 @@ void setReadyForWeatherUpdate() {
204210
Serial.println("Setting readyForUpdate to true");
205211
readyForUpdate = true;
206212
}
207-
208-

0 commit comments

Comments
 (0)