Skip to content

A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol

minor refactor for subghz send

Geo18be95296441
diff --git a/src/Controllers/SubGhzController.cpp b/src/Controllers/SubGhzController.cpp
index 9ab24943..ab025df4 100644
--- a/src/Controllers/SubGhzController.cpp
+++ b/src/Controllers/SubGhzController.cpp
@@ -620,10 +620,10 @@ void SubGhzController::handleListen() {
terminalView.println("[INFO] Using I2S configured pins for audio output.\n");
// Mapping params
- const int fMin = 800; // Hz for weak signals
- const int fMax = 12000; // Hz for strong signals
- const int toneMs = 1; // short sound
- const int refreshUs = 200; // 5 kHz update rate
+ const uint16_t fMin = 800; // Hz for weak signals
+ const uint16_t fMax = 12000; // Hz for strong signals
+ const uint16_t toneMs = 1; // short sound
+ const uint16_t refreshUs = 200; // 5 kHz update rate
while (true) {
// Stop on ENTER
@@ -636,18 +636,14 @@ void SubGhzController::handleListen() {
float norm = (rssi + 120.0f) / 120.0f; // normalize dbm
if (norm < 0) norm = 0;
if (norm > 1) norm = 1;
- int freqHz = fMin + (int)(norm * (fMax - fMin));
+ uint16_t freqHz = fMin + (uint16_t)(norm * (fMax - fMin));
// Play the tone on I2S configured pins
- i2sService.playTone(state.getI2sSampleRate(),
- (uint16_t)freqHz,
- (uint16_t)toneMs);
+ i2sService.playTone(state.getI2sSampleRate(), freqHz, toneMs);
}
delayMicroseconds(refreshUs);
}
-
- subGhzService.tune(mhz);
}
/*