Calibration warnings added

pull/34/head
erikkaashoek 3 years ago
parent b9d3f9c1b6
commit 5eae92151d

@ -18,7 +18,7 @@
*/
#include "ch.h"
//#ifdef TINYSA_F303
#ifdef TINYSA_F303
#ifdef TINYSA_F072
#error "Remove comment for #ifdef TINYSA_F303"
#endif
@ -26,7 +26,7 @@
#define TINYSA4
#endif
#define TINYSA4_PROTO
//#endif
#endif
#ifdef TINYSA_F072
#ifdef TINYSA_F303
@ -583,8 +583,11 @@ extern uint16_t graph_bottom;
#define MENU_BUTTON_HEIGHT_N(n) (LCD_HEIGHT/(n)-1)
// Define message box width
#ifdef TINYSA4
#define MESSAGE_BOX_WIDTH 300
#else
#define MESSAGE_BOX_WIDTH 180
#endif
// Form button (at center screen better be less LCD_WIDTH - 2*OFFSETX)
#define MENU_FORM_WIDTH (LCD_WIDTH - 2*OFFSETX)

@ -5296,7 +5296,7 @@ static volatile int dummy;
peakLevel = -170;
temp_min_level = 100;
for (int t=(in_selftest? 0 : TRACES_MAX-1); t >= 0; t--) { // During selftest only trace 0 is used.
if (IS_TRACE_ENABLE(t) && !(ignore_stored && (t == TRACE_STORED))) {
if (IS_TRACE_ENABLE(t) && !(ignore_stored && (t == TRACE_STORED))) { // Selftest 0 1 switches off in_selftest so ignore stored trace
float *trace_data = measured[t];
for (int i=0;i<sweep_points; i++) {
add_to_peak_finding(trace_data, i);
@ -7214,6 +7214,8 @@ abort:
void reset_calibration(void)
{
config.is_calibrated = false;
config.low_level_offset = 100;
config.low_level_output_offset = 100;
}
void calibrate_modulation(int modulation, int8_t *correction)

@ -572,6 +572,26 @@ static const menuitem_t menu_lowoutput_settings[];
extern bool dirty;
char range_text[20];
#ifdef TINYSA4
int input_is_calibrated(void)
{
if (config.low_level_offset != 100)
return true;
drawMessageBox("Error", "First calibrate 100kHz to 5.34GHz input", 2000);
redraw_request|= REDRAW_AREA;
return false;
}
int output_is_calibrated(void)
{
if (config.low_level_output_offset != 100)
return true;
drawMessageBox("Error", "First calibrate 30MHz output", 2000);
redraw_request|= REDRAW_AREA;
return false;
}
#endif
static UI_FUNCTION_ADV_CALLBACK(menu_sweep_acb)
{
(void)data;
@ -703,7 +723,7 @@ static UI_FUNCTION_CALLBACK(menu_input_curve_prepare_cb)
{
(void)item;
(void)data;
if (!config.is_calibrated)
if (!input_is_calibrated())
return;
kp_help_text = "Enter actual input level";
kp_buf[0]=0;
@ -719,7 +739,7 @@ static UI_FUNCTION_CALLBACK(menu_lna_curve_prepare_cb)
{
(void)item;
(void)data;
if (!config.is_calibrated)
if (!input_is_calibrated())
return;
kp_help_text = "Enter actual input level";
kp_buf[0]=0;
@ -735,7 +755,7 @@ static UI_FUNCTION_CALLBACK(menu_lna_u_curve_prepare_cb)
{
(void)item;
(void)data;
if (!config.is_calibrated)
if (!input_is_calibrated())
return;
kp_help_text = "Enter actual input level";
kp_buf[0]=0;
@ -751,7 +771,7 @@ static UI_FUNCTION_CALLBACK(menu_ultra_curve_prepare_cb)
{
(void)item;
(void)data;
if (!config.is_calibrated)
if (!input_is_calibrated())
return;
kp_help_text = "Enter actual input level";
kp_buf[0]=0;
@ -767,11 +787,8 @@ static UI_FUNCTION_CALLBACK(menu_output_curve_prepare_cb)
{
(void)item;
(void)data;
if (config.low_level_output_offset == 100) {
drawMessageBox("Error", "First set OUTPUT LEVEL", 2000);
redraw_request|= REDRAW_AREA;
if (!output_is_calibrated())
return;
}
current_curve = CORRECTION_LOW_OUT;
menu_push_submenu(menu_curve);
}
@ -821,6 +838,8 @@ static UI_FUNCTION_ADV_CALLBACK(menu_output_level2_acb)
if (b){
return;
}
if (!output_is_calibrated())
return;
int old_m = setting.mode;
reset_settings(M_GENLOW);
set_level(-30);
@ -849,6 +868,8 @@ static UI_FUNCTION_ADV_CALLBACK(menu_output_level3_acb)
if (b){
return;
}
if (!output_is_calibrated())
return;
int old_m = setting.mode;
reset_settings(M_GENLOW);
@ -1014,6 +1035,8 @@ static UI_FUNCTION_CALLBACK(menu_calibrate_cb)
break;
#ifdef TINYSA4
case 3:
if (!input_is_calibrated())
return;
sweep_mode = SWEEP_CALIBRATE_HARMONIC;
menu_move_back(false);
menu_move_back(true);
@ -3117,7 +3140,7 @@ static const menuitem_t menu_settings[] =
#ifdef TINYSA4
{ MT_ADV_CALLBACK,0, "PROGRESS\nBAR", menu_progress_bar_acb},
{ MT_KEYPAD, KM_FREQ_CORR, "FREQ CORR\n\b%s", "Enter ppb correction"},
{ MT_SUBMENU, 0, "CALIBRATE\nHARMONIC", menu_calibrate_harmonic},
// { MT_SUBMENU, 0, "CALIBRATE\nHARMONIC", menu_calibrate_harmonic},
#endif
#ifdef __NOISE_FIGURE__
{ MT_KEYPAD, KM_NF, "NF\n\b%s", "Enter tinySA noise figure"},

Loading…
Cancel
Save

Powered by TurnKey Linux.