Robustness increase

Shifted some stack space
This commit is contained in:
erikkaashoek 2019-09-14 10:25:42 +02:00
parent 9ed5a41d2e
commit 4ff2f63b19
4 changed files with 39 additions and 9 deletions

View file

@ -120,7 +120,7 @@ CSRC = $(STARTUPSRC) \
$(STREAMSSRC) \
$(SHELLSRC) \
usbcfg.c \
main.c si5351.c tlv320aic3204.c dsp.c plot.c ui.c ili9341.c numfont20x24.c Font5x7.c flash.c adc.c
main.c si5351.c tlv320aic3204.c dsp.c plot.c ui.c ili9341.c numfont20x24.c Font5x7.c flash.c adc.c FFT.c
# $(TESTSRC) \

24
main.c
View file

@ -59,12 +59,15 @@ int8_t stop_the_world = FALSE;
BaseSequentialStream *saved_chp;
static THD_WORKING_AREA(waThread1, 640);
static THD_WORKING_AREA(waThread1, 640-64);
static THD_FUNCTION(Thread1, arg)
{
(void)arg;
chRegSetThreadName("sweep");
//FFT(measured[0],measured[1],101,0);
while (1) {
if (stop_the_world) {
__WFI();
@ -293,7 +296,7 @@ int16_t dump_selection = 0;
volatile int16_t wait_count = 0;
float measured[2][101][2];
float measured[2][MEASURED_LENGTH][2];
static void
wait_dsp(int count)
@ -1470,6 +1473,16 @@ static void cmd_trace(BaseSequentialStream *chp, int argc, char *argv[])
}
return;
}
#if 0
if (strcmp(argv[0], "tdr") == 0) {
set_trace_type(1, TRC_TDR);
trace[0].channel = 1; // Get data from S21 after doing the FFT
set_trace_type(1, TRC_OFF);
set_trace_type(2, TRC_OFF);
set_trace_type(3, TRC_OFF);
goto exit;
}
#endif
if (strcmp(argv[0], "all") == 0 &&
argc > 1 && strcmp(argv[1], "off") == 0) {
@ -1539,7 +1552,10 @@ static void cmd_trace(BaseSequentialStream *chp, int argc, char *argv[])
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} {scale|refpos} {value}\r\n");
}
#if 0
chprintf(chp, "trace tdr\r\n");
#endif
}
void set_electrical_delay(float picoseconds)
@ -1800,7 +1816,7 @@ static void cmd_version(BaseSequentialStream *chp, int argc, char *argv[])
chprintf(chp, "%s\r\n", NANOVNA_VERSION);
}
static THD_WORKING_AREA(waThread2, /* cmd_* max stack size + alpha */410);
static THD_WORKING_AREA(waThread2, /* cmd_* max stack size + alpha */410+64);
static const ShellCommand commands[] =
{

View file

@ -22,7 +22,8 @@
/*
* main.c
*/
extern float measured[2][101][2];
#define MEASURED_LENGTH 101
extern float measured[2][MEASURED_LENGTH][2];
#define CAL_LOAD 0
#define CAL_OPEN 1
@ -149,7 +150,7 @@ extern const uint32_t numfont20x24[][24];
#define TRACES_MAX 4
enum {
TRC_LOGMAG, TRC_PHASE, TRC_DELAY, TRC_SMITH, TRC_POLAR, TRC_LINEAR, TRC_SWR, TRC_REAL, TRC_IMAG, TRC_R, TRC_X, TRC_OFF
TRC_LOGMAG, TRC_PHASE, TRC_DELAY, TRC_SMITH, TRC_POLAR, TRC_LINEAR, TRC_SWR, TRC_REAL, TRC_IMAG, TRC_R, TRC_X, TRC_OFF, TRC_TDR
};
// LOGMAG: SCALE, REFPOS, REFVAL
@ -218,7 +219,7 @@ void request_to_draw_cells_behind_menu(void);
void request_to_draw_cells_behind_numeric_input(void);
void redraw_marker(int marker, int update_info);
void trace_get_info(int t, char *buf, int len);
void plot_into_index(float measured[2][101][2]);
void plot_into_index(float measured[2][MEASURED_LENGTH][2]);
void force_set_markmap(void);
void draw_all_cells(void);

15
plot.c
View file

@ -504,6 +504,7 @@ trace_into_index(int x, int t, int i, float coeff[2])
v = refpos - phase(coeff) * scale;
break;
case TRC_LINEAR:
case TRC_TDR:
v = refpos + linear(coeff) * scale;
break;
case TRC_SWR:
@ -785,9 +786,21 @@ mark_cells_from_index(void)
}
}
void plot_into_index(float measured[2][101][2])
void plot_into_index(float measured[2][MEASURED_LENGTH][2])
{
int i, t;
#if 0
if (trace[0].type == TRD_TDR && trace[0].enabled) {
// Covert real part of S11 to complex FFT in S21
for (i = 0; i < sweep_points; i++) {
int x = i * (WIDTH-1) / (sweep_points-1);
trace_index[t][i] = trace_into_index(x, 0, i, measured[1][i]);
}
}
} else
#endif
for (i = 0; i < sweep_points; i++) {
int x = i * (WIDTH-1) / (sweep_points-1);
for (t = 0; t < TRACES_MAX; t++) {