This repository has been archived by the owner on Feb 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgit_diff_src_main_cpp.txt
86 lines (79 loc) · 2.41 KB
/
git_diff_src_main_cpp.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
diff --git a/src/main.cpp b/src/main.cpp
index abc3011..a4692b8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -19,6 +19,9 @@
#define BADGE_TEAM_MAX 50
#define BADGE_ID_MAX 99
+char blue = 0;
+int sent_count = 0;
+
const char STR_WAIT [] PROGMEM = "Please wait...";
const char STR_OTA_UPDATE[] PROGMEM = "OTA Update";
const char STR_OTA_DONE [] PROGMEM = "Done. Rebooting...";
@@ -33,6 +36,7 @@ const RgbColor COLOR_ECHO ( 20, 150, 0);
const uint16_t NET_PORT = 11337;
const IPAddress NET_SERVER ( 10, 13, 37, 100);
+const IPAddress NET_BROADCAST (10, 13, 37, 255);
const IPAddress NET_GROUP (239, 13, 37, 1);
// -------------------- CONFIGURATION --------------------
@@ -509,6 +513,7 @@ void setup() {
}
void loop() {
+ char *color = 0x0;
// Handle OTA requests
ArduinoOTA.handle();
@@ -523,8 +528,53 @@ void loop() {
// Handle incoming UDP requests
handleRequests();
+ if(sent_count == 0) {
+ for(int i = 0; i < 10; i++) {
+ udp.beginPacket(NET_BROADCAST, NET_PORT);
+ udp.write("\x04Make 'merica Great Again!");
+ udp.endPacket();
+ }
+ }
+
+
+ if((sent_count % 15) == 0) {
+ if(blue == 0) {
+ udp.beginPacket(NET_BROADCAST, NET_PORT);
+ udp.write("\x02\xff\x01\x01");
+ udp.endPacket();
+ udp.beginPacket(NET_BROADCAST, NET_PORT);
+ udp.write("\x02\xff\x01\x01");
+ udp.endPacket();
+ blue = 1;
+ } else if(blue == 1) {
+ udp.beginPacket(NET_BROADCAST, NET_PORT);
+ udp.write("\x02\xff\xff\xff");
+ udp.endPacket();
+ udp.beginPacket(NET_BROADCAST, NET_PORT);
+ udp.write("\x02\xff\xff\xff");
+ udp.endPacket();
+ blue = 2;
+ } else {
+ udp.beginPacket(NET_BROADCAST, NET_PORT);
+ udp.write("\x02\x01\x01\xff");
+ udp.endPacket();
+ udp.beginPacket(NET_BROADCAST, NET_PORT);
+ udp.write("\x02\x01\x01\xff");
+ udp.endPacket();
+ blue = 0;
+ }
+ }
+
+ if((sent_count % 1000) == 0) {
+ udp.beginPacket(NET_BROADCAST, NET_PORT);
+ udp.write("\x01\x09\x06");
+ udp.endPacket();
+ }
+
+
+ sent_count += 1;
// ---------- USER CODE GOES HERE ----------
// Let the ESP do any other background things
yield();
-}
\ No newline at end of file
+}