Skip to content

Commit

Permalink
Merge pull request #5 from kamilsss655/am-fix-s-display-fix
Browse files Browse the repository at this point in the history
Am fix s display fix
  • Loading branch information
kamilsss655 authored Dec 18, 2023
2 parents fe6fbd6 + 94929be commit 287594d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
8 changes: 4 additions & 4 deletions am_fix.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ int16_t rssi_gain_diff[2] = {0, 0};
// used to limit the max RF gain
unsigned int max_index = ARRAY_SIZE(gain_table) - 1;

// -89dBm, any higher and the AM demodulator starts to saturate/clip/distort
const int16_t desired_rssi = (-89 + 160) * 2;
// -110dBm, any higher and the AM demodulator starts to saturate/clip/distort
const int16_t desired_rssi = (-110 + 180) * 2;

void AM_fix_init(void)
{ // called at boot-up
Expand Down Expand Up @@ -307,7 +307,7 @@ void AM_fix_10ms(const int vfo)
}
}
#else
gCurrentRSSI[vfo] = rssi - rssi_gain_diff[vfo];
gCurrentRSSI[vfo] = rssi;
#endif


Expand Down Expand Up @@ -374,7 +374,7 @@ void AM_fix_10ms(const int vfo)
}

// save the corrected RSSI level
gCurrentRSSI[vfo] = rssi - rssi_gain_diff[vfo];
gCurrentRSSI[vfo] = rssi;

#ifdef ENABLE_AM_FIX_SHOW_DATA
if (counter == 0) {
Expand Down
14 changes: 9 additions & 5 deletions app/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,23 @@
#include "ui/menu.h"
#include "ui/status.h"
#include "ui/ui.h"
#include "driver/systick.h"

static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
static void FlashlightTimeSlice();

static void UpdateRSSI(const int vfo)
{
while ((BK4819_ReadRegister(0x63) & 0b11111111) >= 255) {
SYSTICK_DelayUs(100);
}
int16_t rssi = BK4819_GetRSSI();

#ifdef ENABLE_AM_FIX
// add RF gain adjust compensation
if (gEeprom.VfoInfo[vfo].Modulation == MODULATION_AM && gSetting_AM_fix)
rssi -= rssi_gain_diff[vfo];
#endif
// #ifdef ENABLE_AM_FIX
// // add RF gain adjust compensation
// if (gEeprom.VfoInfo[vfo].Modulation == MODULATION_AM && gSetting_AM_fix)
// rssi -= rssi_gain_diff[vfo];
// #endif

if (gCurrentRSSI[vfo] == rssi)
return; // no change
Expand Down

0 comments on commit 287594d

Please sign in to comment.