Corrected annoying output frequency error

tinySA-v0.2
erikkaashoek 6 years ago
parent 7ef36b08de
commit 6a3d887b50

@ -918,7 +918,7 @@ float perform(bool break_on_operation, int i, uint32_t f, int tracking)
if (MODE_OUTPUT(setting.mode) && setting.modulation == MO_AM) { // AM modulation
int p = setting.attenuate * 2 + modulation_counter;
PE4302_Write_Byte(p);
if (modulation_counter == 4) {
if (modulation_counter == 6) { // 3dB modulation depth
modulation_counter = 0;
} else {
modulation_counter++;
@ -947,8 +947,14 @@ float perform(bool break_on_operation, int i, uint32_t f, int tracking)
float RSSI = -150.0;
int t = 0;
do { // ------------- Acquisition loop ----------
int offs = (int)((t * 500 - vbwSteps * 250) * actual_rbw);
do { // ------------- Acquisition loop ----------
int offs;
if (vbwSteps & 1) { // Uneven steps, center
offs = (t - (vbwSteps >> 1)) * 500;
} else { // Even, shift half step
offs = (t - (vbwSteps >> 1)) * 500 + 250;
}
offs = (int)(offs * actual_rbw);
uint32_t lf = (uint32_t)(f + offs);
#ifdef __SPUR__
float spur_RSSI = 0;
@ -1064,7 +1070,7 @@ again:
t++;
if (operation_requested && break_on_operation) // break subscanning if requested
break; // abort
} while (t <= vbwSteps);
} while (t < vbwSteps);
return(RSSI);
}
@ -1084,6 +1090,10 @@ again:
temppeakLevel = -150;
float temp_min_level = 100;
// spur_old_stepdelay = 0;
int repeats = 1;
if (MODE_OUTPUT(setting.mode) && setting.modulation != MO_NONE)
repeats = 1000; // to avoid interrupting the tone during UI processing
while (repeats--) {
for (int i = 0; i < sweep_points; i++) {
RSSI = perform(break_on_operation, i, frequencies[i], setting.tracking);
@ -1091,10 +1101,12 @@ again:
// back to toplevel to handle ui operation
if (operation_requested && break_on_operation)
return false;
if (MODE_OUTPUT(setting.mode) && setting.modulation == MO_NONE) {
osalThreadSleepMilliseconds(10); // Slow down sweep in output mode
if (MODE_OUTPUT(setting.mode)) {
if (setting.modulation == MO_NONE) {
osalThreadSleepMilliseconds(10); // Slow down sweep in output mode
}
continue; // Skip all other processing
}
if (MODE_INPUT(setting.mode)) {
temp_t[i] = RSSI;
@ -1315,6 +1327,7 @@ again:
#endif
min_level = temp_min_level;
}
}
// redraw_marker(peak_marker, FALSE);
// STOP_PROFILE;
palSetPad(GPIOB, GPIOB_LED);

@ -490,7 +490,7 @@ void SI4432_Init()
//DebugLine("1 init done");
SI4432_Sel = 0;
SI4432_Receive();// Enable receiver chain
// SI4432_Receive();// Enable receiver chain
// SI4432_Write_Byte(0x09, V0_XTAL_CAPACITANCE);// Tune the crystal
SI4432_Set_Frequency(433700000);
SI4432_Write_Byte(0x0D, 0x1F) ; // Set GPIO2 output to ground
@ -499,11 +499,13 @@ void SI4432_Init()
SI4432_Sel = 1;
// SI4432_Write_Byte(0x09, V1_XTAL_CAPACITANCE);// Tune the crystal
SI4432_Set_Frequency(443700000);
SI4432_Write_Byte(0x6D, 0x1C);//Set low power
SI4432_Transmit(0);
SI4432_Write_Byte(0x0D, 0x1F) ; // Set GPIO2 output to ground
// SI4432_Write_Byte(0x6D, 0x1C);//Set low power
// SI4432_Transmit(0);
SI4432_Write_Byte(0x0D, 0xC0) ; // Set GPIO2 maximumdrive and clock output
SI4432_Write_Byte(0x0A, 0x02) ; // Set 10MHz output
// SI4432_Write_Byte(0x0D, 0xC0) ; // Set GPIO2 maximumdrive and clock output
// SI4432_Write_Byte(0x0A, 0x02) ; // Set 10MHz output
}
void SI4432_SetReference(int freq)

Loading…
Cancel
Save

Powered by TurnKey Linux.