|
|
|
|
@ -444,6 +444,10 @@ void setFreq(int V, unsigned long freq)
|
|
|
|
|
{
|
|
|
|
|
SI4432_Sel = V;
|
|
|
|
|
if (old_freq[V] != freq) {
|
|
|
|
|
if (V == 0) {
|
|
|
|
|
V = -V;
|
|
|
|
|
V = -V;
|
|
|
|
|
}
|
|
|
|
|
SI4432_Set_Frequency(freq);
|
|
|
|
|
old_freq[V] = freq;
|
|
|
|
|
}
|
|
|
|
|
@ -685,7 +689,7 @@ float perform(bool break_on_operation, int i, int32_t f, int tracking)
|
|
|
|
|
long local_IF;
|
|
|
|
|
if (MODE_HIGH(setting_mode))
|
|
|
|
|
local_IF = 0;
|
|
|
|
|
else if (avoid_spur(f))
|
|
|
|
|
else if (setting_mode == M_LOW && avoid_spur(f))
|
|
|
|
|
local_IF = spur_alternate_IF;
|
|
|
|
|
else
|
|
|
|
|
local_IF = frequency_IF;
|
|
|
|
|
@ -698,7 +702,7 @@ float perform(bool break_on_operation, int i, int32_t f, int tracking)
|
|
|
|
|
if (local_IF) {
|
|
|
|
|
setFreq (0, local_IF);
|
|
|
|
|
}
|
|
|
|
|
if (setting_modulation == MO_AM) {
|
|
|
|
|
if (MODE_OUTPUT(setting_mode) && setting_modulation == MO_AM) {
|
|
|
|
|
int p = setting_attenuate * 2 + modulation_counter;
|
|
|
|
|
PE4302_Write_Byte(p);
|
|
|
|
|
if (modulation_counter == 3)
|
|
|
|
|
@ -706,7 +710,7 @@ float perform(bool break_on_operation, int i, int32_t f, int tracking)
|
|
|
|
|
else
|
|
|
|
|
modulation_counter++;
|
|
|
|
|
chThdSleepMicroseconds(250);
|
|
|
|
|
} else if (setting_modulation == MO_NFM || setting_modulation == MO_WFM ) {
|
|
|
|
|
} else if (MODE_OUTPUT(setting_mode) && (setting_modulation == MO_NFM || setting_modulation == MO_WFM )) {
|
|
|
|
|
SI4432_Sel = 1;
|
|
|
|
|
SI4432_Write_Byte(0x79, modulation_counter); // Use frequency hopping channel for FM modulation
|
|
|
|
|
if (modulation_counter == 3)
|
|
|
|
|
@ -719,16 +723,22 @@ float perform(bool break_on_operation, int i, int32_t f, int tracking)
|
|
|
|
|
int t = 0;
|
|
|
|
|
do {
|
|
|
|
|
int lf = (uint32_t)(f + (int)(t * 500 * actual_rbw));
|
|
|
|
|
if (tracking)
|
|
|
|
|
if (MODE_INPUT(setting_mode) && tracking)
|
|
|
|
|
setFreq (0, local_IF + lf - reffer_freq[setting_refer]); // Offset so fundamental of reffer is visible
|
|
|
|
|
#if 0
|
|
|
|
|
if (lf >11000000 || lf < 9000000) {
|
|
|
|
|
lf = lf;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
setFreq (1, local_IF + lf);
|
|
|
|
|
if (MODE_OUTPUT(setting_mode))
|
|
|
|
|
if (MODE_OUTPUT(setting_mode)) // No substepping in output mode
|
|
|
|
|
return(0);
|
|
|
|
|
float subRSSI = SI4432_RSSI(lf, MODE_SELECT(setting_mode))+settingLevelOffset()+setting_attenuate;
|
|
|
|
|
if (RSSI < subRSSI)
|
|
|
|
|
RSSI = subRSSI;
|
|
|
|
|
t++;
|
|
|
|
|
if ((operation_requested && break_on_operation ) || (MODE_OUTPUT(setting_mode))) // output modes do not step.
|
|
|
|
|
if (operation_requested && break_on_operation) // output modes do not step.
|
|
|
|
|
break; // abort
|
|
|
|
|
} while (t < vbwSteps);
|
|
|
|
|
return(RSSI);
|
|
|
|
|
@ -754,7 +764,7 @@ static bool sweep(bool break_on_operation)
|
|
|
|
|
// back to toplevel to handle ui operation
|
|
|
|
|
if (operation_requested && break_on_operation)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (MODE_INPUT(setting_mode)) {
|
|
|
|
|
// if (setting_spur == 1) { // First pass
|
|
|
|
|
// temp_t[i] = RSSI;
|
|
|
|
|
// continue; // Skip all other processing
|
|
|
|
|
@ -835,6 +845,7 @@ static bool sweep(bool break_on_operation)
|
|
|
|
|
downslope = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
if (frequencies[i] > 1000000) {
|
|
|
|
|
if (temppeakLevel < actual_t[i]) {
|
|
|
|
|
@ -857,6 +868,7 @@ static bool sweep(bool break_on_operation)
|
|
|
|
|
draw_cal_status();
|
|
|
|
|
}
|
|
|
|
|
#if 1
|
|
|
|
|
if (MODE_INPUT(setting_mode)) {
|
|
|
|
|
int i = 0;
|
|
|
|
|
int m = 0;
|
|
|
|
|
while (i < cur_max) { // For all maxima found
|
|
|
|
|
@ -915,6 +927,7 @@ static bool sweep(bool break_on_operation)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
// redraw_marker(peak_marker, FALSE);
|
|
|
|
|
palSetPad(GPIOC, GPIOC_LED);
|
|
|
|
|
return true;
|
|
|
|
|
|