mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
Remove test code
Optimize size trace command function
This commit is contained in:
parent
6f666cf31b
commit
90dc36418d
52
ili9341.c
52
ili9341.c
|
|
@ -338,58 +338,6 @@ void ili9341_init(void)
|
||||||
p += 2 + p[1];
|
p += 2 + p[1];
|
||||||
chThdSleepMilliseconds(5);
|
chThdSleepMilliseconds(5);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
int x1, y1, x2, y2;
|
|
||||||
x1 = y1 = 0;
|
|
||||||
y2 = 240 - 1;
|
|
||||||
for(x2=0; x2<320; x2+=6) ili9341_line(x1, y1, x2, y2);
|
|
||||||
x2 = 320 - 1;
|
|
||||||
for(y2=0; y2<240; y2+=6) ili9341_line(x1, y1, x2, y2);
|
|
||||||
chThdSleepMilliseconds(2000);*/
|
|
||||||
/*
|
|
||||||
char buf[64];
|
|
||||||
ili9341_fill(0,0, 320, 240, 255);
|
|
||||||
|
|
||||||
|
|
||||||
systime_t time = chVTGetSystemTimeX();
|
|
||||||
for (int c=0;c<255;c+=5)
|
|
||||||
ili9341_fill(0,0, 320, 240, RGB565(0,0,c));
|
|
||||||
chThdSleepMilliseconds(1000);
|
|
||||||
for (int c=0;c<255;c+=5)
|
|
||||||
ili9341_fill(0,0, 320, 240, RGB565(0,c,0));
|
|
||||||
chThdSleepMilliseconds(1000);
|
|
||||||
for (int c=0;c<255;c+=5)
|
|
||||||
ili9341_fill(0,0, 320, 240, RGB565(c,0,0));
|
|
||||||
chThdSleepMilliseconds(1000);
|
|
||||||
time = chVTGetSystemTimeX() - time;
|
|
||||||
chsnprintf(buf, sizeof buf, "Fill Time %d", time);
|
|
||||||
ili9341_drawstring(buf, 10,10);
|
|
||||||
chThdSleepMilliseconds(2000);
|
|
||||||
|
|
||||||
// time = chVTGetSystemTimeX();
|
|
||||||
// for (int c=0;c<50;c++)
|
|
||||||
// show_version();
|
|
||||||
// time = chVTGetSystemTimeX() - time;
|
|
||||||
// chsnprintf(buf, sizeof buf, "Fill Time %d", time);
|
|
||||||
|
|
||||||
chsnprintf(buf, sizeof buf, "0123456789123456789");
|
|
||||||
|
|
||||||
setForegroundColor(RGB565(255,0,0));
|
|
||||||
ili9341_drawstring(buf, 0, 0);
|
|
||||||
setForegroundColor(RGB565(0,255,0));
|
|
||||||
ili9341_drawstring(buf, 0, 8);
|
|
||||||
setForegroundColor(RGB565(0,0,255));
|
|
||||||
ili9341_drawstring(buf, 0, 16);
|
|
||||||
ili9341_drawstring(buf, 0, 24);
|
|
||||||
ili9341_drawstring(buf, 0, 32);
|
|
||||||
ili9341_fill(0, 64, 320, 64, 0);
|
|
||||||
chThdSleepMilliseconds(2000);
|
|
||||||
ili9341_read_memory(0, 0, 32, 16, 512, spi_buffer);
|
|
||||||
ili9341_bulk(32, 64, 32, 16);
|
|
||||||
ili9341_read_memory(0, 16, 32, 16, 512, spi_buffer);
|
|
||||||
ili9341_bulk(32, 64+16, 32, 16);
|
|
||||||
chThdSleepMilliseconds(5000);/**/
|
|
||||||
/**/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __USE_DISPLAY_DMA__
|
#ifndef __USE_DISPLAY_DMA__
|
||||||
|
|
|
||||||
57
main.c
57
main.c
|
|
@ -1541,6 +1541,11 @@ my_atof(const char *p)
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char *tracename;
|
||||||
|
uint8_t type;
|
||||||
|
} type_list;
|
||||||
|
|
||||||
static void cmd_trace(BaseSequentialStream *chp, int argc, char *argv[])
|
static void cmd_trace(BaseSequentialStream *chp, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int t;
|
int t;
|
||||||
|
|
@ -1575,34 +1580,29 @@ static void cmd_trace(BaseSequentialStream *chp, int argc, char *argv[])
|
||||||
chprintf(chp, "%d %s %s\r\n", t, type, channel);
|
chprintf(chp, "%d %s %s\r\n", t, type, channel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (strcmp(argv[1], "logmag") == 0) {
|
static const type_list t_list[] = {
|
||||||
set_trace_type(t, TRC_LOGMAG);
|
{"logmag", TRC_LOGMAG},
|
||||||
} else if (strcmp(argv[1], "phase") == 0) {
|
{"phase", TRC_PHASE},
|
||||||
set_trace_type(t, TRC_PHASE);
|
{"polar", TRC_POLAR},
|
||||||
} else if (strcmp(argv[1], "polar") == 0) {
|
{"smith", TRC_SMITH},
|
||||||
set_trace_type(t, TRC_POLAR);
|
{"delay", TRC_DELAY},
|
||||||
} else if (strcmp(argv[1], "smith") == 0) {
|
{"linear", TRC_LINEAR},
|
||||||
set_trace_type(t, TRC_SMITH);
|
{"swr", TRC_SWR},
|
||||||
} else if (strcmp(argv[1], "delay") == 0) {
|
{"real", TRC_REAL},
|
||||||
set_trace_type(t, TRC_DELAY);
|
{"imag", TRC_IMAG},
|
||||||
} else if (strcmp(argv[1], "linear") == 0) {
|
{"r", TRC_R},
|
||||||
set_trace_type(t, TRC_LINEAR);
|
{"x", TRC_X},
|
||||||
} else if (strcmp(argv[1], "swr") == 0) {
|
{"off", TRC_OFF},
|
||||||
set_trace_type(t, TRC_SWR);
|
};
|
||||||
} else if (strcmp(argv[1], "real") == 0) {
|
for (uint16_t i=0; i<sizeof(t_list)/sizeof(type_list); i++){
|
||||||
set_trace_type(t, TRC_REAL);
|
if (strcmp(argv[1], t_list[i].tracename) == 0) {
|
||||||
} else if (strcmp(argv[1], "imag") == 0) {
|
set_trace_type(t, t_list[i].type);
|
||||||
set_trace_type(t, TRC_IMAG);
|
goto check_ch_num;
|
||||||
} else if (strcmp(argv[1], "r") == 0) {
|
}
|
||||||
set_trace_type(t, TRC_R);
|
}
|
||||||
} else if (strcmp(argv[1], "x") == 0) {
|
if (strcmp(argv[1], "scale") == 0 && argc >= 3) {
|
||||||
set_trace_type(t, TRC_X);
|
|
||||||
} else if (strcmp(argv[1], "linear") == 0) {
|
|
||||||
set_trace_type(t, TRC_LINEAR);
|
|
||||||
} else if (strcmp(argv[1], "off") == 0) {
|
|
||||||
set_trace_type(t, TRC_OFF);
|
|
||||||
} else if (strcmp(argv[1], "scale") == 0 && argc >= 3) {
|
|
||||||
//trace[t].scale = my_atof(argv[2]);
|
//trace[t].scale = my_atof(argv[2]);
|
||||||
set_trace_scale(t, my_atof(argv[2]));
|
set_trace_scale(t, my_atof(argv[2]));
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
@ -1614,6 +1614,7 @@ static void cmd_trace(BaseSequentialStream *chp, int argc, char *argv[])
|
||||||
goto usage;
|
goto usage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
check_ch_num:
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
int src = atoi(argv[2]);
|
int src = atoi(argv[2]);
|
||||||
if (src != 0 && src != 1)
|
if (src != 0 && src != 1)
|
||||||
|
|
@ -1623,7 +1624,7 @@ static void cmd_trace(BaseSequentialStream *chp, int argc, char *argv[])
|
||||||
exit:
|
exit:
|
||||||
return;
|
return;
|
||||||
usage:
|
usage:
|
||||||
chprintf(chp, "trace {0|1|2|3|all} [logmag|phase|smith|linear|delay|swr|real|imag|r|x|off] [src]\r\n");
|
chprintf(chp, "trace {0|1|2|3|all} [logmag|phase|polar|smith|linear|delay|swr|real|imag|r|x|off] [src]\r\n");
|
||||||
chprintf(chp, "trace {0|1|2|3} {scale|refpos} {value}\r\n");
|
chprintf(chp, "trace {0|1|2|3} {scale|refpos} {value}\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue