Skip to content

Commit

Permalink
RfModule Check for range options
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorcelli committed Oct 3, 2024
1 parent e3a223c commit 9dd3d3d
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/modules/rf/rf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1328,25 +1328,27 @@ void rf_scan_copy() {
}

if (option == 1) {
options = {
{ String("Fxd [" + String(RfFreq) + "]").c_str(), [&]() { RfFxdFreq = 1; ELECHOUSE_cc1101.setMHZ(RfFreq); } },
{ sz_range[0], [&]() { RfScanRange = 0; RfFxdFreq = 0; } },
{ sz_range[1], [&]() { RfScanRange = 1; RfFxdFreq = 0; } },
{ sz_range[2], [&]() { RfScanRange = 2; RfFxdFreq = 0; } },
{ sz_range[3], [&]() { RfScanRange = 3; RfFxdFreq = 0; } },
};

delay(200);
loopOptions(options);

if (RfFxdFreq) {
displayRedStripe("Scan freq set to " + String(RfFreq), TFT_WHITE, FGCOLOR);
}
else {
displayRedStripe("Range set to " + String(sz_range[RfScanRange]), TFT_WHITE, FGCOLOR);
}
saveConfigs();
delay(1500);
if(RfModule) {
options = {
{ String("Fxd [" + String(RfFreq) + "]").c_str(), [&]() { RfFxdFreq = 1; ELECHOUSE_cc1101.setMHZ(RfFreq); } },
{ sz_range[0], [&]() { RfScanRange = 0; RfFxdFreq = 0; } },
{ sz_range[1], [&]() { RfScanRange = 1; RfFxdFreq = 0; } },
{ sz_range[2], [&]() { RfScanRange = 2; RfFxdFreq = 0; } },
{ sz_range[3], [&]() { RfScanRange = 3; RfFxdFreq = 0; } },
};

delay(200);
loopOptions(options);

if (RfFxdFreq) {
displayRedStripe("Scan freq set to " + String(RfFreq), TFT_WHITE, FGCOLOR);
}
else {
displayRedStripe("Range set to " + String(sz_range[RfScanRange]), TFT_WHITE, FGCOLOR);
}
saveConfigs();
delay(1500);
} else displayWarning("Need CC1101");
goto RestartScan;
}
else if (option == 2) {
Expand Down

0 comments on commit 9dd3d3d

Please sign in to comment.