Quellcode durchsuchen

Version with bg (only when sending metta)

master
The Dod vor 4 Monaten
Ursprung
Commit
9995882462

BIN
graphics/peace/bg-salam-darkened.png Datei anzeigen


BIN
graphics/peace/bg-salam.png Datei anzeigen


BIN
graphics/peace/bg-shalom-darkened.png Datei anzeigen


BIN
graphics/peace/bg-shalom.png Datei anzeigen


BIN
graphics/peace/salambg.png Datei anzeigen


BIN
graphics/peace/shalombg.png Datei anzeigen


BIN
graphics/peace/togetherbg.png Datei anzeigen


+ 1
- 1
talismetta/config.h Datei anzeigen

@@ -8,5 +8,5 @@
8 8
 // scan for the other one, and not for itself).
9 9
 
10 10
 
11
-#define SHALOM "30:C6:F7:1D:A6:20"
11
+#define SHALOM "08:F9:E0:D1:28:4C"
12 12
 #define SALAM "30:C6:F7:1D:A2:5C"

+ 2042
- 0
talismetta/salambg.h
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 2042
- 0
talismetta/shalombg.h
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 29
- 27
talismetta/talismetta.ino Datei anzeigen

@@ -2,11 +2,11 @@
2 2
 #include <esp_now.h>
3 3
 #include <TFT_eSPI.h>
4 4
 #include "config.h"
5
-#include "shalomorph.h"
6 5
 #include "shalom.h"
6
+#include "shalombg.h"
7 7
 #include "salam.h"
8
-#include "salamorph.h"
9
-#include "together.h"
8
+#include "salambg.h"
9
+#include "togetherbg.h"
10 10
 #include "talis.h"
11 11
 #include "metta.h"
12 12
 #include "loving.h"
@@ -14,7 +14,7 @@
14 14
 #include "mybird.h"
15 15
 #include "yourbird.h"
16 16
 
17
-#define DEBUG true
17
+#define DEBUG false // note: it's easier to read the MAC address if DEBUG is false
18 18
 
19 19
 #define BUTTON1PIN ((gpio_num_t)35)
20 20
 #define BUTTON2PIN ((gpio_num_t)0)
@@ -63,41 +63,42 @@ esp_now_peer_info_t peerInfo;
63 63
 bool nearby = false;
64 64
 
65 65
 
66
-#define NUM_FRAMES 23
66
+#define NUM_FRAMES 9
67 67
 enum frameType {
68 68
   FRAME_ME,
69
-  FRAME_ME2US,
70 69
   FRAME_US,
71
-  FRAME_US2U,
72 70
   FRAME_U
73 71
 };
74 72
 
75 73
 frameType frames[NUM_FRAMES] = {
76
-  FRAME_ME, FRAME_ME2US, FRAME_US, FRAME_US2U, FRAME_U, FRAME_U, FRAME_U,
77
-  FRAME_US2U,  FRAME_US, FRAME_US,  FRAME_US2U, FRAME_U, FRAME_U, FRAME_U,
78
-  FRAME_US2U, FRAME_US, FRAME_ME2US, FRAME_ME, FRAME_ME, FRAME_ME,
79
-  FRAME_ME, FRAME_ME, FRAME_ME
74
+  FRAME_ME, FRAME_US, FRAME_U,
75
+  FRAME_U, FRAME_US, FRAME_U,
76
+  FRAME_U, FRAME_US, FRAME_ME
80 77
 };
81 78
 
82
-const unsigned short *frame2image(frameType frame, bool is_salam) {
83
-  switch (frame) {
84
-    case FRAME_ME:
79
+const unsigned short *frame2image(frameType frame, bool is_salam, bool metta_from_me, bool metta_from_you) {
80
+  if (!metta_from_you) {
81
+    if (metta_from_me) {
82
+      return is_salam ? salambg : shalombg;
83
+    } else {
85 84
       return is_salam ? salam : shalom;
86
-    case FRAME_ME2US:
87
-      return is_salam ? salamorph : shalomorph;
88
-    case FRAME_US:
89
-      return together;
90
-    case FRAME_US2U:
91
-      return is_salam ? shalomorph : salamorph;
92
-    case FRAME_U:
93
-      return is_salam ? shalom : salam;
85
+    }
86
+  } else { // metta_from_you
87
+    switch (frame) {
88
+      case FRAME_ME:
89
+        return metta_from_me ? (is_salam ? salambg : shalombg) : (is_salam ? salam : shalom);
90
+      case FRAME_US:
91
+        return metta_from_me ? togetherbg : (is_salam ? salam : shalom);
92
+      case FRAME_U:
93
+        return (metta_from_me) ? (is_salam ? shalombg  : salambg) : (is_salam ?  salam : shalom);
94
+    }
94 95
   }
95 96
 }
96 97
 
97 98
 int current_frame = 0;
98 99
 unsigned long last_flip = 0;
99 100
 
100
-#define DURATION 100
101
+#define DURATION 250
101 102
 
102 103
 
103 104
 TFT_eSPI tft = TFT_eSPI();
@@ -266,14 +267,15 @@ void loop() {
266 267
   // FRAME_ME or animation frame
267 268
   background.pushImage(
268 269
     0, 0, 240, 135,
269
-    frame2image((metta_from_me_since && metta_from_you) ? frames[current_frame] : FRAME_ME, is_salam));
270
+    frame2image(frames[current_frame], is_salam, metta_from_me_since, metta_from_you));
270 271
 
271
-  // mybird
272
-  if (metta_from_me_since) {
272
+  // mybird (steady, pulse if metta_from_me_Since)
273
+  if (!metta_from_me_since || frames[current_frame] == FRAME_ME || frames[current_frame] == FRAME_US) {
273 274
     mybirdSprite.pushToSprite(&background, MYBIRD_X, MYBIRD_Y, TFT_BLACK);
274 275
   }
275 276
 
276
-  if (nearby && frames[current_frame] == FRAME_U) {
277
+  // yourbird (steady if nearby, heart beat if metta_from_you)
278
+  if (nearby && (!metta_from_you || frames[current_frame] == FRAME_U || frames[current_frame] == FRAME_US)) {
277 279
     yourbirdSprite.pushToSprite(&background, YOURBIRD_X, YOURBIRD_Y, TFT_BLACK);
278 280
   }
279 281
 

+ 2042
- 0
talismetta/togetherbg.h
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


Laden…
Abbrechen
Speichern