Skip to content

Commit 8009cf0

Browse files
authored
Merge pull request meshcore-dev#2126 from recrof/allow-lower-freq
Allow to set lower LoRa frequency
2 parents 1ccb054 + 285fc68 commit 8009cf0

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

examples/companion_radio/MyMesh.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ bool MyMesh::shouldAutoAddContactType(uint8_t contact_type) const {
292292
if ((_prefs.manual_add_contacts & 1) == 0) {
293293
return true;
294294
}
295-
295+
296296
uint8_t type_bit = 0;
297297
switch (contact_type) {
298298
case ADV_TYPE_CHAT:
@@ -310,7 +310,7 @@ bool MyMesh::shouldAutoAddContactType(uint8_t contact_type) const {
310310
default:
311311
return false; // Unknown type, don't auto-add
312312
}
313-
313+
314314
return (_prefs.autoadd_config & type_bit) != 0;
315315
}
316316

@@ -859,7 +859,7 @@ void MyMesh::begin(bool has_display) {
859859
// sanitise bad pref values
860860
_prefs.rx_delay_base = constrain(_prefs.rx_delay_base, 0, 20.0f);
861861
_prefs.airtime_factor = constrain(_prefs.airtime_factor, 0, 9.0f);
862-
_prefs.freq = constrain(_prefs.freq, 400.0f, 2500.0f);
862+
_prefs.freq = constrain(_prefs.freq, 150.0f, 2500.0f);
863863
_prefs.bw = constrain(_prefs.bw, 7.8f, 500.0f);
864864
_prefs.sf = constrain(_prefs.sf, 5, 12);
865865
_prefs.cr = constrain(_prefs.cr, 5, 8);
@@ -1264,7 +1264,7 @@ void MyMesh::handleCmdFrame(size_t len) {
12641264

12651265
if (repeat && !isValidClientRepeatFreq(freq)) {
12661266
writeErrFrame(ERR_CODE_ILLEGAL_ARG);
1267-
} else if (freq >= 300000 && freq <= 2500000 && sf >= 5 && sf <= 12 && cr >= 5 && cr <= 8 && bw >= 7000 &&
1267+
} else if (freq >= 150000 && freq <= 2500000 && sf >= 5 && sf <= 12 && cr >= 5 && cr <= 8 && bw >= 7000 &&
12681268
bw <= 500000) {
12691269
_prefs.sf = sf;
12701270
_prefs.cr = cr;
@@ -1620,7 +1620,7 @@ void MyMesh::handleCmdFrame(size_t len) {
16201620
} else if (cmd_frame[0] == CMD_SEND_TRACE_PATH && len > 10 && len - 10 < MAX_PACKET_PAYLOAD-5) {
16211621
uint8_t path_len = len - 10;
16221622
uint8_t flags = cmd_frame[9];
1623-
uint8_t path_sz = flags & 0x03; // NEW v1.11+
1623+
uint8_t path_sz = flags & 0x03; // NEW v1.11+
16241624
if ((path_len >> path_sz) > MAX_PATH_SIZE || (path_len % (1 << path_sz)) != 0) { // make sure is multiple of path_sz
16251625
writeErrFrame(ERR_CODE_ILLEGAL_ARG);
16261626
} else {
@@ -1927,7 +1927,7 @@ void MyMesh::checkCLIRescueCmd() {
19271927

19281928
// get path from command e.g: "cat /contacts3"
19291929
const char *path = &cli_command[4];
1930-
1930+
19311931
bool is_fs2 = false;
19321932
if (memcmp(path, "UserData/", 9) == 0) {
19331933
path += 8; // skip "UserData"

src/helpers/CommonCLI.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void CommonCLI::loadPrefsInt(FILESYSTEM* fs, const char* filename) {
9595
_prefs->tx_delay_factor = constrain(_prefs->tx_delay_factor, 0, 2.0f);
9696
_prefs->direct_tx_delay_factor = constrain(_prefs->direct_tx_delay_factor, 0, 2.0f);
9797
_prefs->airtime_factor = constrain(_prefs->airtime_factor, 0, 9.0f);
98-
_prefs->freq = constrain(_prefs->freq, 400.0f, 2500.0f);
98+
_prefs->freq = constrain(_prefs->freq, 150.0f, 2500.0f);
9999
_prefs->bw = constrain(_prefs->bw, 7.8f, 500.0f);
100100
_prefs->sf = constrain(_prefs->sf, 5, 12);
101101
_prefs->cr = constrain(_prefs->cr, 5, 8);
@@ -275,7 +275,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
275275
uint8_t sf = num > 2 ? atoi(parts[2]) : 0;
276276
uint8_t cr = num > 3 ? atoi(parts[3]) : 0;
277277
int temp_timeout_mins = num > 4 ? atoi(parts[4]) : 0;
278-
if (freq >= 300.0f && freq <= 2500.0f && sf >= 5 && sf <= 12 && cr >= 5 && cr <= 8 && bw >= 7.0f && bw <= 500.0f && temp_timeout_mins > 0) {
278+
if (freq >= 150.0f && freq <= 2500.0f && sf >= 5 && sf <= 12 && cr >= 5 && cr <= 8 && bw >= 7.0f && bw <= 500.0f && temp_timeout_mins > 0) {
279279
_callbacks->applyTempRadioParams(freq, bw, sf, cr, temp_timeout_mins);
280280
sprintf(reply, "OK - temp params for %d mins", temp_timeout_mins);
281281
} else {
@@ -535,7 +535,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
535535
float bw = num > 1 ? strtof(parts[1], nullptr) : 0.0f;
536536
uint8_t sf = num > 2 ? atoi(parts[2]) : 0;
537537
uint8_t cr = num > 3 ? atoi(parts[3]) : 0;
538-
if (freq >= 300.0f && freq <= 2500.0f && sf >= 5 && sf <= 12 && cr >= 5 && cr <= 8 && bw >= 7.0f && bw <= 500.0f) {
538+
if (freq >= 150.0f && freq <= 2500.0f && sf >= 5 && sf <= 12 && cr >= 5 && cr <= 8 && bw >= 7.0f && bw <= 500.0f) {
539539
_prefs->sf = sf;
540540
_prefs->cr = cr;
541541
_prefs->freq = freq;
@@ -720,7 +720,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
720720
}
721721
} else if (memcmp(command, "sensor set ", 11) == 0) {
722722
strcpy(tmp, &command[11]);
723-
const char *parts[2];
723+
const char *parts[2];
724724
int num = mesh::Utils::parseTextParts(tmp, parts, 2, ' ');
725725
const char *key = (num > 0) ? parts[0] : "";
726726
const char *value = (num > 1) ? parts[1] : "null";
@@ -743,7 +743,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
743743
dp = strchr(dp, 0);
744744
int i;
745745
for (i = start; i < end && (dp-reply < 134); i++) {
746-
sprintf(dp, "%s=%s\n",
746+
sprintf(dp, "%s=%s\n",
747747
_sensors->getSettingName(i),
748748
_sensors->getSettingValue(i));
749749
dp = strchr(dp, 0);
@@ -823,8 +823,8 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
823823
bool active = !strcmp(_sensors->getSettingByKey("gps"), "1");
824824
if (enabled) {
825825
sprintf(reply, "on, %s, %s, %d sats",
826-
active?"active":"deactivated",
827-
fix?"fix":"no fix",
826+
active?"active":"deactivated",
827+
fix?"fix":"no fix",
828828
sats);
829829
} else {
830830
strcpy(reply, "off");

0 commit comments

Comments
 (0)