0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 14:21:25 +03:00

AM fix rssi average with prev rssi

This commit is contained in:
OneOfEleven 2023-09-25 19:08:26 +01:00
parent 09bbec08cb
commit 97d6b69af9
3 changed files with 6 additions and 18 deletions

View File

@ -299,8 +299,8 @@ const uint8_t orig_pga = 6; // -3dB
struct struct
{ {
unsigned int count; uint16_t prev_level;
uint16_t level; uint16_t level;
} rssi[2]; } rssi[2];
// to help reduce gain hunting, provides a peak hold time delay // to help reduce gain hunting, provides a peak hold time delay
@ -312,8 +312,8 @@ const uint8_t orig_pga = 6; // -3dB
void AM_fix_reset(const int vfo) void AM_fix_reset(const int vfo)
{ // reset the AM fixer { // reset the AM fixer
rssi[vfo].count = 0; rssi[vfo].prev_level = 0;
rssi[vfo].level = 0; rssi[vfo].level = 0;
am_gain_hold_counter[vfo] = 0; am_gain_hold_counter[vfo] = 0;
@ -362,20 +362,8 @@ const uint8_t orig_pga = 6; // -3dB
} }
// sample the current RSSI level, average it with the previous rssi // sample the current RSSI level, average it with the previous rssi
#if 0 rssi[vfo].level = (rssi[vfo].prev_level + BK4819_GetRSSI()) >> 1;
if (rssi[vfo].count < 1) rssi[vfo].prev_level = BK4819_GetRSSI();
{
rssi[vfo].level = BK4819_GetRSSI();
rssi[vfo].count++;
}
else
{ // average of new and old RSSI's
rssi[vfo].level = (rssi[vfo].level + BK4819_GetRSSI()) >> 1;
}
#else
// no averaging with previous RSSI's
rssi[vfo].level = BK4819_GetRSSI();
#endif
#ifdef ENABLE_AM_FIX_TEST1 #ifdef ENABLE_AM_FIX_TEST1

Binary file not shown.

Binary file not shown.