Implements preprocessor flags to control advert limits
https://github.com/meshcore-dev/MeshCore/pull/1217#issuecomment-3654930555
This commit is contained in:
@@ -23,12 +23,16 @@ lib_deps =
|
|||||||
adafruit/RTClib @ ^2.1.3
|
adafruit/RTClib @ ^2.1.3
|
||||||
melopero/Melopero RV3028 @ ^1.1.0
|
melopero/Melopero RV3028 @ ^1.1.0
|
||||||
electroniccats/CayenneLPP @ 1.6.1
|
electroniccats/CayenneLPP @ 1.6.1
|
||||||
build_flags = -w -DNDEBUG -DRADIOLIB_STATIC_ONLY=1 -DRADIOLIB_GODMODE=1
|
build_flags = -w -DNDEBUG
|
||||||
-D LORA_FREQ=869.525
|
-D LORA_FREQ=869.525
|
||||||
-D LORA_BW=250
|
-D LORA_BW=250
|
||||||
-D LORA_SF=11
|
-D LORA_SF=11
|
||||||
|
;
|
||||||
-D ENABLE_PRIVATE_KEY_IMPORT=1 ; NOTE: comment these out for more secure firmware
|
-D ENABLE_PRIVATE_KEY_IMPORT=1 ; NOTE: comment these out for more secure firmware
|
||||||
-D ENABLE_PRIVATE_KEY_EXPORT=1
|
-D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||||
|
;
|
||||||
|
-D RADIOLIB_STATIC_ONLY=1
|
||||||
|
-D RADIOLIB_GODMODE=1
|
||||||
-D RADIOLIB_EXCLUDE_CC1101=1
|
-D RADIOLIB_EXCLUDE_CC1101=1
|
||||||
-D RADIOLIB_EXCLUDE_RF69=1
|
-D RADIOLIB_EXCLUDE_RF69=1
|
||||||
-D RADIOLIB_EXCLUDE_SX1231=1
|
-D RADIOLIB_EXCLUDE_SX1231=1
|
||||||
@@ -43,6 +47,11 @@ build_flags = -w -DNDEBUG -DRADIOLIB_STATIC_ONLY=1 -DRADIOLIB_GODMODE=1
|
|||||||
-D RADIOLIB_EXCLUDE_BELL=1
|
-D RADIOLIB_EXCLUDE_BELL=1
|
||||||
-D RADIOLIB_EXCLUDE_RTTY=1
|
-D RADIOLIB_EXCLUDE_RTTY=1
|
||||||
-D RADIOLIB_EXCLUDE_SSTV=1
|
-D RADIOLIB_EXCLUDE_SSTV=1
|
||||||
|
;
|
||||||
|
-D MIN_LOCAL_ADVERT_INTERVAL=60
|
||||||
|
-D MAX_LOCAL_ADVERT_INTERVAL=240
|
||||||
|
-D MIN_FLOOD_ADVERT_INTERVAL=3
|
||||||
|
-D MAX_FLOOD_ADVERT_INTERVAL=48
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
+<*.cpp>
|
+<*.cpp>
|
||||||
+<helpers/*.cpp>
|
+<helpers/*.cpp>
|
||||||
|
|||||||
@@ -157,8 +157,6 @@ void CommonCLI::savePrefs(FILESYSTEM* fs) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MIN_LOCAL_ADVERT_INTERVAL 60
|
|
||||||
|
|
||||||
void CommonCLI::savePrefs() {
|
void CommonCLI::savePrefs() {
|
||||||
if (_prefs->advert_interval * 2 < MIN_LOCAL_ADVERT_INTERVAL) {
|
if (_prefs->advert_interval * 2 < MIN_LOCAL_ADVERT_INTERVAL) {
|
||||||
_prefs->advert_interval = 0; // turn it off, now that device has been manually configured
|
_prefs->advert_interval = 0; // turn it off, now that device has been manually configured
|
||||||
@@ -372,8 +370,9 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
|
|||||||
strcpy(reply, "OK");
|
strcpy(reply, "OK");
|
||||||
} else if (memcmp(config, "flood.advert.interval ", 22) == 0) {
|
} else if (memcmp(config, "flood.advert.interval ", 22) == 0) {
|
||||||
int hours = _atoi(&config[22]);
|
int hours = _atoi(&config[22]);
|
||||||
if ((hours > 0 && hours < 3) || (hours > 48)) {
|
if ((hours > 0 && hours < MIN_FLOOD_ADVERT_INTERVAL) || (hours > MAX_FLOOD_ADVERT_INTERVAL)) {
|
||||||
strcpy(reply, "Error: interval range is 3-48 hours");
|
sprintf(reply, "Error: interval range is %d-%d hours", MIN_FLOOD_ADVERT_INTERVAL,
|
||||||
|
MAX_FLOOD_ADVERT_INTERVAL);
|
||||||
} else {
|
} else {
|
||||||
_prefs->flood_advert_interval = (uint8_t)(hours);
|
_prefs->flood_advert_interval = (uint8_t)(hours);
|
||||||
_callbacks->updateFloodAdvertTimer();
|
_callbacks->updateFloodAdvertTimer();
|
||||||
@@ -382,8 +381,9 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
|
|||||||
}
|
}
|
||||||
} else if (memcmp(config, "advert.interval ", 16) == 0) {
|
} else if (memcmp(config, "advert.interval ", 16) == 0) {
|
||||||
int mins = _atoi(&config[16]);
|
int mins = _atoi(&config[16]);
|
||||||
if ((mins > 0 && mins < MIN_LOCAL_ADVERT_INTERVAL) || (mins > 240)) {
|
if ((mins > 0 && mins < MIN_LOCAL_ADVERT_INTERVAL) || (mins > MAX_LOCAL_ADVERT_INTERVAL)) {
|
||||||
sprintf(reply, "Error: interval range is %d-240 minutes", MIN_LOCAL_ADVERT_INTERVAL);
|
sprintf(reply, "Error: interval range is %d-%d minutes",MIN_LOCAL_ADVERT_INTERVAL,
|
||||||
|
MAX_LOCAL_ADVERT_INTERVAL);
|
||||||
} else {
|
} else {
|
||||||
_prefs->advert_interval = (uint8_t)(mins / 2);
|
_prefs->advert_interval = (uint8_t)(mins / 2);
|
||||||
_callbacks->updateAdvertTimer();
|
_callbacks->updateAdvertTimer();
|
||||||
|
|||||||
Reference in New Issue
Block a user