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

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

Loading…
Cancel
Save

Powered by TurnKey Linux.