leveloffset direct and ultra added

pull/34/head
erikkaashoek 4 years ago
parent 81159cdd07
commit fe67a2b209

@ -211,23 +211,14 @@ typedef uint32_t freq_t;
#define CORRECTION_LNA 1 #define CORRECTION_LNA 1
#define CORRECTION_LOW_ULTRA 2 #define CORRECTION_LOW_ULTRA 2
#define CORRECTION_LNA_ULTRA 3 #define CORRECTION_LNA_ULTRA 3
#ifdef DIRECT_CORRECTION #define CORRECTION_DIRECT 4
#define CORRECTION_DIRECT 4 #define CORRECTION_LNA_DIRECT 5
#define CORRECTION_LNA_DIRECT 5 #define CORRECTION_LOW_OUT 6
#define CORRECTION_LOW_OUT 6 #define CORRECTION_LOW_OUT_DIRECT 7
#define CORRECTION_LOW_OUT_DIRECT 7 #define CORRECTION_LOW_OUT_ADF 8
#define CORRECTION_LOW_OUT_ADF 8 #define CORRECTION_LOW_OUT_MIXER 9
#define CORRECTION_LOW_OUT_MIXER 9 #define CORRECTION_HIGH 10
#define CORRECTION_HIGH 10 #define CORRECTION_SIZE 11
#define CORRECTION_SIZE 11
#else
#define CORRECTION_LOW_OUT 4
#define CORRECTION_LOW_OUT_DIRECT 5
#define CORRECTION_LOW_OUT_ADF 6
#define CORRECTION_LOW_OUT_MIXER 7
#define CORRECTION_HIGH 8
#define CORRECTION_SIZE 9
#endif
#endif #endif
typedef float measurement_t[TRACES_MAX][POINTS_COUNT]; typedef float measurement_t[TRACES_MAX][POINTS_COUNT];
extern measurement_t measured; extern measurement_t measured;
@ -1660,6 +1651,15 @@ extern void SI4432_Listen(int s);
#ifdef TINYSA4 #ifdef TINYSA4
// si4432.c // si4432.c
enum {PATH_OFF, PATH_LOW, PATH_DIRECT, PATH_LEAKAGE, PATH_ULTRA, PATH_HIGH};
#define PATH_TEXT {"OFF", "LOW", "DIRECT", "ADF", "ULTRA", "High"}
extern const char *path_text[];
extern int signal_path;
extern int test_path;
extern int test_output;
extern void ADF4351_mux(int R); extern void ADF4351_mux(int R);
extern void ADF4351_force_refresh(void); extern void ADF4351_force_refresh(void);
extern void ADF4351_CP(int p); extern void ADF4351_CP(int p);

