mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
adjust memory allocation for keep caldata
This commit is contained in:
parent
b5abce3dfc
commit
01057921f6
|
|
@ -313,7 +313,7 @@
|
||||||
* buffers.
|
* buffers.
|
||||||
*/
|
*/
|
||||||
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
|
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
|
||||||
#define SERIAL_USB_BUFFERS_SIZE 256
|
#define SERIAL_USB_BUFFERS_SIZE 128
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -321,7 +321,7 @@
|
||||||
* @note The default is 2 buffers.
|
* @note The default is 2 buffers.
|
||||||
*/
|
*/
|
||||||
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
|
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
|
||||||
#define SERIAL_USB_BUFFERS_NUMBER 2
|
#define SERIAL_USB_BUFFERS_NUMBER 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
|
||||||
|
|
@ -783,22 +783,22 @@ force_set_markmap(void)
|
||||||
memset(markmap[current_mappage], 0xff, sizeof markmap[current_mappage]);
|
memset(markmap[current_mappage], 0xff, sizeof markmap[current_mappage]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void plot_into_index(float measured[101][4])
|
void plot_into_index(float measured[101][2][2])
|
||||||
{
|
{
|
||||||
int i, t;
|
int i, t;
|
||||||
for (i = 0; i < 101; i++) {
|
for (i = 0; i < 101; i++) {
|
||||||
int x = i * (WIDTH-1) / (101-1);
|
int x = i * (WIDTH-1) / (101-1);
|
||||||
for (t = 0; t < TRACES_MAX; t++) {
|
for (t = 0; t < TRACES_MAX; t++) {
|
||||||
int n = (t % 2)*2;
|
int n = t % 2;
|
||||||
if (!trace[t].enabled)
|
if (!trace[t].enabled)
|
||||||
continue;
|
continue;
|
||||||
if (trace[t].polar) {
|
if (trace[t].polar) {
|
||||||
int x1, y1;
|
int x1, y1;
|
||||||
cartesian_scale(measured[i][n+1], measured[i][n], &x1, &y1);
|
cartesian_scale(measured[i][n][1], measured[i][n][0], &x1, &y1);
|
||||||
trace_index[t][i] = INDEX(x1, y1, i);
|
trace_index[t][i] = INDEX(x1, y1, i);
|
||||||
//mark_map(x1>>5, y1>>5);
|
//mark_map(x1>>5, y1>>5);
|
||||||
} else {
|
} else {
|
||||||
int y1 = logmag(&measured[i][n]) * 29;
|
int y1 = logmag(measured[i][n]) * 29;
|
||||||
trace_index[t][i] = INDEX(x, y1, i);
|
trace_index[t][i] = INDEX(x, y1, i);
|
||||||
//mark_map(x>>5, y1>>5);
|
//mark_map(x>>5, y1>>5);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
43
main.c
43
main.c
|
|
@ -44,7 +44,7 @@ static MUTEX_DECL(mutex);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static THD_WORKING_AREA(waThread1, 512);
|
static THD_WORKING_AREA(waThread1, 384);
|
||||||
static THD_FUNCTION(Thread1, arg)
|
static THD_FUNCTION(Thread1, arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
@ -213,9 +213,19 @@ volatile int16_t wait_count = 0;
|
||||||
int16_t dump_selection = 0;
|
int16_t dump_selection = 0;
|
||||||
|
|
||||||
int16_t dsp_disabled = FALSE;
|
int16_t dsp_disabled = FALSE;
|
||||||
float measured[101][4];
|
float measured[101][2][2];
|
||||||
uint32_t frequencies[101];
|
uint32_t frequencies[101];
|
||||||
|
|
||||||
|
float caldata[101][5][2];
|
||||||
|
uint16_t cal_status;
|
||||||
|
|
||||||
|
#define CAL_LOAD 0
|
||||||
|
#define CAL_OPEN 1
|
||||||
|
#define CAL_SHORT 2
|
||||||
|
#define CAL_THRU 3
|
||||||
|
#define CAL_ISOLN 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void i2s_end_callback(I2SDriver *i2sp, size_t offset, size_t n)
|
void i2s_end_callback(I2SDriver *i2sp, size_t offset, size_t n)
|
||||||
{
|
{
|
||||||
|
|
@ -364,7 +374,7 @@ void scan_lcd(void)
|
||||||
while (wait_count)
|
while (wait_count)
|
||||||
;
|
;
|
||||||
__disable_irq();
|
__disable_irq();
|
||||||
calclate_gamma(&measured[i][2]);
|
calclate_gamma(&measured[i][1]);
|
||||||
__enable_irq();
|
__enable_irq();
|
||||||
|
|
||||||
delay = set_frequency(frequencies[(i+1)%sweep_points]);
|
delay = set_frequency(frequencies[(i+1)%sweep_points]);
|
||||||
|
|
@ -445,6 +455,30 @@ static void cmd_sweep(BaseSequentialStream *chp, int argc, char *argv[])
|
||||||
set_sweep(freq_start, freq_stop);
|
set_sweep(freq_start, freq_stop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void cmd_cal(BaseSequentialStream *chp, int argc, char *argv[])
|
||||||
|
{
|
||||||
|
|
||||||
|
if (argc == 0) {
|
||||||
|
chprintf(chp, "%d\r\n", cal_status);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *cmd = argv[1];
|
||||||
|
int s;
|
||||||
|
if (strcmp(cmd, "load")) {
|
||||||
|
cal_status |= CAL_LOAD;
|
||||||
|
memcpy(caldata[CAL_LOAD], measured[0], sizeof measured[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[])
|
static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -547,7 +581,7 @@ static void cmd_stat(BaseSequentialStream *chp, int argc, char *argv[])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(2048)
|
#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(384)
|
||||||
|
|
||||||
static const ShellCommand commands[] =
|
static const ShellCommand commands[] =
|
||||||
{
|
{
|
||||||
|
|
@ -568,6 +602,7 @@ static const ShellCommand commands[] =
|
||||||
{ "plot", cmd_scan_lcd },
|
{ "plot", cmd_scan_lcd },
|
||||||
{ "pause", cmd_pause },
|
{ "pause", cmd_pause },
|
||||||
{ "resume", cmd_resume },
|
{ "resume", cmd_resume },
|
||||||
|
{ "cal", cmd_cal },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ void sweep_tail(void);
|
||||||
void redraw(void);
|
void redraw(void);
|
||||||
void polar_plot(float measured[101][4]);
|
void polar_plot(float measured[101][4]);
|
||||||
|
|
||||||
void plot_into_index(float measured[101][4]);
|
void plot_into_index(float measured[101][2][2]);
|
||||||
void draw_cell_all(void);
|
void draw_cell_all(void);
|
||||||
|
|
||||||
extern const uint16_t x5x7_bits [];
|
extern const uint16_t x5x7_bits [];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue