Skip to content

Commit

Permalink
Update radio.c
Browse files Browse the repository at this point in the history
  • Loading branch information
losehu authored Aug 6, 2024
1 parent de51b96 commit 8cfecc6
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,18 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) {
uint16_t noise_close = pInfo->SquelchCloseNoiseThresh;
uint16_t glitch_open = pInfo->SquelchOpenGlitchThresh;
uint16_t glitch_close = pInfo->SquelchCloseGlitchThresh;
uint8_t num=4;
uint8_t num=4;、
uint8_t num_noise=2;
// make squelch more sensitive
// note that 'noise' and 'glitch' values are inverted compared to 'rssi' values
rssi_open = (rssi_open * 1) / num;
noise_open = (noise_open * num) / 1;
glitch_open = (glitch_open * num) / 1;
noise_open = (noise_open * num_noise) / 1;
glitch_open = (glitch_open * num_noise) / 1;


rssi_close = (rssi_close * 1) / num;
noise_close = (noise_close * num) / 1;
glitch_close = (glitch_close * num) / 1;
noise_close = (noise_close * num_noise) / 1;
glitch_close = (glitch_close * num_noise) / 1;


rssi_open = (rssi_open > 255) ? 255 : rssi_open;
Expand All @@ -456,11 +457,11 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) {


// ensure the 'close' threshold is lower than the 'open' threshold
if (rssi_close + 2 >= rssi_open)
if (rssi_open >= 2)
rssi_close = rssi_open - 2;
if (rssi_close + 4 >= rssi_open)
if (rssi_open >= 4)
rssi_close = rssi_open - 4;
else
rssi_open = rssi_close + 2;
rssi_open = rssi_close + 4;

if (glitch_close - 2 <= glitch_open)
if (glitch_open <= 253)
Expand Down

0 comments on commit 8cfecc6

Please sign in to comment.