@ -146,10 +146,13 @@ int max_drive = 18;
#endif #endif
// 0 1 2 3 4 5 // 0 1 2 3 4 5
enum {PATH_OFF, PATH_LOW, PATH_DIRECT, PATH_LEAKAGE, PATH_ULTRA, PATH_HIGH}; // enum {PATH_OFF, PATH_LOW, PATH_DIRECT, PATH_LEAKAGE, PATH_ULTRA, PATH_HIGH};
int signal_path = PATH_OFF; int signal_path = PATH_OFF;
#ifdef TINYSA4 #ifdef TINYSA4
const char *path_text[]=PATH_TEXT;
void set_output_drive(int d) void set_output_drive(int d)
{ {
if (signal_path == PATH_LEAKAGE) if (signal_path == PATH_LEAKAGE)
@ -530,6 +533,7 @@ void reset_settings(int m)
setting.increased_R = false; setting.increased_R = false;
#endif #endif
update_min_max_freq(); update_min_max_freq();
test_output = false;
setting.frequency_var = 0; setting.frequency_var = 0;
sweep_mode |= SWEEP_ENABLE; sweep_mode |= SWEEP_ENABLE;
setting.unit_scale_index = 0; setting.unit_scale_index = 0;
@ -1434,7 +1438,11 @@ void set_actual_power(float o) // Set peak level to known value
config.high_level_offset += new_offset; config.high_level_offset += new_offset;
} else if (setting.mode == M_LOW) { } else if (setting.mode == M_LOW) {
#ifdef TINYSA4 #ifdef TINYSA4
if (setting.extra_lna) if (signal_path == PATH_ULTRA)
config.ultra_level_offset += new_offset;
else if (signal_path == PATH_DIRECT)
config.direct_level_offset += new_offset;
else if (setting.extra_lna)
config.lna_level_offset += new_offset; config.lna_level_offset += new_offset;
else else
#endif #endif
@ -1460,12 +1468,12 @@ float get_level_offset(void)
if (setting.mode == M_LOW) { if (setting.mode == M_LOW) {
int lev; int lev;
#ifdef TINYSA4 #ifdef TINYSA4
if (setting.extra_lna) { if (signal_path == PATH_DIRECT) {
lev = config.lna_level_offset;
} else if (signal_path == PATH_DIRECT) {
lev = config.direct_level_offset; lev = config.direct_level_offset;
} else if (signal_path == PATH_ULTRA) { } else if (signal_path == PATH_ULTRA) {
lev = config.ultra_level_offset; lev = config.ultra_level_offset;
} else if (setting.extra_lna) {
lev = config.lna_level_offset;
} else } else
#endif #endif
{ {
@ -7018,7 +7026,7 @@ float get_jump_config(int i) {
return 0; return 0;
} }
enum {CS_NORMAL, CS_LNA, CS_SWITCH, CS_MAX }; enum {CS_NORMAL, CS_LNA, CS_SWITCH, CS_ULTRA, CS_ULTRA990, CS_DIRECT, CS_MAX };
#else #else
enum {CS_NORMAL, CS_SWITCH, CS_MAX }; enum {CS_NORMAL, CS_SWITCH, CS_MAX };
#endif #endif
@ -7030,6 +7038,7 @@ void calibrate(void)
#ifdef TINYSA4 #ifdef TINYSA4
// setting.auto_IF = true; // set in selftest // setting.auto_IF = true; // set in selftest
// setting.frequency_IF = config.frequency_IF1; // set in selftest // setting.frequency_IF = config.frequency_IF1; // set in selftest
float direct_level=0.0;
setting.test_argument = -7; setting.test_argument = -7;
self_test(0); self_test(0);
int if_error = peakFreq - 30000000; int if_error = peakFreq - 30000000;
@ -7113,9 +7122,23 @@ again:
setting.atten_step = true; setting.atten_step = true;
break; break;
#ifdef TINYSA4 #ifdef TINYSA4
case CS_ULTRA:
test_output = true;
test_path = 2; // Ultra path
break;
case CS_LNA: case CS_LNA:
set_extra_lna(true); set_extra_lna(true);
break; break;
case CS_ULTRA990:
set_sweep_frequency(ST_CENTER, 990000000);
test_output = true;
test_path = 3; // Ultra path at 990MHz
break;
case CS_DIRECT:
set_sweep_frequency(ST_CENTER, 990000000);
test_output = true;
test_path = 5; // Direct path at 990MHz
break;
#endif #endif
} }
set_average(0, AV_100); set_average(0, AV_100);
@ -7164,7 +7187,7 @@ again:
#endif #endif
#endif #endif
if (k ==0 || k == 1) { if (k ==0 || k == 1) {
if (peakLevel < -50) { if (calibration_stage == CS_NORMAL && peakLevel < -50) {
ili9341_set_foreground(LCD_BRIGHT_COLOR_RED); ili9341_set_foreground(LCD_BRIGHT_COLOR_RED);
ili9341_drawstring_7x13("Signal level too low", 30, 140); ili9341_drawstring_7x13("Signal level too low", 30, 140);
ili9341_drawstring_7x13("Check cable between High and Low connectors", 30, 160); ili9341_drawstring_7x13("Check cable between High and Low connectors", 30, 160);
@ -7176,7 +7199,14 @@ again:
ili9341_drawstring_7x13("Calibration failed", 30, 140); ili9341_drawstring_7x13("Calibration failed", 30, 140);
goto quit; goto quit;
} else { } else {
set_actual_power(CAL_LEVEL); // Should be -23.5dBm (V0.2) OR 25 (V0.3) #ifdef TINYSA4
if (calibration_stage == CS_ULTRA990)
direct_level = peakLevel;
else if (calibration_stage == CS_DIRECT)
set_actual_power(direct_level);
else
#endif
set_actual_power(CAL_LEVEL); // Should be -23.5dBm (V0.2) OR 25 (V0.3)
chThdSleepMilliseconds(1000); chThdSleepMilliseconds(1000);
} }
} }

@ -1013,11 +1013,6 @@ static UI_FUNCTION_ADV_CALLBACK(menu_listen_acb)
#endif #endif
#ifdef TINYSA4 #ifdef TINYSA4
enum {PATH_OFF, PATH_LOW, PATH_DIRECT, PATH_ULTRA, PATH_LEAKAGE, PATH_HIGH};
const char *path_text[]={"OFF", "LOW", "DIRECT", "ULTRA", "ADF", "High"};
extern int signal_path;
extern int test_path;
extern int test_output;
static UI_FUNCTION_ADV_CALLBACK(menu_lowoutput_settings_acb) static UI_FUNCTION_ADV_CALLBACK(menu_lowoutput_settings_acb)
{ {
@ -3974,9 +3969,15 @@ redraw_cal_status:
} }
if (setting.disable_correction){ if (setting.disable_correction){
ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN); ili9341_set_foreground(LCD_BRIGHT_COLOR_RED);
lcd_printf(x, y, "Corr:\nOFF"); lcd_printf(x, y, "Corr:\nOFF");
y += 2*YSTEP; y += 2*YSTEP + YSTEP/2;
}
if (test_output){
ili9341_set_foreground(LCD_BRIGHT_COLOR_RED);
lcd_printf(x, y, "Path:\n%s", path_text[signal_path]);
y += 2*YSTEP + YSTEP/2;
} }
#endif #endif

Loading…
Cancel
Save

Powered by TurnKey Linux.