更新ESPNow的默认STA_IF模式

This commit is contained in:
dahanzimin
2024-10-26 12:36:47 +08:00
parent 99e168f363
commit ee411033e2

View File

@@ -61,9 +61,9 @@ class ESPNow(espnow.ESPNow):
else :
return None,None
def set_channel(self,channel=None,txpower=None):
def set_channel(self, channel=None, txpower=None):
self._channel = self._channel if channel is None else channel
self._nic.config(hidden=True, channel=self._channel, txpower=self._txpower if txpower is None else txpower)
self._nic.config(channel=self._channel, txpower=self._txpower if txpower is None else txpower)
def _cb_handle0(self, event_code, data):
'''Callback processing conversion'''
@@ -74,11 +74,11 @@ class ESPNow(espnow.ESPNow):
if cmd != -1:
cmd=func.__name__[cmd+2:]
if cmd == str(data[1].decode()):
func(hexlify(data[0]).decode(),data[1].decode())
func(hexlify(data[0]).decode(), data[1].decode())
else:
func(hexlify(data[0]).decode(),data[1].decode())
func(hexlify(data[0]).decode(), data[1].decode())
else:
self._on_handle(hexlify(data[0]).decode(),data[1].decode())
self._on_handle(hexlify(data[0]).decode(), data[1].decode())
def _cb_handle1(self, ee):
'''Callback processing conversion'''
@@ -109,7 +109,7 @@ class ESPNow(espnow.ESPNow):
'''Get the paired Mac and rssi'''
_info=[]
for i in self.peers_table:
_info.append((hexlify(i).decode(),self.peers_table[i][0]))
_info.append((hexlify(i).decode(), self.peers_table[i][0]))
return _info
@property