Merge debugged

Removed_REF_marker
erikkaashoek 5 years ago
parent 168a43a6d1
commit 7d6d1d33d0

@ -49,7 +49,8 @@
#define DEFAULT_IF 978000000
#define DEFAULT_SPUR_IF 978000000
#define DEFAULT_MAX_FREQ 800000000
#define HIGH_MIN_FREQ_MHZ 110
#define HIGH_MAX_FREQ_MHZ 1200
/*
* main.c
*/
@ -244,7 +245,7 @@ void set_decay(int);
void set_noise(int);
void toggle_tracking_output(void);
extern int32_t frequencyExtra;
void set_10mhz(float);
void set_10mhz(uint32_t f);
void set_modulation(int);
void set_modulation_frequency(int);
int search_maximum(int m, int center, int span);
@ -480,7 +481,6 @@ typedef struct config {
uint16_t gridlines;
uint16_t hambands;
uint32_t frequency_IF2;
float setting_frequency_10mhz;
int8_t cor_am;
int8_t cor_wfm;
int8_t cor_nfm;

@ -967,7 +967,7 @@ inline void trace_get_value_string( // Only used at one place
plot_printf(ptr2, sizeof(buf2) - 2, "%3.1f" , (dfreq + 50000) / 1000000.0);
}
#else
plot_printf(ptr2, sizeof(buf2) - 2, "%8.3qHz" , dfreq);
plot_printf(ptr2, sizeof(buf2) - 2, "%9.4qHz" , dfreq);
}
#endif
v = value(coeff[i]);

