recognize ota trigger mac when sniffing for new macs in wifi environment
This commit is contained in:
parent
e92bcbd8b1
commit
a806c5e463
@ -94,6 +94,25 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) {
|
||||
|
||||
// Count only if MAC was not yet seen
|
||||
if (added) {
|
||||
ESP_LOGD(TAG, "new Mac: %x:%x:%x:%x:%x:%x",
|
||||
paddr[0],
|
||||
paddr[1],
|
||||
paddr[2],
|
||||
paddr[3],
|
||||
paddr[4],
|
||||
paddr[5]
|
||||
);
|
||||
// is newly found MAC the OTA trigger?
|
||||
uint64_t addr48 = (((uint64_t)paddr[3]) | ((uint64_t)paddr[2] << 8) |
|
||||
((uint64_t)paddr[1] << 16) | ((uint64_t)paddr[0] << 24));
|
||||
if((int)(addr48-fota_trigger_mac) == 0)
|
||||
{
|
||||
ESP_LOGI(TAG, "OTA-MAC found, Update triggered");
|
||||
// initiate OTA update
|
||||
uint8_t cmd[2] = {9, 9};
|
||||
rcommand(cmd, 2);
|
||||
}
|
||||
|
||||
// increment counter and one blink led
|
||||
if (sniff_type == MAC_SNIFF_WIFI) {
|
||||
macs_wifi++; // increment Wifi MACs counter
|
||||
@ -146,4 +165,4 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) {
|
||||
// True if MAC WiFi/BLE was new
|
||||
return added; // function returns bool if a new and unique Wifi or BLE mac was
|
||||
// counted (true) or not (false)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user