-
Notifications
You must be signed in to change notification settings - Fork 0
/
osc.ino
61 lines (44 loc) · 1.13 KB
/
osc.ino
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
IPAddress broadcastIP(255, 255, 255, 255);
const unsigned int outPort = 9000;
void setupOSC()
{
// send reset reason boradcast
sendRestartReason();
}
void sendRestartReason()
{
Serial.print("Restart reason: ");
Serial.println(ESP.getResetReason());
rst_info *resetInfo = ESP.getResetInfoPtr();
OSCMessage msg(concatStr("/nachtmensch/status/", deviceName));
// add software version
msg.add(version);
// add reason
msg.add(resetInfo->reason);
// add extended information
//exccause
msg.add(resetInfo->exccause);
//epc1
msg.add(resetInfo->epc1);
//epc2
msg.add(resetInfo->epc2);
//epc3
msg.add(resetInfo->epc3);
//excvaddr
msg.add(resetInfo->excvaddr);
//depc
msg.add(resetInfo->depc);
ESP.wdtFeed();
Udp.beginPacket(broadcastIP, outPort);
msg.send(Udp); // send the bytes to the SLIP stream
Udp.endPacket(); // mark the end of the OSC Packet
msg.empty(); // free space occupied by message
}
void routeOSCMessage(OSCMessage &msg)
{
msg.route("/nachtmensch/warning", warningReceived);
}
void warningReceived(OSCMessage &msg, int addrOffset)
{
Serial.println("received warning!");
}