@ -1,5 +1,4 @@
/* All rights reserved.
*
/*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
@ -87,8 +86,8 @@ void update_min_max_freq(void)
minFreq = 00000000;
maxFreq = 2000000000;
#else
minFreq = 10*config.setting_frequency_10mhz;
maxFreq = 1200*config.setting_frequency_10mhz;
minFreq = HIGH_MIN_FREQ_MHZ * 1000000;
maxFreq = HIGH_MAX_FREQ_MHZ * 1000000;
#endif
break;
case M_GENHIGH:
@ -182,8 +181,8 @@ void reset_settings(int m)
minFreq = 00000000;
maxFreq = 2000000000;
#else
minFreq = 136*config.setting_frequency_10mhz;
maxFreq = 1150*config.setting_frequency_10mhz;
minFreq = HIGH_MIN_FREQ_MHZ*(config.setting_frequency_10mhz/10);
maxFreq = HIGH_MAX_FREQ_MHZ*(config.setting_frequency_10mhz/10);
#endif
set_sweep_frequency(ST_START, minFreq);
set_sweep_frequency(ST_STOP, maxFreq);
@ -1199,11 +1198,11 @@ void set_freq(int V, unsigned long freq) // translate the requested frequency
}
}
if (freq) {
ADF4351_set_frequency(V-ADF4351_LO,freq,3);
ADF4351_set_frequency(V-ADF4351_LO,freq,setting.drive-12);
real_old_freq[V] = freq;
}
} else if (V==ADF4351_LO2){
ADF4351_set_frequency(V-ADF4351_LO,freq,3);
ADF4351_set_frequency(V-ADF4351_LO,freq,setting.drive-12);
} else
if (V==SI4463_RX) {
if (setting.frequency_step<930000) // maximum step size is 937.49kHz
@ -1214,7 +1213,7 @@ void set_freq(int V, unsigned long freq) // translate the requested frequency
}
#ifdef __ULTRA_SA__
else {
ADF4351_set_frequency(V-ADF4351_LO,freq,3);
ADF4351_set_frequency(V-ADF4351_LO,freq,(setting.drive-4)/3);
}
#endif
old_freq[V] = freq;
@ -1845,6 +1844,7 @@ modulation_again:
#endif
#ifdef __SPUR__
} else if (setting.mode== M_LOW && setting.spur_removal){ // If in low input mode and spur reduction is on
#ifndef __SI4463__
if (S_IS_AUTO(setting.below_IF) && (lf < local_IF / 2 || lf > local_IF) ) // if below 150MHz and auto_below_IF <-------------------TODO ---------------------
{ // else low/above IF
if (setting.spur_removal == 1)
@ -1852,12 +1852,14 @@ modulation_again:
else
setting.below_IF = S_AUTO_OFF; // and above IF in second pass
}
else {
else
#endif
{
#ifdef __SI4432__
int32_t spur_offset = actual_rbw_x10 * 100; // Can not use below IF so calculate IF shift that hopefully will kill the spur.
#endif
#ifdef __SI4463__
int32_t spur_offset = 4* actual_rbw_x10 * 100; // Can not use below IF so calculate IF shift that hopefully will kill the spur.
int32_t spur_offset = 2* actual_rbw_x10 * 100; // Can not use below IF so calculate IF shift that hopefully will kill the spur.
#endif
if (setting.spur_removal == -1) // If second spur pass
spur_offset = - spur_offset; // IF shift in the other direction
@ -2209,6 +2211,7 @@ sweep_again: // stay in sweep loop when output mo
stored_t[i] = (SI4432_Read_Byte(0x69) & 0x01f) * 3.0 - 90.0; // Display the AGC value in the stored trace
#endif
#ifdef __SI4432__
if (check_for_AM) {
int AGC_value = (SI4432_Read_Byte(0x69) & 0x01f) * 3.0 - 90.0;
if (AGC_value < last_AGC_value && last_AGC_direction_up ) {
@ -2218,6 +2221,7 @@ sweep_again: // stay in sweep loop when output mo
}
last_AGC_value = AGC_value;
}
#endif
if (scandirty || setting.average == AV_OFF) { // Level calculations
actual_t[i] = RSSI;
age[i] = 0;

@ -945,7 +945,7 @@ void ADF4351_Setup(void)
// while(1) {
//
ADF4351_R_counter(3);
ADF4351_R_counter(8);
ADF4351_set_frequency(0,2000000000,0);
@ -1006,8 +1006,8 @@ void ADF4351_set_frequency(int channel, uint32_t freq, int drive) // freq / 10H
{
// freq -= 71000;
// uint32_t offs = ((freq / 1000)* 39) / 1000;
uint32_t offs = 0;
uint32_t offs = ((freq / 1000)* 4) / 1000;
// uint32_t offs = 0;
ADF4351_prep_frequency(channel,freq + offs, drive);
//START_PROFILE;
ADF4351_Set(channel);
@ -1079,10 +1079,9 @@ static uint32_t gcd(uint32_t x, uint32_t y)
void ADF4351_prep_frequency(int channel, unsigned long freq, int drive) // freq / 10Hz
{
(void)drive;
// START_PROFILE;
// if (channel == 0)
RFout=freq/config.setting_frequency_10mhz; // To MHz
RFout=freq/1000000.0; // config.setting_frequency_10mhz; // To MHz
// else
// RFout=freq/1000210; // To MHz
@ -1111,6 +1110,7 @@ void ADF4351_prep_frequency(int channel, unsigned long freq, int drive) // freq
bitWrite (registers[4], 22, 1);
bitWrite (registers[4], 21, 0);
bitWrite (registers[4], 20, 0);
#if 0 // does not work on ADF4350
} else if (RFout >= 68.75) {
OutputDivider = 32;
bitWrite (registers[4], 22, 1);
@ -1121,6 +1121,7 @@ void ADF4351_prep_frequency(int channel, unsigned long freq, int drive) // freq
bitWrite (registers[4], 22, 1);
bitWrite (registers[4], 21, 1);
bitWrite (registers[4], 20, 0);
#endif
}
INTA = (RFout * OutputDivider) / PFDRFout[channel];
@ -1180,8 +1181,7 @@ void ADF4351_prep_frequency(int channel, unsigned long freq, int drive) // freq
registers[1] = MOD << 3;
registers[1] = registers[1] + 1 ; // restore address "001"
bitSet (registers[1], 27); // Prescaler at 8/9
/*
drive = 1;
if (drive == 0) {
bitClear (registers[4], 3); // +5dBm + out
bitClear (registers[4], 4); // +5dBm
@ -1204,7 +1204,7 @@ void ADF4351_prep_frequency(int channel, unsigned long freq, int drive) // freq
bitSet (registers[4], 3); // +5dBm + out
bitSet (registers[4], 4); // +5dBm
}
*/
// bitSet (registers[4], 5); // enable + output
// bitClear (registers[4], 8); // enable B output
@ -2019,7 +2019,7 @@ static int prev_band = -1;
void SI4463_set_freq(uint32_t freq, uint32_t step_size)
{
uint32_t offs = ((freq / 1000)* 0) / 1000;
uint32_t offs = ((freq / 1000)* 147) / 1000;
float RFout=(freq+offs)/1000000.0; // To MHz
if (RFout >= 822 && RFout <= 1140) { // till 1140MHz
SI4463_band = 0;

Loading…
Cancel
Save

Powered by TurnKey Linux.