Disable swarming in espnow proxy by default

This commit is contained in:
Oleg Kalachev
2026-07-16 11:30:10 +03:00
parent 61213bb8a1
commit 70459df8dd
+5
View File
@@ -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();