This repository was archived by the owner on Sep 16, 2024. It is now read-only.
File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 60
60
#include "modespnow.h"
61
61
#include "mpirq.h"
62
62
#include "pycom_general_util.h"
63
+ #include "modwlan.h"
63
64
64
65
/******************************************************************************
65
66
DEFINE CONSTANTS
@@ -243,6 +244,9 @@ STATIC void mod_esp_espnow_exceptions(esp_err_t e) {
243
244
case ESP_ERR_ESPNOW_EXIST :
244
245
mp_raise_msg (& mp_type_OSError , "ESP-Now Peer Exists" );
245
246
break ;
247
+ case ESP_ERR_ESPNOW_IF :
248
+ mp_raise_msg (& mp_type_OSError , "ESP-Now Wifi Interface error" );
249
+ break ;
246
250
default :
247
251
nlr_raise (mp_obj_new_exception_msg_varg (
248
252
& mp_type_RuntimeError , "ESP-Now Unknown Error 0x%04x" , e
@@ -444,6 +448,15 @@ STATIC mp_obj_t mod_espnow_add_peer(size_t n_args, const mp_obj_t *args) {
444
448
else {
445
449
peer .encrypt = false;
446
450
}
451
+
452
+ // Use the WIFI Station interface if configured otherwise use AP interface
453
+ if (wlan_obj .esp_netif_STA ) {
454
+ peer .ifidx = ESP_IF_WIFI_STA ;
455
+ }
456
+ else if (wlan_obj .esp_netif_AP ) {
457
+ peer .ifidx = ESP_IF_WIFI_AP ;
458
+ }
459
+
447
460
mod_esp_espnow_exceptions (esp_now_add_peer (& peer ));
448
461
449
462
mod_espnow_peer_obj_t * peer_obj = m_new_obj (mod_espnow_peer_obj_t );
You can’t perform that action at this time.
0 commit comments