base lista

This commit is contained in:
richonguzman 2025-01-01 13:02:38 -03:00
parent ad5a5ccf18
commit 56d63d0389
8 changed files with 51 additions and 5 deletions

View File

@ -90,7 +90,8 @@
"lowVoltageCutOff": 0,
"backupDigiMode": false,
"rebootMode": false,
"rebootModeTime": 6
"rebootModeTime": 6,
"blackList": ""
},
"personalNote": ""
}

View File

@ -50,7 +50,6 @@ public:
bool ecoMode;
};
class LoraModule {
public:
long txFreq;
@ -135,6 +134,7 @@ public:
bool rebootMode;
int rebootModeTime;
String personalNote;
String blackList;
std::vector<WiFi_AP> wifiAPs;
WiFi_Auto_AP wifiAutoAP;
BEACON beacon;

View File

@ -18,6 +18,8 @@ struct LastHeardStation {
namespace STATION_Utils {
void loadBlackList();
bool checkBlackList(const String& callsign);
void deleteNotHeard();
void updateLastHeard(const String& station);
bool wasHeard(const String& station);

View File

@ -48,7 +48,7 @@ ___________________________________________________________________*/
#include "A7670_utils.h"
#endif
String versionDate = "2024.12.31";
String versionDate = "2025.01.01";
Configuration Config;
WiFiClient espClient;
#ifdef HAS_GPS
@ -79,6 +79,7 @@ void setup() {
LoRa_Utils::setup();
Utils::validateFreqs();
GPS_Utils::setup();
STATION_Utils::loadBlackList();
#ifdef STARTUP_DELAY // (TEST) just to wait for WiFi init of Routers
displayShow("", " STARTUP DELAY ...", "", "", 0);

View File

@ -178,7 +178,7 @@ namespace APRS_IS_Utils {
int firstColonIndex = packet.indexOf(":");
if (firstColonIndex > 5 && firstColonIndex < (packet.length() - 1) && packet[firstColonIndex + 1] != '}' && packet.indexOf("TCPIP") == -1) {
const String& Sender = packet.substring(3, packet.indexOf(">"));
if (Sender != Config.callsign && Utils::checkValidCallsign(Sender)) {
if (Sender != Config.callsign && Utils::checkValidCallsign(Sender) && !STATION_Utils::checkBlackList(Sender)) {
STATION_Utils::updateLastHeard(Sender);
Utils::typeOfPacket(packet.substring(3), 0); // LoRa-APRS
const String& AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);

View File

@ -99,6 +99,8 @@ void Configuration::writeFile() {
data["personalNote"] = personalNote;
data["blackList"] = blackList;
data["webadmin"]["active"] = webadmin.active;
data["webadmin"]["username"] = webadmin.username;
data["webadmin"]["password"] = webadmin.password;
@ -221,6 +223,8 @@ bool Configuration::readFile() {
personalNote = data["personalNote"] | "personal note here...";
blackList = data["blackList"] | "";
if (wifiAPs.size() == 0) { // If we don't have any WiFi's from config we need to add "empty" SSID for AUTO AP
WiFi_AP wifiap;
wifiap.ssid = "";
@ -327,6 +331,8 @@ void Configuration::init() {
personalNote = "";
blackList = "";
webadmin.active = false;
webadmin.username = "admin";
webadmin.password = "";

View File

@ -130,7 +130,7 @@ namespace DIGI_Utils {
temp = packet.substring(3);
Sender = packet.substring(3, packet.indexOf(">"));
}
if (Sender != Config.callsign) { // Avoid listening to own packets
if (Sender != Config.callsign && !STATION_Utils::checkBlackList(Sender)) { // Avoid listening to own packets
if (!thirdPartyPacket && !Utils::checkValidCallsign(Sender)) {
return;
}

View File

@ -16,12 +16,47 @@ uint32_t lastTxTime = millis();
std::vector<LastHeardStation> lastHeardStations;
std::vector<String> outputPacketBuffer;
std::vector<Packet25SegBuffer> packet25SegBuffer;
std::vector<String> blackList;
bool saveNewDigiEcoModeConfig = false;
namespace STATION_Utils {
void loadBlackList() {
if (Config.blackList != "") {
String callsigns = Config.blackList;
int spaceIndex = callsigns.indexOf(" ");
while (spaceIndex >= 0) {
blackList.push_back(callsigns.substring(0, spaceIndex));
callsigns = callsigns.substring(spaceIndex + 1);
spaceIndex = callsigns.indexOf(" ");
}
callsigns.trim();
if (callsigns.length() > 0) blackList.push_back(callsigns); // Add the last word if available
// Print the vector
if (!blackList.empty()) {
for (int i = 0; i < blackList.size(); i++) {
Serial.println(blackList[i]);
}
}
//
}
}
bool checkBlackList(const String& callsign) {
if (!blackList.empty()) {
for (int i = 0; i < blackList.size(); i++) {
if (blackList[i] == callsign) return true;
}
}
return false;
}
void deleteNotHeard() {
std::vector<LastHeardStation> lastHeardStation_temp;
for (int i = 0; i < lastHeardStations.size(); i++) {
@ -72,6 +107,7 @@ namespace STATION_Utils {
Utils::println(" ---> Station not Heard for last 30 min (Not Tx)\n");
return false;
}
void clean25SegBuffer() {
if (!packet25SegBuffer.empty() && (millis() - packet25SegBuffer[0].receivedTime) > 25 * 1000) packet25SegBuffer.erase(packet25SegBuffer.begin());
}