Various bugs solved

Removed_REF_marker
erikkaashoek 5 years ago
parent 60a5e9f5c6
commit 0d552fd55a

@ -1018,7 +1018,7 @@ config_t config = {
.high_level_output_offset = 0.0, // Uncalibrated
.correction_frequency = {{ 1000000, 500000000, 1000000000, 1500000000, 2000000000, 2500000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000, 6500000000, 7000000000, 7500000000, 8000000000, 8500000000, 9000000000, 10000000000 },
{ 1000000, 500000000, 1000000000, 1500000000, 2000000000, 2500000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000, 6500000000, 7000000000, 7500000000, 8000000000, 8500000000, 9000000000, 10000000000 }},
.correction_value = {{ 0, +1.5, +2, +4, +2, +3.5, +6.5, +9.5, +10, +9, +9, +23, +24, +24, +24, +24, +24, +24, +24, +24 },
.correction_value = {{ 0, +1, +2, +2.5, +3, +3.5, +6.5, +9.5, +10, +9, +9, +23, +24, +24, +24, +24, +24, +24, +24, +24 },
{ 0, +1, +2.5, +1, +2.5, +6, +9, +11.5, +14.5, +23, +25, +36, +46, +46, +46, +46, +46, +46, +46, +46 }},
.setting_frequency_30mhz = 30000000,
.cor_am = 0,

@ -77,6 +77,7 @@
#endif
#ifdef TINYSA3
#define VARIANT(X,Y) (X)
#define DEFAULT_IF 433800000
#define DEFAULT_SPUR_IF 434000000
#define DEFAULT_MAX_FREQ 350000000
@ -84,8 +85,10 @@
#define HIGH_MAX_FREQ_MHZ 960
#endif
#ifdef TINYSA4
#define VARIANT(X,Y) (Y)
#define DEFAULT_IF ((freq_t)977400000)
#define DEFAULT_SPUR_OFFSET ((freq_t)1300000)
#define DEFAULT_SPUR_OFFSET ((freq_t)(actual_rbw_x10 > 3000 ? 1500000 : 1000000))
#define STATIC_DEFAULT_SPUR_OFFSET ((freq_t) 1500000)
#define DEFAULT_MAX_FREQ ((freq_t)800000000)
#define HIGH_MIN_FREQ_MHZ 136// 825
#define HIGH_MAX_FREQ_MHZ 1130

@ -226,7 +226,7 @@ void reset_settings(int m)
setting.measurement = M_OFF;
#ifdef TINYSA4
setting.ultra = S_AUTO_OFF;
setting.frequency_IF = config.frequency_IF1;
setting.frequency_IF = config.frequency_IF1 + STATIC_DEFAULT_SPUR_OFFSET/2; ;
#else
setting.frequency_IF = DEFAULT_IF;
#endif
@ -338,6 +338,7 @@ void reset_settings(int m)
markers[0].mtype = M_REFERENCE | M_TRACKING;
markers[0].enabled = M_ENABLED;
setting._active_marker = 0;
set_external_gain(0.0); // This also updates the help text!!!!! Must be below level_min and level_max being set
set_sweep_points(POINTS_COUNT);
dirty = true;
}
@ -609,9 +610,14 @@ void set_repeat(int r)
void set_IF(int f)
{
if (f == 0)
if (f == 0) {
setting.auto_IF = true;
setting.frequency_IF = f;
#ifdef TINYSA4
setting.frequency_IF = config.frequency_IF1 + STATIC_DEFAULT_SPUR_OFFSET/2;
#endif
} else {
setting.frequency_IF = f;
}
dirty = true;
}
@ -1363,8 +1369,8 @@ static const struct {
int16_t noise_level;
} step_delay_table[]={
// RBWx10 step_delay offset_delay spur_gate (value divided by 1000)
{ 8500, 250, 50, 400, -90},
{ 3000, 250, 50, 200, -95},
{ 8500, 100, 50, 400, -90},
{ 3000, 200, 50, 200, -95},
{ 1000, 400, 100, 100, -105},
{ 300, 400, 120, 100, -110},
{ 100, 700, 120, 100, -115},
@ -1932,7 +1938,7 @@ void update_rbw(void) // calculate the actual_rbw and the vbwSteps (#
vbwSteps = 1; // starting number for all modes
if (!MODE_INPUT(setting.mode)) {
actual_rbw_x10 = 1; // To force substepping of the SI4463
return;
goto done;
}
if (setting.frequency_step > 0 && MODE_INPUT(setting.mode)) {
setting.vbw_x10 = (setting.frequency_step)/100;
@ -1986,7 +1992,7 @@ void update_rbw(void) // calculate the actual_rbw and the vbwSteps (#
#ifdef TINYSA4
if (setting.vbw_x10 > actual_rbw_x10)
vbwSteps = 1+(setting.vbw_x10 / actual_rbw_x10); //((int)(2 * (setting.vbw_x10 + (actual_rbw_x10/8)) / actual_rbw_x10)); // calculate # steps in between each frequency step due to rbw being less than frequency step
vbwSteps += vbwSteps>>1;
vbwSteps += vbwSteps;
#else
vbwSteps = ((int)(2 * (setting.vbw_x10 + (actual_rbw_x10/2)) / actual_rbw_x10)); // calculate # steps in between each frequency step due to rbw being less than frequency step
#endif
@ -1997,6 +2003,8 @@ void update_rbw(void) // calculate the actual_rbw and the vbwSteps (#
} else { // in all other modes
setting.vbw_x10 = actual_rbw_x10;
}
done:
fill_spur_table(); // IF frequency depends on selected RBW
}
#ifdef TINYSA4
@ -2207,7 +2215,14 @@ void fill_spur_table(void)
{
for (uint8_t i=0; i < sizeof(spur_div)/sizeof(uint8_t); i++)
{
freq_t corr_IF = config.frequency_IF1;
freq_t corr_IF;
if (!setting.auto_IF)
corr_IF = setting.frequency_IF;
else {
corr_IF = config.frequency_IF1 + STATIC_DEFAULT_SPUR_OFFSET/2 - DEFAULT_SPUR_OFFSET/2;
setting.frequency_IF = corr_IF;
}
if (i != 4)
corr_IF -= IF_OFFSET;
else
@ -2742,13 +2757,15 @@ again: // Spur redu
else
{
#ifdef TINYSA4
local_IF = config.frequency_IF1;
local_IF = config.frequency_IF1 + STATIC_DEFAULT_SPUR_OFFSET/2; ;
#if 0
if ( S_IS_AUTO(setting.below_IF)) {
// if (f < 2000000 && S_IS_AUTO(setting.spur_removal))
// local_IF += DEFAULT_SPUR_OFFSET;
// else // if (lf > ULTRA_MAX_FREQ || lf < local_IF/2 || ( lf + (uint64_t)local_IF< MAX_LO_FREQ && lf > 136000000ULL + local_IF) )
local_IF += DEFAULT_SPUR_OFFSET/2;
}
#endif
#else
local_IF = DEFAULT_IF;
#endif
@ -3771,13 +3788,13 @@ sweep_again: // stay in sweep loop when output mo
s_min = noise;
#endif
float s_ref = setting.reflevel/setting.scale;
if (s_max < s_ref - NGRIDY || s_min > s_ref) { //Completely outside
if (s_max < s_ref - NGRIDY || s_min > s_ref || s_max > s_ref + 2.0) { //Completely outside or way too low
if (s_max - s_min < NGRIDY - 2)
set_reflevel(setting.scale*(floorf(s_min+8.8+ 1)));
else
set_reflevel(setting.scale*(floorf(s_max)+1));
// dirty = true; // Must be above if(scandirty!!!!!)
}else if (s_max > s_ref - 0.5 || s_min > s_ref - 8.8 ) { // maximum to high or minimum to high
} else if (s_max > s_ref - 0.5 || s_min > s_ref - 8.8 ) { // maximum to high or minimum to high
set_reflevel(setting.reflevel + setting.scale);
// dirty = true; // Must be above if(scandirty!!!!!)
} else if (s_min < s_ref - 10.1 && s_max < s_ref - 1.5) { // minimum too low and maximum can move up
@ -4535,7 +4552,7 @@ void test_prepare(int i)
setting.tracking = false; //Default test setup
setting.atten_step = false;
#ifdef TINYSA4
setting.frequency_IF = config.frequency_IF1; // Default frequency
setting.frequency_IF = config.frequency_IF1 + STATIC_DEFAULT_SPUR_OFFSET/2; // Default frequency
ultra = true;
ultra_threshold = 2000000000;
setting.extra_lna = false;
@ -4568,7 +4585,7 @@ common_silent:
setting.tracking = true; //Sweep BPF
setting.auto_IF = false;
#ifdef TINYSA4
setting.frequency_IF = config.frequency_IF1 + DEFAULT_SPUR_OFFSET/2; // Center on SAW filters
setting.frequency_IF = config.frequency_IF1 + STATIC_DEFAULT_SPUR_OFFSET/2; // Center on SAW filters
set_refer_output(0);
#else
setting.frequency_IF = DEFAULT_IF+210000; // Center on SAW filters
@ -4597,7 +4614,11 @@ common_silent:
for (int j = 0; j < setting._sweep_points/2 - W2P(test_case[i].width); j++)
stored_t[j] = test_case[i].stop;
for (int j = setting._sweep_points/2 + W2P(test_case[i].width); j < setting._sweep_points; j++)
#ifdef TINYSA4
stored_t[j] = test_case[i].stop;
#else
stored_t[j] = test_case[i].stop - (i == 6?3:0);
#endif
for (int j = setting._sweep_points/2 - W2P(test_case[i].width); j < setting._sweep_points/2 + W2P(test_case[i].width); j++)
stored_t[j] = test_case[i].pass;
break;
@ -4766,7 +4787,7 @@ quit:
test_prepare(TEST_SILENCE);
setting.auto_IF = false;
#ifdef TINYSA4
setting.frequency_IF=config.frequency_IF1;
setting.frequency_IF=config.frequency_IF1+ STATIC_DEFAULT_SPUR_OFFSET/2;
#else
setting.frequency_IF=DEFAULT_IF;
#endif
@ -4848,7 +4869,7 @@ quit:
// reset_settings(M_LOW);
setting.auto_IF = false;
#ifdef TINYSA4
setting.frequency_IF=config.frequency_IF1;
setting.frequency_IF=config.frequency_IF1 + STATIC_DEFAULT_SPUR_OFFSET/2;
setting.step_delay = 15000;
#else
setting.frequency_IF=DEFAULT_IF;

@ -2055,12 +2055,15 @@ int16_t Si446x_RSSI(void)
int RSSI_RAW_ARRAY[3];
do{
again:
__disable_irq();
#if 1
__disable_irq();
data[0] = SI446X_CMD_GET_MODEM_STATUS;
data[1] = 0xFF;
SI4463_do_api(data, 2, data, 3); // TODO no clear of interrupts
__enable_irq();
#else
data[2] = getFRR(SI446X_CMD_READ_FRR_A);
#endif
if (data[2] == 255) {
my_microsecond_delay(10);
goto again;

@ -1418,9 +1418,9 @@ menu_invoke(int item)
kp_help_text = (char *)menu->reference;
if (menu->data <= KM_CW) { // One of the frequency input keypads
if (MODE_LOW(setting.mode))
kp_help_text = "0..350MHz";
kp_help_text = VARIANT("0..350MHz","0..800MHz");
else
kp_help_text = "240..960Mhz";
kp_help_text = VARIANT("240..960Mhz","136..4350MHz");
}
ui_mode_keypad(menu->data);
redraw_request |= REDRAW_CAL_STATUS;

@ -504,6 +504,7 @@ static const menuitem_t menu_modulation[];
static const menuitem_t menu_top[];
static const menuitem_t menu_reffer[];
static const menuitem_t menu_sweep_points[];
static const menuitem_t menu_sweep_points_form[];
static const menuitem_t menu_modulation[];
static const menuitem_t menu_limit_modify[];
//static const menuitem_t menu_drive_wide[];
@ -1739,10 +1740,10 @@ static const menuitem_t menu_modulation[] = {
};
static const menuitem_t menu_sweep[] = {
{ MT_FORM | MT_KEYPAD, KM_SPAN, "SPAN: %s", "0..350MHz"},
{ MT_FORM | MT_KEYPAD | MT_LOW, KM_LEVELSWEEP,"LEVEL CHANGE: %s", "-70..70"},
{ MT_FORM | MT_KEYPAD, KM_SPAN, "SPAN: %s", VARIANT("0..350MHz", "0..800MHz")},
{ MT_FORM | MT_KEYPAD | MT_LOW, KM_LEVELSWEEP,"LEVEL CHANGE: %s", VARIANT("-70..70","-90..90")},
{ MT_FORM | MT_KEYPAD, KM_SWEEP_TIME, "SWEEP TIME: %s", "0..600 seconds"},
{ MT_FORM | MT_SUBMENU, 0, "SWEEP POINTS", menu_sweep_points},
{ MT_FORM | MT_SUBMENU, 0, "SWEEP POINTS", menu_sweep_points_form},
{ MT_FORM | MT_CANCEL, 0, S_LARROW" BACK",NULL },
{ MT_FORM | MT_NONE, 0, NULL, NULL } // sentinel
};
@ -1756,7 +1757,7 @@ static const menuitem_t menu_lowoutputmode[] = {
#ifdef TINYSA4
{ MT_FORM | MT_SUBMENU, 255, S_RARROW" Settings", menu_settings3},
#endif
{ MT_FORM | MT_KEYPAD, KM_CENTER, center_text, "10kHz..350MHz"},
{ MT_FORM | MT_KEYPAD, KM_CENTER, center_text, VARIANT("10kHz..350MHz","10kHz..850MHz")},
{ MT_FORM | MT_KEYPAD, KM_LOWOUTLEVEL, "LEVEL: %s", low_level_help_text},
{ MT_FORM | MT_ADV_CALLBACK, 0, "MOD: %s", menu_smodulation_acb},
{ MT_FORM | MT_ADV_CALLBACK, 0, "%s", menu_sweep_acb},
@ -1773,7 +1774,7 @@ static const menuitem_t menu_highoutputmode[] = {
#ifdef TINYSA4
{ MT_FORM | MT_SUBMENU, 255, S_RARROW" Settings", menu_settings3},
#endif
{ MT_FORM | MT_KEYPAD, KM_CENTER, center_text, "240MHz..960MHz"},
{ MT_FORM | MT_KEYPAD, KM_CENTER, center_text, VARIANT("240MHz..960MHz","136MHz..4350MHz")},
// { MT_FORM | MT_ADV_CALLBACK, 0, "LEVEL: %+ddBm", menu_sdrive_acb},
{ MT_FORM | MT_KEYPAD, KM_HIGHOUTLEVEL, "LEVEL: %s", low_level_help_text /* "-76..-6" */},
{ MT_FORM | MT_ADV_CALLBACK, 0, "MOD: %s", menu_smodulation_acb},
@ -2025,6 +2026,18 @@ static const menuitem_t menu_sweep_points[] = {
{ MT_NONE, 0, NULL, NULL } // sentinel
};
static const menuitem_t menu_sweep_points_form[] = {
{ MT_FORM | MT_ADV_CALLBACK, 0, "%3d point", menu_points_acb },
{ MT_FORM | MT_ADV_CALLBACK, 1, "%3d point", menu_points_acb },
{ MT_FORM | MT_ADV_CALLBACK, 2, "%3d point", menu_points_acb },
{ MT_FORM | MT_ADV_CALLBACK, 3, "%3d point", menu_points_acb },
#ifdef TINYSA4
{ MT_FORM | MT_ADV_CALLBACK, 4, "%3d point", menu_points_acb },
#endif
{ MT_FORM | MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
static const menuitem_t menu_sweep_speed[] =
{
{ MT_ADV_CALLBACK, SD_NORMAL, "NORMAL", menu_scanning_speed_acb}, // order must match definition of enum
@ -2087,7 +2100,7 @@ static const menuitem_t menu_settings4[] =
#ifdef __HARMONIC__
{ MT_SUBMENU,0, "HARMONIC", menu_harmonic},
#endif
{ MT_SUBMENU, 0, S_RARROW" MORE", menu_settings3},
// { MT_SUBMENU, 0, S_RARROW" MORE", menu_settings3},
{ MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
@ -2106,7 +2119,7 @@ static const menuitem_t menu_settings2[] =
{ MT_KEYPAD, KM_NOISE, "NOISE\nLEVEL", "2..20 dB"},
#endif
#ifdef TINYSA4
{ MT_KEYPAD, KM_30MHZ, "ACTUAL\n30MHz", "Enter actual l0MHz frequency"},
{ MT_KEYPAD, KM_30MHZ, "ACTUAL\n30MHz", "Enter actual 30MHz frequency"},
#endif
{ MT_SUBMENU, 0, S_RARROW" MORE", menu_settings3},
{ MT_CANCEL, 0, S_LARROW" BACK", NULL },
@ -2226,15 +2239,15 @@ static const menuitem_t menu_config[] = {
#endif
#ifdef __USE_SERIAL_CONSOLE__
{ MT_SUBMENU, 0, "CONNECTION", menu_connection},
#endif
{ MT_SUBMENU, 0, "EXPERT\nCONFIG", menu_settings},
#ifndef TINYSA4
{ MT_SUBMENU, 0, S_RARROW" DFU", menu_dfu},
#endif
#ifdef TINYSA4
{ MT_KEYPAD, KM_ACTUALPOWER, "ACTUAL\nPOWER", NULL},
{ MT_KEYPAD, KM_REPEAT, "SAMPLE\nREPEAT", "1..100"},
#endif
{ MT_SUBMENU, 0, "EXPERT\nCONFIG", menu_settings},
#ifndef TINYSA4
{ MT_SUBMENU, 0, S_RARROW" DFU", menu_dfu},
#endif
{ MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel

Loading…
Cancel
Save

Powered by TurnKey Linux.