@@ -29,12 +29,17 @@ int status = WL_IDLE_STATUS;
29
29
int count = 0 ;
30
30
31
31
void setUpSubscription () {
32
+ Serial.println (" Setting up subscription" );
33
+
32
34
client.begin (" /signalk/v1/stream?subscribe=none" );
33
35
34
36
while (!client.connected ()) {
37
+ printDots ();
38
+ delay (500 );
35
39
; // wait to connect
36
40
}
37
41
42
+ Serial.println (" connected" );
38
43
client.beginMessage (TYPE_TEXT);
39
44
client.print (" {\" context\" :\" vessels.self\" ,\" subscribe\" : [{\" path\" : \" entertainment.device.fusion1.output.*\" }]}" );
40
45
client.endMessage ();
@@ -48,9 +53,14 @@ void setup() {
48
53
while ( status != WL_CONNECTED) {
49
54
Serial.print (" Attempting to connect to Network named: " );
50
55
Serial.println (ssid); // print the network name (SSID);
56
+ Serial.print (" . Password: " );
57
+ Serial.println (pass);
51
58
52
59
// Connect to WPA/WPA2 network:
53
60
status = WiFi.begin (ssid, pass);
61
+ if (status != WL_CONNECTED) {
62
+ delay (1000 ); // wait a bit and try again
63
+ }
54
64
}
55
65
56
66
// print the SSID of the network you're attached to:
@@ -61,8 +71,6 @@ void setup() {
61
71
IPAddress ip = WiFi.localIP ();
62
72
Serial.print (" IP Address: " );
63
73
Serial.println (ip);
64
-
65
- Serial.println (" starting WebSocket client" );
66
74
67
75
}
68
76
@@ -93,8 +101,7 @@ void printVolumeUpdates(String message) {
93
101
int volume = updates_0[" values" ][0 ][" value" ]; // 10
94
102
95
103
Serial.println ();
96
- Serial.print (" path: " );
97
-
104
+
98
105
char * completePath = const_cast <char *>(path);
99
106
100
107
MatchState ms;
@@ -119,15 +126,14 @@ static void printDots() {
119
126
count = 0 ;
120
127
} else {
121
128
Serial.print (" ." );
129
+ count = count + 1 ;
122
130
}
123
131
}
124
132
125
133
126
134
void loop () {
127
135
setUpSubscription ();
128
136
while (client.connected ()) {
129
- // increment count for next message
130
- count++;
131
137
132
138
// check if a message is available to be received
133
139
int messageSize = client.parseMessage ();
0 commit comments