1 #define DUDE_HEIGHT 12
2 #define DUDE_WIDTH 8
3
4 static const unsigned char PROGMEM StickDude_wave[][12] = {
5
6 {
7 B00000000, // . .
8 B00001000, // . 0 .
9 B00011100, // . 000 .
10 B00001000, // . 0 .
11 B00001000, // . 0 .
12 B00011100, // . 000 .
13 B00101010, // . 0 0 0 .
14 B01001001, // . 0 0 0.
15 B00001000, // . 0 .
16 B00010100, // . 0 0 .
17 B00100010, // . 0 0 .
18 B01000001 // . 0 0.
19 },
20
21 {
22 B00000000, // . .
23 B00001000, // . 0 .
24 B00011100, // . 000 .
25 B00001000, // . 0 .
26 B00001000, // . 0 .
27 B00111110, // . 00000 .
28 B01001001, // . 0 0 0.
29 B00001000, // . 0 .
30 B00001000, // . 0 .
31 B00010100, // . 0 0 .
32 B00100010, // . 0 0 .
33 B01000001 // . 0 0.
34 },
35
36 {
37 B00000000, // . .
38 B00001000, // . 0 .
39 B00011100, // . 000 .
40 B00001000, // . 0 .
41 B00001000, // . 0 .
42 B01111111, // . 0000000.
43 B00001000, // . 0 .
44 B00001000, // . 0 .
45 B00001000, // . 0 .
46 B00010100, // . 0 0 .
47 B00100010, // . 0 0 .
48 B01000001 // . 0 0.
49 },
50
51 {
52 B00000000, // . .
53 B00001000, // . 0 .
54 B00011100, // . 000 .
55 B00001000, // . 0 .
56 B01001001, // . 0 0 0.
57 B00111110, // . 00000 .
58 B00001000, // . 0 .
59 B00001000, // . 0 .
60 B00001000, // . 0 .
61 B00010100, // . 0 0 .
62 B00100010, // . 0 0 .
63 B01000001 // . 0 0.
64 },
65
66 {
67 B00000000, // . .
68 B00001000, // . 0 .
69 B00011100, // . 000 .
70 B01001001, // . 0 0 0.
71 B00101010, // . 0 0 0 .
72 B00011100, // . 000 .
73 B00001000, // . 0 .
74 B00001000, // . 0 .
75 B00001000, // . 0 .
76 B00010100, // . 0 0 .
77 B00100010, // . 0 0 .
78 B01000001 // . 0 0.
79 },
80 };
81
82 int StickDude_wave_height = sizeof(StickDude_wave[0]);
83 int StickDude_wave_count = sizeof(StickDude_wave) / StickDude_wave_height;
84 int StickDude_wave_width = 8;
85
86 static const unsigned char PROGMEM StickDude_walk[][12] = {
87 {
88 B00000000, // ........
89 B00001000, // ....0...
90 B00011100, // ...000..
91 B00001000, // ....0...
92 B00001000, // ....0...
93 B00001110, // ....000.
94 B00001000, // ....0...
95 B00001000, // ....0...
96 B00001000, // ....0...
97 B00001000, // ....0...
98 B00001000, // ....0...
99 B00001000, // ....0...
100 }, // A
101
102 {
103 B00000000, // ........
104 B00001000, // ....0...
105 B00011100, // ...000..
106 B00001000, // ....0...
107 B00001000, // ....0...
108 B00001110, // ....000.
109 B00001000, // ....0...
110 B00001000, // ....0...
111 B00001000, // ....0...
112 B00001100, // ....00..
113 B00011000, // ...00...
114 B00001000, // ....0...
115 }, // B
116
117 {
118 B00000000, // ........
119 B00001000, // ....0...
120 B00011100, // ...000..
121 B00001000, // ....0...
122 B00001000, // ....0...
123 B00001110, // ....000.
124 B00001000, // ....0...
125 B00001000, // ....0...
126 B00001100, // ....00..
127 B00001010, // ....0.0.
128 B00001100, // ....00..
129 B00001000, // ....0...
130 }, // C
131
132 {
133 B00000000, // ........
134 B00001000, // ....0...
135 B00011100, // ...000..
136 B00001000, // ....0...
137 B00001000, // ....0...
138 B00001110, // ....000.
139 B00001000, // ....0...
140 B00001000, // ....0...
141 B00001100, // ....00..
142 B00001010, // ....0.0.
143 B00001010, // ....0.0.
144 B00001000, // ....0...
145 }, // D
146
147 {
148 B00000000, // ........
149 B00001000, // ....0...
150 B00011100, // ...000..
151 B00001000, // ....0...
152 B00001000, // ....0...
153 B00001110, // ....000.
154 B00001000, // ....0...
155 B00001000, // ....0...
156 B00001000, // ....0...
157 B00001100, // ....00..
158 B00001010, // ....0.0.
159 B00001001, // ....0..0
160 }, // E
161
162 {
163 B00000000, // ........
164 B00001000, // ....0...
165 B00011100, // ...000..
166 B00001000, // ....0...
167 B00001000, // ....0...
168 B00001110, // ....000.
169 B00001000, // ....0...
170 B00001000, // ....0...
171 B00001000, // ....0...
172 B00001100, // ....00..
173 B00010010, // ...0..0.
174 B00010001, // ...0...0
175 }, // F
176
177 {
178 B00000000, // ........
179 B00001000, // ....0...
180 B00011100, // ...000..
181 B00001000, // ....0...
182 B00001000, // ....0...
183 B00001110, // ....000.
184 B00001000, // ....0...
185 B00001000, // ....0...
186 B00001000, // ....0...
187 B00010100, // ...0.0..
188 B00100010, // ..0...0.
189 B01000001, // .0.....0
190 }, // G
191
192 {
193 B00000000, // ........
194 B00001000, // ....0...
195 B00011100, // ...000..
196 B00001000, // ....0...
197 B00001000, // ....0...
198 B00001110, // ....000.
199 B00001000, // ....0...
200 B00001000, // ....0...
201 B00001000, // ....0...
202 B00011000, // ...00...
203 B00100100, // ..0..0..
204 B01000100, // .0...0..
205 }, // H
206
207 };
208
209 int StickDude_walk_height = sizeof(StickDude_walk[0]);
210 int StickDude_walk_count = sizeof(StickDude_walk) / StickDude_walk_height;
211 int StickDude_walk_width = 8;
212
213 static const unsigned char PROGMEM StickDude_beer[][12] = {
214
215 {
216 B00000000, // ........
217 B00001000, // ....0...
218 B00011100, // ...000..
219 B00001000, // ....0...
220 B00001000, // ....0...
221 B00001000, // ....0...
222 B00001000, // ....0...
223 B00001000, // ....0...
224 B00001000, // ....0...
225 B00001000, // ....0...
226 B00001000, // ....0...
227 B00001100, // ....01..
228 }, // A
229
230 {
231 B00000000, // ........
232 B00001000, // ....0...
233 B00011100, // ...000..
234 B00001000, // ....0...
235 B00001000, // ....0...
236 B00001000, // ....0...
237 B00001100, // ....00..
238 B00001100, // ....00..
239 B00001100, // ....00..
240 B00001000, // ....0...
241 B00001000, // ....0...
242 B00001100, // ....01..
243 }, // B
244
245 {
246 B00000000, // ........
247 B00001000, // ....0...
248 B00011100, // ...000..
249 B00001000, // ....0...
250 B00001000, // ....0...
251 B00001100, // ....00..
252 B00001010, // ....0.0.
253 B00001010, // ....0.0.
254 B00001000, // ....0...
255 B00001000, // ....0...
256 B00001000, // ....0...
257 B00001100, // ....01..
258 }, // C
259
260 {
261 B00000000, // ........
262 B00001000, // ....0...
263 B00011100, // ...000..
264 B00001000, // ....0...
265 B00001000, // ....0...
266 B00001100, // ....00..
267 B00001011, // ....0.00
268 B00001001, // ....0..0
269 B00001000, // ....0...
270 B00001000, // ....0...
271 B00001000, // ....0...
272 B00001100, // ....01..
273 }, // D
274
275 {
276 B00000000, // ........
277 B00001000, // ....0...
278 B00011100, // ...000..
279 B00001000, // ....0...
280 B00001000, // ....0...
281 B00001101, // ....00.0
282 B00001011, // ....0.00
283 B00001000, // ....0...
284 B00001000, // ....0...
285 B00001000, // ....0...
286 B00001000, // ....0...
287 B00001100, // ....01..
288 }, // E
289
290 {
291 B00000000, // ........
292 B00001000, // ....0...
293 B00011100, // ...000..
294 B00001000, // ....0...
295 B00001000, // ....0...
296 B00001111, // ....0000
297 B00001001, // ....0..0
298 B00001000, // ....0...
299 B00001000, // ....0...
300 B00001000, // ....0...
301 B00001000, // ....0...
302 B00001100, // ....01..
303 }, // F
304
305 {
306 B00000000, // ........
307 B00001000, // ....0...
308 B00011100, // ...000..
309 B00001000, // ....0...
310 B00001001, // ....0..0
311 B00001111, // ....0000
312 B00001000, // ....0...
313 B00001000, // ....0...
314 B00001000, // ....0...
315 B00001000, // ....0...
316 B00001000, // ....0...
317 B00001100, // ....01..
318 }, // G
319
320 {
321 B00000000, // ........
322 B00001000, // ....0...
323 B00011100, // ...000..
324 B00001010, // ....0.0.
325 B00001001, // ....0..0
326 B00001110, // ....000.
327 B00001000, // ....0...
328 B00001000, // ....0...
329 B00001000, // ....0...
330 B00001000, // ....0...
331 B00001000, // ....0...
332 B00001100, // ....01..
333 }, // H
334
335 {
336 B00000000, // ........
337 B00001000, // ....0...
338 B00011100, // ...000..
339 B00001001, // ....0..0
340 B00001011, // ....0.00
341 B00001100, // ....00..
342 B00001000, // ....0...
343 B00001000, // ....0...
344 B00001000, // ....0...
345 B00001000, // ....0...
346 B00001000, // ....0...
347 B00001100, // ....01..
348 }, // I
349
350 {
351 B00000000, // ........
352 B00001000, // ....0...
353 B00011100, // ...000..
354 B00001011, // ....0.00
355 B00001010, // ....0.0.
356 B00001100, // ....00..
357 B00001000, // ....0...
358 B00001000, // ....0...
359 B00001000, // ....0...
360 B00001000, // ....0...
361 B00001000, // ....0...
362 B00001100, // ....01..
363 }, // J
364
365 {
366 B00000000, // ........
367 B00001000, // ....0...
368 B00011100, // ...000..
369 B00001110, // ....000.
370 B00001010, // ....0.0.
371 B00001100, // ....00..
372 B00001000, // ....0...
373 B00001000, // ....0...
374 B00001000, // ....0...
375 B00001000, // ....0...
376 B00001000, // ....0...
377 B00001100, // ....01..
378 }, // K
379
380 {
381 B00000000, // ........
382 B00001000, // ....0...
383 B00011100, // ...000..
384 B00001110, // ....00..
385 B00001010, // ....0.0.
386 B00001100, // ....00..
387 B00001000, // ....0...
388 B00001000, // ....0...
389 B00001000, // ....0...
390 B00001000, // ....0...
391 B00001000, // ....0...
392 B00001100, // ....01..
393 }, // A
394
395 };
396
397 int StickDude_beer_height = sizeof(StickDude_beer[0]);
398 int StickDude_beer_count = sizeof(StickDude_beer) / StickDude_beer_height;
399 int StickDude_beer_width = 8;
1 #include "libraries.h"
2 #include "functions.h"
3
4 #include "MQTT.h"
5
6 WiFiClient espClient;
7 PubSubClient MQTT_client(espClient);
8
9 void DOtheBloodyMQTT()
10 {
11 if (!MQTT_client.connected())
12 {
13 MQTT_reconnect();
14 }
15 MQTT_client.loop();
16 MQTT_beacon();
17
18 }
19
20 ////////////////////////////////////////////////////////////////
21 // MQTT Functions
22 ////////////////////////////////////////////////////////////////
23
24 void MQTT_init()
25 {
26 Serial.printf("+---------------------------------------+\n");
27 MQTT_client.setServer(MQTT_broker, 1883);
28 MQTT_client.setCallback(MQTT_callback);
29
30 // Build the topic names
31 strcpy(MQTT_inTopic, "cmnd/"); // in - Commands
32 strcat(MQTT_inTopic, MQTT_ClientName);
33 strcat(MQTT_inTopic, "/#");
34 strcpy(MQTT_teleTopic, "tele/"); // out - Telemetry
35 strcat(MQTT_teleTopic, MQTT_ClientName);
36 strcpy(MQTT_statTopic, "stat/"); // out - Status
37 strcat(MQTT_statTopic, MQTT_ClientName);
38 strcpy(MQTT_outTopic, "noti/"); // out - Notifications
39 strcat(MQTT_outTopic, MQTT_ClientName);
40
41 MQTT_reconnect();
42 }
43
44 void MQTT_callback(char *topic, byte *payload, int length)
45 {
46
47 char MQTT_msg_in[MQTT_BUFFER_SIZE];
48 char *MQTT_command = strrchr(topic, '/');
49
50 #ifdef DEBUG
51 Serial.printf("| |\n");
52 Serial.printf("| Message arrived |\n");
53 Serial.printf("| Command: %28s |\n", MQTT_command);
54 #endif
55
56 if (length < MQTT_BUFFER_SIZE)
57 {
58 for (int i = 0; i < length; i++)
59 {
60 MQTT_msg_in[i] = (char)payload[i];
61 MQTT_msg_in[i + 1] = '\0';
62 }
63
64 #ifdef DEBUG
65 Serial.printf("| Message: %28s |\n", MQTT_msg_in);
66 #endif
67 /////////////////////////////////////////////////////
68 // Message handling goes here...
69 /////////////////////////////////////////////////////
70 if (strcmp(MQTT_command, "/lights") == 0)
71 {
72 // DoLights(MQTT_msg_in);
73 }
74 else if (strcmp(MQTT_command, "/respond") == 0)
75 {
76 // DoAnswer(MQTT_msg_in);
77 }
78 else if (strcmp(MQTT_command, "/control") == 0)
79 {
80 // DoControl(MQTT_msg_in);
81 }
82 else
83 {
84 #ifdef DEBUG
85 Serial.printf("| Dunno Whatcha want... |\n");
86 #endif
87 }
88 }
89 else
90 {
91 #ifdef DEBUG
92 Serial.printf("| But, it's TOO Bloody Big! |\n");
93 #endif
94 }
95 }
96
97 void MQTT_reconnect()
98 {
99 // Loop until we're reconnected
100 while (!MQTT_client.connected())
101 {
102 Serial.printf("| Attempting MQTT connection... |\n");
103 // Create a random client ID
104 String clientId = MQTT_ClientName;
105 clientId += String(random(0xffff), HEX);
106 // Attempt to connect
107 if (MQTT_client.connect(clientId.c_str()))
108 {
109 SSD1306_Static(" MQTT good ", 3);
110 delay(500);
111 SSD1306_Static(" ", 3);
112 Serial.printf("| connected to %-24s |\n", MQTT_broker);
113 Serial.printf("| My Name: %-27s |\n", MQTT_ClientName);
114 // Once connected, publish an announcement...
115 char MQTT_statTopic_Device[100];
116 strcpy(MQTT_statTopic_Device, MQTT_statTopic);
117 strcat(MQTT_statTopic_Device, "/HELLO");
118 // MQTT_client.publish(MQTT_statTopic_Device, "world");
119 MQTT_client.publish(MQTT_statTopic_Device, WiFi_ssid);
120 // ... and resubscribe
121 MQTT_client.subscribe(MQTT_inTopic);
122 }
123 else
124 {
125
126 if (WiFi.status() != WL_CONNECTED)
127 {
128 SSD1306_Static(" no WiFi ", 3);
129 Serial.printf("| UH OH!!! No WiFi!!! |\n");
130 }
131 else
132 {
133 SSD1306_Static(" no MQTT ", 3);
134 }
135
136 Serial.printf("| |\n");
137 Serial.printf("| failed, rc=%d |\n", MQTT_client.state());
138 Serial.printf("| trying again in 5 seconds |\n");
139 // Wait 5 seconds before retrying
140 delay(5000);
141 }
142 }
143 }
144
145 void MQTT_beacon()
146 {
147 /* Beacon signal published at set interval to indicate the device
148 * is still powered up and actively connected to MQTT...
149 * A keepalive of sorts
150 * also updates state within MQTT so it can be captured for
151 * indicator light elsewhere
152 */
153 char MQTT_teleTopic_Device[100];
154 char WiFiSignal[5];
155 strcpy(MQTT_teleTopic_Device, MQTT_teleTopic);
156 strcat(MQTT_teleTopic_Device, "/beep");
157 if (getTimer(beacon_timer, BEACON_INTERVAL))
158 {
159 sprintf(WiFiSignal, "%d dBm", WiFi_strength());
160
161 // MQTT_client.publish(MQTT_teleTopic_Device, "boop");
162 MQTT_client.publish(MQTT_teleTopic_Device, WiFiSignal);
163 blinkLED();
164
165 #ifdef DEBUG
166 Serial.printf("| Beacon sent |\n");
167 #endif
168 }
169 }
170
171 void MQTT_Status(char const *Device, char const *Status) // Send status messages
172 {
173 char MQTT_statTopic_Device[100];
174 strcpy(MQTT_statTopic_Device, MQTT_statTopic);
175 strcat(MQTT_statTopic_Device, "/");
176 strcat(MQTT_statTopic_Device, Device);
177
178 #ifdef DEBUG
179 Serial.printf("}- %16s = %-16s -{\n", Device, Status);
180 #endif
181 MQTT_client.publish(MQTT_statTopic_Device, Status);
182 }
183
184 void MQTT_SendData(float Temp0, float Temp1)
185 {
186 char MQTT_teleTopic_Device[100];
187 strcpy(MQTT_teleTopic_Device, MQTT_teleTopic);
188 strcat(MQTT_teleTopic_Device, "/");
189 strcat(MQTT_teleTopic_Device, "SENSOR");
190
191 char JSONstream[100];
192 sprintf(JSONstream,
193 "{\"DS18B20_1\":{\"Temperature\":%5.1f},\"DS18B20_2\":{\"Temperature\":%5.1f}}",
194 Temp0, Temp1);
195 MQTT_client.publish(MQTT_teleTopic_Device, JSONstream);
196
197 }
1 #include "libraries.h"
2 #include "functions.h"
3
4 #include "StickDude.h"
5
6 #include "SSD1306.h"
7
8 ////////////////////////////////////////////////////////////////////////////////
9 // This code is based on using an
10 // IZOKEE 0.96" SSD1306 based 128x64 OLED (Yellow/Blue) from Amazon
11 // { https://www.amazon.ca/gp/product/B076PNP2VD/ }
12 ////////////////////////////////////////////////////////////////////////////////
13
14 // Initialize the display
15 void SSD1306_init()
16 {
17 Serial.printf("+---------------------------------------+\n");
18 Wire.begin(SSD1306_SDA, SSD1306_SCL); // Select SDA & SCL pins
19
20 { // debug output (StickDude Stats)
21 Serial.printf("StickDude_wave: %d\n", sizeof(StickDude_wave));
22 Serial.printf("StickDude_wave height: %d\n", StickDude_wave_height);
23 Serial.printf("StickDude_wave count: %d\n", StickDude_wave_count);
24 Serial.printf("StickDude_wave width: %d\n", StickDude_wave_width);
25
26 Serial.printf("StickDude_walk: %d\n", sizeof(StickDude_walk));
27 Serial.printf("StickDude_walk height: %d\n", StickDude_walk_height);
28 Serial.printf("StickDude_walk count: %d\n", StickDude_walk_count);
29 Serial.printf("StickDude_walk width: %d\n", StickDude_walk_width);
30 }
31
32 // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
33 if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C))
34 {
35 Serial.printf("| SSD1306 allocation failed |\n");
36 for (;;)
37 ; // Don't proceed, loop forever
38 // Does this ever actually happen?
39 }
40
41 display.clearDisplay();
42
43 display.dim(true); // These displays are excessively bright
44
45 // Set up the active (changing) parts of the display
46 Dcanvas1.setFont(&FreeMonoBold9pt7b);
47 Dcanvas2.setFont(&FreeMonoBold9pt7b);
48 // Dcanvas3.setFont(&FreeMonoBold9pt7b);
49
50 // Set up the static (non-changing) parts of the display
51 // Scanvas1.setFont(&FreeMonoBold9pt7b);
52 // Scanvas2.setFont(&FreeMonoBold9pt7b);
53 Scanvas3.setFont(&FreeMonoBold9pt7b);
54
55 display.setTextColor(WHITE, BLACK);
56 display.setTextSize(1);
57
58 Serial.printf("| SSD1306 initialized |\n");
59 }
60
61 // Place static text on the yellow part of the OLED display
62 // Accepts the string (max 9 characters)
63 void SSD1306_title(const char *Title)
64 { // Max 9 characters...
65 display.setFont(&FreeMonoBold12pt7b);
66 display.setCursor(0, 14);
67 display.print(Title);
68 display.display();
69 }
70
71 // Place static text on the blue part of the OLED display
72 // Accepts the string (max 11 characters) and the row number (1-3)
73 void SSD1306_Static(const char *Line, int Row)
74 { // Max 11 characters
75 Scanvas3.fillScreen(BLACK);
76 Scanvas3.setCursor(0, 11);
77 Scanvas3.print(Line);
78 display.drawBitmap(4, row_Y[Row - 1] - 9, Scanvas3.getBuffer(), 120, 15, WHITE, BLACK);
79
80 display.display();
81 }
82
83 // Create an activity indicator
84 // Just a little dot that crawls across the bottom edge of the display
85 int DudeStep = 0;
86 void SSD1306_Dotty()
87 {
88 DottyX++;
89 if (DottyX > SCREEN_WIDTH)
90 {
91 DottyX = 0;
92 }
93 if (DudeStep >= StickDude_walk_count)
94 {
95 DudeStep = 0;
96 }
97 // display.drawPixel(DottyX, SCREEN_HEIGHT - 1, WHITE); // Bottom line
98 // display.drawPixel(DottyX - 1, SCREEN_HEIGHT - 1, BLACK);
99 DrawStickDude2(DudeStep, 0, 0);
100 DudeStep++;
101 display.drawBitmap(DottyX, 64 - 12, StickDudePIC.getBuffer(), 8, 12, WHITE, BLACK);
102 display.display();
103 }
104
105 // Display the temperatures on the pre-formatted OLED display
106 void SSD1306_DisplayTemps()
107 {
108 float Beer = DS18B20_getReading(0); // * .3;
109 float Food = DS18B20_getReading(1); // * -1;
110
111 char BeerTemp[6];
112 char FoodTemp[6];
113
114 Dcanvas1.fillScreen(BLACK);
115 if (Beer == -127)
116 {
117 sprintf(BeerTemp, "-----");
118 Beer = 0;
119 }
120 else
121 sprintf(BeerTemp, "%5.1f", Beer);
122
123 Dcanvas2.fillScreen(BLACK);
124 if (Food == -127)
125 {
126 sprintf(FoodTemp, "-----");
127 Food = 0;
128 }
129 else
130 sprintf(FoodTemp, "%5.1f", Food);
131
132 Dcanvas1.setCursor(0, 11);
133 Dcanvas1.print(BeerTemp);
134 display.drawBitmap(64, row_Y[0] - 9, Dcanvas1.getBuffer(), 55, 12, WHITE, BLACK);
135
136 Dcanvas2.setCursor(0, 11);
137 Dcanvas2.print(FoodTemp);
138 display.drawBitmap(64, row_Y[1] - 9, Dcanvas2.getBuffer(), 55, 12, WHITE, BLACK);
139
140 display.display();
141
142 MQTT_SendData(Beer, Food);
143
144 waveStickDude(0, 0);
145 // walkStickDude(0, 0);
146 // waveStickDude(0, 0);
147
148 #ifdef DEBUG
149 Serial.printf("| Sensor 0: %5s - Sensor 1: %5s |\n", BeerTemp, FoodTemp);
150 #endif
151 }
152
153 void DrawStickDude(int DudeNum, int TOP, int LEFT)
154 {
155 // display.clearDisplay();
156 StickDudePIC.fillScreen(BLACK);
157
158 StickDudePIC.drawBitmap(
159 (0),
160 (0),
161 StickDude_beer[DudeNum], DUDE_WIDTH, DUDE_HEIGHT, 1);
162
163 // display.display();
164 }
165
166 void walkStickDude(int TOP, int LEFT)
167 {
168 // Serial.printf("| Loop through StickDudes Poses... |\n");
169 int FOO;
170
171 for (FOO = 0; FOO < StickDude_walk_count; FOO++)
172 {
173 {
174 DrawStickDude2(FOO, 0, 0);
175 display.drawBitmap(DottyX, 64 - 12, StickDudePIC.getBuffer(), 8, 12, WHITE, BLACK);
176 display.display();
177 delay(30);
178 }
179 }
180 FOO--;
181 for (; FOO >= 0; FOO--)
182 {
183 {
184 DrawStickDude2(FOO, 0, 0);
185 display.drawBitmap(DottyX, 64 - 12, StickDudePIC.getBuffer(), 8, 12, WHITE, BLACK);
186 display.display();
187 delay(30);
188 }
189 }
190 }
191
192 void waveStickDude(int TOP, int LEFT)
193 {
194 // Serial.printf("| Loop through StickDudes Poses... |\n");
195 int FOO;
196
197 for (FOO = 0; FOO < StickDude_beer_count; FOO++)
198 {
199 {
200 DrawStickDude(FOO, 0, 0);
201 display.drawBitmap(DottyX, 64 - 12, StickDudePIC.getBuffer(), 8, 12, WHITE, BLACK);
202 display.display();
203 delay(60);
204 }
205 }
206 FOO--;
207 for (; FOO >= 0; FOO--)
208 {
209 {
210 DrawStickDude(FOO, 0, 0);
211 display.drawBitmap(DottyX, 64 - 12, StickDudePIC.getBuffer(), 8, 12, WHITE, BLACK);
212 display.display();
213 delay(30);
214 }
215 }
216 }
217
218 void DrawStickDude2(int DudeNum, int TOP, int LEFT)
219 {
220 // display.clearDisplay();
221 StickDudePIC.fillScreen(BLACK);
222
223 StickDudePIC.drawBitmap(
224 (0),
225 (0),
226 StickDude_walk[DudeNum], DUDE_WIDTH, DUDE_HEIGHT, 1);
227
228 // display.display();
229 }