Various improvements

pull/94/head
erikkaashoek 2 years ago
parent bfd6f82b57
commit 31a89ceda8

@ -1478,7 +1478,7 @@ typedef struct properties {
//sizeof(properties_t) == 0x1200
#define CONFIG_MAGIC 0x434f4e67
#define SETTING_MAGIC 0x434f4e67
#define SETTING_MAGIC 0x434f4e68
extern int16_t lastsaveid;
//extern properties_t *active_props;

@ -225,11 +225,13 @@ void set_output_path(freq_t f, float level)
}
} else if (MODE_HIGH(setting.mode))
signal_path = PATH_HIGH;
else if (setting.mixer_output && (f >= MAX_LOW_OUTPUT_FREQ || (config.ultra_start != ULTRA_AUTO && f > config.ultra_start)))
else if (setting.mixer_output && (f >= MAX_LOW_OUTPUT_FREQ || (config.ultra_start != ULTRA_AUTO && f > config.ultra_start))) {
signal_path = PATH_ULTRA;
else if (!setting.mixer_output && (f >= MAX_LOW_OUTPUT_FREQ || (config.ultra_start != ULTRA_AUTO && f > config.ultra_start)))
LO_harmonic = (f > ULTRA_MAX_FREQ);
} else if (!setting.mixer_output && (f >= MAX_LOW_OUTPUT_FREQ || (config.ultra_start != ULTRA_AUTO && f > config.ultra_start))) {
signal_path = PATH_LEAKAGE;
else if (f > MINIMUM_DIRECT_FREQ)
LO_harmonic = (f > MAX_LO_FREQ);
} else if (f > MINIMUM_DIRECT_FREQ)
signal_path = PATH_DIRECT;
else
signal_path = PATH_LOW;
@ -4469,7 +4471,7 @@ again: // Spur redu
if (signal_path == PATH_LOW || signal_path == PATH_ULTRA) ADF4351_drive(actual_drive); // Max drive
}
if (signal_path == PATH_LEAKAGE)
set_freq(ADF4351_LO, target_f);
set_freq(ADF4351_LO, target_f); // Never used as leakage is taken care under direct
else {
#define MAX_COMPENSATION 50000
if ( target_f < real_old_freq[ADF4351_LO] - MAX_COMPENSATION || target_f > real_old_freq[ADF4351_LO] + MAX_COMPENSATION )
@ -4508,16 +4510,16 @@ again: // Spur redu
}
}
#endif
} else if (setting.mode == M_HIGH || direct) {
} else if (setting.mode == M_HIGH || direct) { // direct means PATH_DIRECT or PATH_LEAKAGE
if (signal_path == PATH_DIRECT) {
set_freq (SI4463_RX, lf); // sweep RX, local_IF = 0 in high mode
if (setting.tracking_output)
set_freq (ADF4351_LO, lf);
} else {
} else { //PATH_LEAKAGE
freq_t target_f = lf;
if (setting.harmonic && lf > 6300000000ULL)
if (LO_harmonic)
target_f /= setting.harmonic;
set_freq (ADF4351_LO, lf); // sweep LO, local_IF = 0 in high mode
set_freq (ADF4351_LO, target_f); // sweep LO, local_IF = 0 in high mode
}
local_IF = 0;
} else if (setting.mode == M_GENHIGH) {
@ -5908,9 +5910,18 @@ static volatile int dummy;
// Position phase noise marker at requested offset
set_marker_index(1, markers[0].index + (setting.mode == M_LOW ? WIDTH/4 : -WIDTH/4));
} else if ((setting.measurement == M_PASS_BAND || setting.measurement == M_FM) && markers[0].index > 10) { // ----------------Pass band measurement
int t1 = 0;
int t2 = 0;
float v = actual_t[markers[0].index] - (in_selftest ? 6.0 : 3.0);
int t1;
int t2;
float v = -200;
t1 = (setting._sweep_points>>2);
t2 = (t1<<1) + t1;
for (int i=t1; i<t2; i++) {
if (v < actual_t[i])
v = actual_t[i];
}
t1 = 0;
t2 = 0;
v = v - (in_selftest ? 6.0 : 3.0);
while (t1 < markers[0].index && actual_t[t1+1] < v) // Find left -3dB point
t1++;
if (t1< markers[0].index)

23
ui.c

@ -2379,11 +2379,13 @@ static UI_FUNCTION_ADV_CALLBACK(menu_lowoutput_settings_acb)
(void)item;
if (b){
if (data == 255) {
plot_printf(mode_string, sizeof mode_string, "%s %s %s %s",
plot_printf(mode_string, sizeof mode_string, "%s%s%s%s%s",
(!force_signal_path ? "" : path_text[test_path]),
(get_sweep_frequency(ST_START) < MINIMUM_DIRECT_FREQ ? "SINE" : "" ),
(get_sweep_frequency(ST_STOP) >= MINIMUM_DIRECT_FREQ ? "SQUARE WAVE" : ""),
(get_sweep_frequency(ST_STOP) > MAX_LOW_OUTPUT_FREQ && setting.mixer_output ? "MIXER" : ""));
(get_sweep_frequency(ST_START) < MINIMUM_DIRECT_FREQ ? " SINE" : "" ),
(get_sweep_frequency(ST_STOP) >= MINIMUM_DIRECT_FREQ ? " SQUARE WAVE" : ""),
(get_sweep_frequency(ST_STOP) > MAX_LOW_OUTPUT_FREQ && setting.mixer_output ? " MIXER" : ""),
(LO_harmonic ? " HARM" : "")
);
b->param_1.text = mode_string;
return; }
b->icon = data == setting.mixer_output ? BUTTON_ICON_GROUP_CHECKED : BUTTON_ICON_GROUP;
@ -2983,9 +2985,9 @@ static UI_FUNCTION_ADV_CALLBACK(menu_measure_acb)
ui_mode_keypad(KM_CENTER);
set_marker_frequency(0, uistat.value);
#ifdef TINYSA4
kp_help_text = "Modulation frequency: 500Hz .. 20kHz";
kp_help_text = "Modulation frequency: 50Hz .. 20kHz";
ui_mode_keypad(KM_SPAN);
if (uistat.value < 500 || uistat.value > 20000)
if (uistat.value < 50 || uistat.value > 20000)
goto no_measurement;
set_RBW(uistat.value/300);
#else
@ -5493,7 +5495,7 @@ static void fetch_numeric_target(uint8_t mode)
plot_printf(uistat.text, sizeof uistat.text, "%.3QHz", uistat.freq_value);
break;
case KM_BAND_SPAN:
uistat.freq_value = setting.bands[active_band].end-setting.bands[active_band].start;
uistat.freq_value = abs(setting.bands[active_band].end-setting.bands[active_band].start);
plot_printf(uistat.text, sizeof uistat.text, "%.3QHz", uistat.freq_value);
break;
case KM_BAND_LEVEL:
@ -5756,6 +5758,8 @@ set_numeric_value(void)
#ifdef __BANDS__
case KM_BAND_START:
setting.bands[active_band].start = uistat.freq_value - (setting.frequency_offset - FREQUENCY_SHIFT);
if (setting.bands[active_band].end < setting.bands[active_band].start)
setting.bands[active_band].end = setting.bands[active_band].start;
update_frequencies();
dirty = true;
update_grid();
@ -5763,6 +5767,8 @@ set_numeric_value(void)
break;
case KM_BAND_END:
setting.bands[active_band].end = uistat.freq_value - (setting.frequency_offset - FREQUENCY_SHIFT);
if (setting.bands[active_band].start > setting.bands[active_band].end)
setting.bands[active_band].start = setting.bands[active_band].end;
update_frequencies();
dirty = true;
update_grid();
@ -5770,7 +5776,7 @@ set_numeric_value(void)
break;
case KM_BAND_CENTER:
{
freq_t span = (setting.bands[active_band].end - setting.bands[active_band].start);
freq_t span = abs(setting.bands[active_band].end - setting.bands[active_band].start);
freq_t center = uistat.freq_value - (setting.frequency_offset - FREQUENCY_SHIFT);
setting.bands[active_band].start = center - span/2;
setting.bands[active_band].end = center + span/2;
@ -7475,6 +7481,7 @@ ui_process_menu_lever(void)
static int
num_keypad_click(int c, int kp_index)
{
if (c == KP_EMPTY) return KP_CONTINUE;
if (c == KP_ENTER) c = KP_X1;
if ((c >= KP_X1 && c <= KP_G) || c == KP_m || c == KP_u || c == KP_n) {
#if 0

Loading…
Cancel
Save

Powered by TurnKey Linux.