mirror of
https://github.com/okalachev/flix.git
synced 2026-08-16 00:38:56 +00:00
Disable swarming in espnow proxy by default
This commit is contained in:
@@ -11,16 +11,21 @@
|
|||||||
#include <Preferences.h>
|
#include <Preferences.h>
|
||||||
#include "../../flix/util.h"
|
#include "../../flix/util.h"
|
||||||
|
|
||||||
|
const bool DISABLE_SWARM = true;
|
||||||
const int CHANNEL = 6;
|
const int CHANNEL = 6;
|
||||||
char key[ESP_NOW_KEY_LEN + 1] = {0}; // with trailing null
|
char key[ESP_NOW_KEY_LEN + 1] = {0}; // with trailing null
|
||||||
|
|
||||||
Preferences storage;
|
Preferences storage;
|
||||||
|
|
||||||
std::vector<ESPNOWSerial *> peers;
|
std::vector<ESPNOWSerial *> peers;
|
||||||
|
bool stop = false;
|
||||||
|
|
||||||
void onNewPeer(const esp_now_recv_info_t *info, const uint8_t *data, int len, void *arg) {
|
void onNewPeer(const esp_now_recv_info_t *info, const uint8_t *data, int len, void *arg) {
|
||||||
if (len != 4 || memcmp(data, "flix", 4) != 0) return; // check if discovery message
|
if (len != 4 || memcmp(data, "flix", 4) != 0) return; // check if discovery message
|
||||||
|
|
||||||
|
if (stop) return;
|
||||||
|
if (DISABLE_SWARM) stop = true;
|
||||||
|
|
||||||
Serial.printf("New peer: " MACSTR "\n", MAC2STR(info->src_addr));
|
Serial.printf("New peer: " MACSTR "\n", MAC2STR(info->src_addr));
|
||||||
ESPNOWSerial *link = new ESPNOWSerial(info->src_addr, CHANNEL, WIFI_IF_AP);
|
ESPNOWSerial *link = new ESPNOWSerial(info->src_addr, CHANNEL, WIFI_IF_AP);
|
||||||
link->begin();
|
link->begin();
|
||||||
|
|||||||
Reference in New Issue
Block a user