Repaired set_actual_power peakLevel

tinySA-V4-SI4463
erikkaashoek 4 years ago
parent 9d82970268
commit bce5d0dd42

@ -3891,6 +3891,8 @@ static uint8_t sweep_counter = 0; // Only used for HW refresh
static bool sweep(bool break_on_operation) static bool sweep(bool break_on_operation)
{ {
float RSSI; float RSSI;
float local_peakLevel;
int local_peakIndex;
#ifdef __SI4432__ #ifdef __SI4432__
freq_t agc_peak_freq = 0; freq_t agc_peak_freq = 0;
float agc_peak_rssi = -150; float agc_peak_rssi = -150;
@ -4350,11 +4352,12 @@ static volatile int dummy;
temppeakLevel = actual_t[0]; temppeakLevel = actual_t[0];
max_index[0] = 0; max_index[0] = 0;
downslope = true; downslope = true;
peakLevel = temppeakLevel; local_peakIndex = 0;
local_peakLevel = temppeakLevel;
} }
if (cur_max == 0 && peakLevel < actual_t[i]) { if (cur_max == 0 && local_peakLevel < actual_t[i]) {
peakIndex = i; local_peakIndex = i;
peakLevel = actual_t[i]; local_peakLevel = actual_t[i];
} }
if (downslope) { // If in down slope peak finding if (downslope) { // If in down slope peak finding
if (temppeakLevel > actual_t[i]) { // Follow down if (temppeakLevel > actual_t[i]) { // Follow down
@ -4657,7 +4660,7 @@ static volatile int dummy;
// --------------------- set tracking markers from maximum table ----------------- // --------------------- set tracking markers from maximum table -----------------
if (cur_max == 0) { if (cur_max == 0) {
max_index[0] = peakIndex; max_index[0] = local_peakIndex;
cur_max = 1; cur_max = 1;
} }
if (MODE_INPUT(setting.mode)) { // Assign maxima found to tracking markers if (MODE_INPUT(setting.mode)) { // Assign maxima found to tracking markers
@ -4776,9 +4779,10 @@ static volatile int dummy;
#endif #endif
if (cur_max > 0) { if (cur_max > 0) {
peakIndex = max_index[0]; peakIndex = max_index[0];
peakLevel = actual_t[peakIndex];
cur_max = 1; cur_max = 1;
} } else
peakIndex = local_peakIndex;
peakLevel = actual_t[peakIndex];
peakFreq = getFrequency(peakIndex); peakFreq = getFrequency(peakIndex);
min_level = temp_min_level; min_level = temp_min_level;
} }
@ -5640,6 +5644,7 @@ quit:
config.cor_nfm = 0; config.cor_nfm = 0;
config.cor_wfm = 0; config.cor_wfm = 0;
#endif #endif
in_selftest = false;
reset_settings(M_LOW); reset_settings(M_LOW);
set_refer_output(-1); set_refer_output(-1);
} else if (false && test == 1) { } else if (false && test == 1) {

Loading…
Cancel
Save

Powered by TurnKey Linux.