@@ -162,10 +162,10 @@ public:
162
162
void onSent (bool success) {
163
163
bool broadcast = memcmp (addr (), ESP_NOW.BROADCAST_ADDR , ESP_NOW_ETH_ALEN) == 0 ;
164
164
if (broadcast) {
165
- log_v (" Broadcast message reported as sent %s" , success ? " successfully" : " unsuccessfully" );
165
+ log_i (" Broadcast message reported as sent %s" , success ? " successfully" : " unsuccessfully" );
166
166
}
167
167
else {
168
- log_v (" Unicast message reported as sent %s to peer " MACSTR, success ? " successfully" : " unsuccessfully" , MAC2STR (addr ()));
168
+ log_i (" Unicast message reported as sent %s to peer " MACSTR, success ? " successfully" : " unsuccessfully" , MAC2STR (addr ()));
169
169
}
170
170
}
171
171
};
@@ -253,16 +253,17 @@ void setup() {
253
253
Serial.begin (115200 );
254
254
while (!Serial) delay (10 );
255
255
256
+ // Initialize the Wi-Fi module
257
+ WiFi.mode (WIFI_STA);
258
+ WiFi.setChannel (ESPNOW_WIFI_CHANNEL);
259
+ while (!WiFi.STA .started ()) delay (100 );
260
+
256
261
Serial.println (" ESP-NOW Network Example" );
257
262
Serial.println (" Wi-Fi parameters:" );
258
263
Serial.println (" Mode: STA" );
259
264
Serial.println (" MAC Address: " + WiFi.macAddress ());
260
265
Serial.printf (" Channel: %d\n " , ESPNOW_WIFI_CHANNEL);
261
266
262
- // Initialize the Wi-Fi module
263
- WiFi.mode (WIFI_STA);
264
- WiFi.setChannel (ESPNOW_WIFI_CHANNEL);
265
-
266
267
// Generate yhis device's priority based on the 3 last bytes of the MAC address
267
268
WiFi.macAddress (self_mac);
268
269
self_priority = self_mac[3 ] << 16 | self_mac[4 ] << 8 | self_mac[5 ];
0 commit comments