Enable execution of single selftest

tinySA-v0.2
erikkaashoek 6 years ago
parent 330aa3c6ec
commit 1b7d416e63

@ -567,6 +567,7 @@ typedef struct setting
float trigger_level;
int trigger;
int linearity_step;
int test_argument;
uint32_t checksum;
}setting_t;

@ -146,11 +146,15 @@ VNA_SHELL_FUNCTION(cmd_y)
VNA_SHELL_FUNCTION(cmd_selftest)
{
if (argc != 1) {
shell_printf("usage: selftest (1-3)\r\n");
if (argc < 1 || argc > 2) {
shell_printf("usage: selftest (1-3) [arg]\r\n");
return;
}
setting.test = my_atoi(argv[0]);
if (argc == 1)
setting.test_argument = 0;
else
setting.test_argument = my_atoi(argv[1]);
sweep_mode = SWEEP_SELFTEST;
}

@ -1850,14 +1850,19 @@ int validate_peak_below(int i, float margin) {
int validate_below(int tc, int from, int to) {
int status = TS_PASS;
float sum = 0;
int sum_count = 0;
for (int j = from; j < to; j++) {
if (actual_t[j] > stored_t[j] - 5)
status = TS_CRITICAL;
else if (actual_t[j] > stored_t[j]) {
sum += actual_t[j];
sum_count++;
if (actual_t[j] > stored_t[j]) {
status = TS_FAIL;
break;
}
}
sum = sum / sum_count;
if (sum > stored_t[from] - 5)
status = TS_CRITICAL;
if (status != TS_PASS)
test_fail_cause[tc] = "Above ";
return(status);
@ -2142,7 +2147,9 @@ void self_test(int test)
}
show_test_info = TRUE;
int i=0;
while (test_case[i].kind != TC_END) {
if (setting.test_argument > 0)
i=setting.test_argument-1;
do {
setting.frequency_IF = old_IF;
test_prepare(i);
test_acquire(i); // Acquire test
@ -2151,7 +2158,7 @@ void self_test(int test)
wait_user();
}
i++;
}
} while (test_case[i].kind != TC_END && setting.test_argument == 0 );
ili9341_set_foreground(BRIGHT_COLOR_GREEN);
ili9341_drawstring_7x13("Self test complete", 50, 200);
ili9341_drawstring_7x13("Touch screen to continue", 50, 215);

@ -543,6 +543,7 @@ static void menu_config_cb(int item, uint8_t data)
menu_move_back();
ui_mode_normal();
setting.test = 0;
setting.test_argument = 0;
sweep_mode = SWEEP_SELFTEST;
break;
case 4:

Loading…
Cancel
Save

Powered by TurnKey Linux.