diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
index 1d1c7aa..47218fa 100644
--- a/.settings/language.settings.xml
+++ b/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
diff --git a/NANOVNA_STM32_F072/board.h b/NANOVNA_STM32_F072/board.h
index 143a48e..06944c9 100644
--- a/NANOVNA_STM32_F072/board.h
+++ b/NANOVNA_STM32_F072/board.h
@@ -131,7 +131,7 @@
PIN_MODE_ANALOG(GPIOA_XP) | \
PIN_MODE_ANALOG(GPIOA_YP) | \
PIN_MODE_ALTERNATE(GPIOA_MCO) | \
- PIN_MOD_ULTRA(9U) | \
+ PIN_MODE_INPUT(9U) | \
PIN_MODE_OUTPUT(GPIOA_USB_DISC) | \
PIN_MODE_INPUT(GPIOA_USB_DM) | \
PIN_MODE_INPUT(GPIOA_USB_DP) | \
diff --git a/main.c b/main.c
index 7b1f13f..da4ff09 100644
--- a/main.c
+++ b/main.c
@@ -2348,7 +2348,7 @@ VNA_SHELL_FUNCTION(cmd_m)
pause_sweep();
int32_t f_step = (frequencyStop-frequencyStart)/ points;
- palClearPad(GPIOC, GPIOC_LED); // disable led and wait for voltage stabilization
+ palClearPad(GPIOB, GPIOB_LED); // disable led and wait for voltage stabilization
int old_step = setting_frequency_step;
setting_frequency_step = f_step;
update_rbw();
@@ -2367,7 +2367,7 @@ VNA_SHELL_FUNCTION(cmd_m)
setting_frequency_step = old_step;
update_rbw();
resume_sweep();
- palSetPad(GPIOC, GPIOC_LED);
+ palSetPad(GPIOB, GPIOB_LED);
}
VNA_SHELL_FUNCTION(cmd_p)
diff --git a/plot.c b/plot.c
index 893fe6a..14669f1 100644
--- a/plot.c
+++ b/plot.c
@@ -1912,15 +1912,19 @@ static void cell_draw_marker_info(int x0, int y0)
float ir = logmag(&(actual_t[markers[3].index]));
float sl = logmag(&(actual_t[markers[0].index]));
float sr = logmag(&(actual_t[markers[1].index]));
- sl = (sl + sr)/2;
- il = (il + ir)/2;
- il = sl+ (sl - il)/2;
- plot_printf(buf, sizeof buf, "OIP3: %4.1fdB", il);
+ float ip = sl+ (sr - il)/2;
+ plot_printf(buf, sizeof buf, "OIP3: %4.1fdB", ip);
j = 2;
int xpos = 1 + (j%2)*(WIDTH/2) + CELLOFFSETX - x0;
int ypos = 1 + (j/2)*(16) - y0;
+ cell_drawstring_7x13(buf, xpos, ypos);
+ ip = sr+ (sl - ir)/2;
+ plot_printf(buf, sizeof buf, "OIP3: %4.1fdB", ip);
+ j = 3;
+ xpos = 1 + (j%2)*(WIDTH/2) + CELLOFFSETX - x0;
+ ypos = 1 + (j/2)*(16) - y0;
cell_drawstring_7x13(buf, xpos, ypos);
break;
}
diff --git a/sa_core.c b/sa_core.c
index f6d7efb..9828651 100644
--- a/sa_core.c
+++ b/sa_core.c
@@ -56,7 +56,7 @@ void reset_settings(int m)
setting_show_stored = 0;
setting_auto_attenuation = true;
setting_subtract_stored = 0;
- setting_drive=12;
+ setting_drive=15;
setting_step_atten = 0; // Only used in low output mode
setting_agc = true;
setting_lna = false;
@@ -974,7 +974,12 @@ again:
setFreq (2, IF_2 + lf);
setFreq (1, 433800000);
#else
- setFreq (1, local_IF+lf);
+#ifdef BELOW_IF_BELOW_50MHZ
+ if (setting_mode == M_LOW && lf < 50000000)
+ setFreq (1, local_IF-lf);
+ else
+#endif
+ setFreq (1, local_IF+lf);
#endif
}
if (MODE_OUTPUT(setting_mode)) // No substepping in output mode
@@ -1186,7 +1191,13 @@ static bool sweep(bool break_on_operation)
if (r < l) {
l = markers[1].index;
r = markers[0].index;
+ markers[0].index = l;
+ markers[1].index = r;
}
+ uint32_t lf = frequencies[l];
+ uint32_t rf = frequencies[r];
+ markers[2].enabled = search_maximum(2, lf - (rf - lf), 12);
+ markers[3].enabled = search_maximum(3, rf + (rf - lf), 12);
} else if (setting_measurement == M_PHASE_NOISE && markers[0].index > 10) {
markers[1].index = markers[0].index + (setting_mode == M_LOW ? 290/4 : -290/4); // Position phase noise marker at requested offset
} else if (setting_measurement == M_STOP_BAND && markers[0].index > 10) {
diff --git a/ui_sa.c b/ui_sa.c
index 9aae4f5..1b77b8c 100644
--- a/ui_sa.c
+++ b/ui_sa.c
@@ -667,9 +667,10 @@ static void menu_measure_cb(int item, uint8_t data)
reset_settings(GetMode());
for (int i = 0; i< MARKERS_MAX; i++) {
markers[i].enabled = M_ENABLED;
- markers[i].mtype = M_DELTA | M_TRACKING;
+ markers[i].mtype = M_DELTA;
}
markers[0].mtype = M_REFERENCE | M_TRACKING;
+ markers[1].mtype = M_TRACKING;
kp_help_text = "Frequency of left signal";
ui_mode_keypad(KM_CENTER);
ui_process_keypad();
@@ -679,7 +680,7 @@ static void menu_measure_cb(int item, uint8_t data)
ui_process_keypad();
int right = uistat.value;
set_sweep_frequency(ST_CENTER, (left+right)/2);
- set_sweep_frequency(ST_SPAN, (right - left)*4);
+ set_sweep_frequency(ST_SPAN, (right - left)*5);
set_measurement(M_OIP3);
break;
case M_PHASE_NOISE: // Phase noise