2017-01-01 12:03:21 +01:00
|
|
|
|
/*
|
2017-01-02 07:45:25 +01:00
|
|
|
|
* Copyright (c) 2016-2017, TAKAHASHI Tomohiro (TTRFTECH) edy555@gmail.com
|
2017-01-01 12:03:21 +01:00
|
|
|
|
* All rights reserved.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This is free software; you can redistribute it and/or modify
|
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
* the Free Software Foundation; either version 3, or (at your option)
|
|
|
|
|
|
* any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* The software is distributed in the hope that it will be useful,
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
|
* along with GNU Radio; see the file COPYING. If not, write to
|
|
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
|
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2016-09-05 00:27:44 +02:00
|
|
|
|
#include "ch.h"
|
|
|
|
|
|
#include "hal.h"
|
|
|
|
|
|
#include "usbcfg.h"
|
|
|
|
|
|
#include "si5351.h"
|
|
|
|
|
|
#include "nanovna.h"
|
2019-09-10 15:39:20 +02:00
|
|
|
|
#include "fft.h"
|
2016-09-05 00:27:44 +02:00
|
|
|
|
|
|
|
|
|
|
#include <chprintf.h>
|
|
|
|
|
|
#include <string.h>
|
2016-09-28 15:48:53 +02:00
|
|
|
|
#include <math.h>
|
2016-09-05 00:27:44 +02:00
|
|
|
|
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
/*
|
|
|
|
|
|
* Shell settings
|
|
|
|
|
|
*/
|
2020-03-21 00:03:09 +01:00
|
|
|
|
// If need run shell as thread (use more amount of memory fore stack), after
|
|
|
|
|
|
// enable this need reduce spi_buffer size, by default shell run in main thread
|
|
|
|
|
|
// #define VNA_SHELL_THREAD
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
|
|
|
|
|
|
static BaseSequentialStream *shell_stream = (BaseSequentialStream *)&SDU1;
|
|
|
|
|
|
|
|
|
|
|
|
// Shell new line
|
|
|
|
|
|
#define VNA_SHELL_NEWLINE_STR "\r\n"
|
|
|
|
|
|
// Shell command promt
|
|
|
|
|
|
#define VNA_SHELL_PROMPT_STR "ch> "
|
|
|
|
|
|
// Shell max arguments
|
|
|
|
|
|
#define VNA_SHELL_MAX_ARGUMENTS 4
|
|
|
|
|
|
// Shell max command line size
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
#define VNA_SHELL_MAX_LENGTH 48
|
2020-03-21 00:03:09 +01:00
|
|
|
|
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
// Shell command functions prototypes
|
2020-03-21 00:03:09 +01:00
|
|
|
|
typedef void (*vna_shellcmd_t)(int argc, char *argv[]);
|
|
|
|
|
|
#define VNA_SHELL_FUNCTION(command_name) \
|
|
|
|
|
|
static void command_name(int argc, char *argv[])
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
|
2020-03-12 17:53:58 +01:00
|
|
|
|
// Shell command line buffer, args, nargs, and function ptr
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
static char shell_line[VNA_SHELL_MAX_LENGTH];
|
2020-03-21 00:03:09 +01:00
|
|
|
|
static char *shell_args[VNA_SHELL_MAX_ARGUMENTS + 1];
|
2020-03-12 17:53:58 +01:00
|
|
|
|
static uint16_t shell_nargs;
|
|
|
|
|
|
static volatile vna_shellcmd_t shell_function = 0;
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
|
2019-10-20 14:54:42 +02:00
|
|
|
|
//#define ENABLED_DUMP
|
2020-03-12 19:43:35 +01:00
|
|
|
|
// Allow get threads debug info
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
//#define ENABLE_THREADS_COMMAND
|
2020-03-12 19:43:35 +01:00
|
|
|
|
// Enable vbat_offset command, allow change battery voltage correction in config
|
2020-03-07 21:37:39 +01:00
|
|
|
|
#define ENABLE_VBAT_OFFSET_COMMAND
|
2020-03-12 19:43:35 +01:00
|
|
|
|
// Info about NanoVNA, need fore soft
|
2020-03-08 06:32:38 +01:00
|
|
|
|
#define ENABLE_INFO_COMMAND
|
2020-03-12 19:43:35 +01:00
|
|
|
|
// Enable color command, allow change config color for traces, grid, menu
|
|
|
|
|
|
#define ENABLE_COLOR_COMMAND
|
2020-04-29 13:07:07 +02:00
|
|
|
|
// Enable I2C command for send data to AIC3204, used for debug
|
2020-03-21 14:15:03 +01:00
|
|
|
|
//#define ENABLE_I2C_COMMAND
|
2020-07-17 16:36:14 +02:00
|
|
|
|
//#define ENABLE_LCD_COMMAND
|
2020-03-21 14:15:03 +01:00
|
|
|
|
|
2020-04-29 13:07:07 +02:00
|
|
|
|
static void apply_CH0_error_term_at(int i);
|
|
|
|
|
|
static void apply_CH1_error_term_at(int i);
|
|
|
|
|
|
static void apply_edelay(void);
|
|
|
|
|
|
|
|
|
|
|
|
static uint16_t get_sweep_mode(void);
|
2017-09-17 13:19:12 +02:00
|
|
|
|
static void cal_interpolate(int s);
|
2020-03-14 13:18:14 +01:00
|
|
|
|
static void update_frequencies(void);
|
|
|
|
|
|
static void set_frequencies(uint32_t start, uint32_t stop, uint16_t points);
|
2020-06-04 19:26:06 +02:00
|
|
|
|
static bool sweep(bool break_on_operation, uint16_t sweep_mode);
|
2020-02-28 16:52:25 +01:00
|
|
|
|
static void transform_domain(void);
|
2020-04-29 13:07:07 +02:00
|
|
|
|
static int32_t my_atoi(const char *p);
|
|
|
|
|
|
static uint32_t my_atoui(const char *p);
|
2016-09-28 01:47:46 +02:00
|
|
|
|
|
2020-03-07 15:19:43 +01:00
|
|
|
|
// Obsolete, always use interpolate
|
|
|
|
|
|
#define cal_auto_interpolate TRUE
|
2020-03-07 12:54:51 +01:00
|
|
|
|
|
2020-04-29 13:30:22 +02:00
|
|
|
|
static uint8_t drive_strength = SI5351_CLK_DRIVE_STRENGTH_8MA;
|
2020-03-07 20:21:02 +01:00
|
|
|
|
int8_t sweep_mode = SWEEP_ENABLE;
|
2020-03-07 12:54:51 +01:00
|
|
|
|
volatile uint8_t redraw_request = 0; // contains REDRAW_XXX flags
|
2016-09-28 02:35:20 +02:00
|
|
|
|
|
2020-03-21 14:15:03 +01:00
|
|
|
|
// sweep operation variables
|
2020-03-31 23:36:43 +02:00
|
|
|
|
volatile uint16_t wait_count = 0;
|
2020-03-21 14:15:03 +01:00
|
|
|
|
|
|
|
|
|
|
static uint16_t p_sweep = 0;
|
|
|
|
|
|
// ChibiOS i2s buffer must be 2x size (for process one while next buffer filled by DMA)
|
|
|
|
|
|
static int16_t rx_buffer[AUDIO_BUFFER_LEN * 2];
|
|
|
|
|
|
// Sweep measured data
|
|
|
|
|
|
float measured[2][POINTS_COUNT][2];
|
2020-04-29 13:23:59 +02:00
|
|
|
|
uint32_t frequencies[POINTS_COUNT];
|
2020-03-21 14:15:03 +01:00
|
|
|
|
|
2020-03-08 06:32:38 +01:00
|
|
|
|
// Version text, displayed in Config->Version menu, also send by info command
|
|
|
|
|
|
const char *info_about[]={
|
2020-07-09 19:42:45 +02:00
|
|
|
|
"Board: " BOARD_NAME,
|
2020-03-08 06:32:38 +01:00
|
|
|
|
"2016-2020 Copyright @edy555",
|
|
|
|
|
|
"Licensed under GPL. See: https://github.com/ttrftech/NanoVNA",
|
|
|
|
|
|
"Version: " VERSION,
|
|
|
|
|
|
"Build Time: " __DATE__ " - " __TIME__,
|
|
|
|
|
|
"Kernel: " CH_KERNEL_VERSION,
|
|
|
|
|
|
"Compiler: " PORT_COMPILER_NAME,
|
|
|
|
|
|
"Architecture: " PORT_ARCHITECTURE_NAME " Core Variant: " PORT_CORE_VARIANT_NAME,
|
|
|
|
|
|
"Port Info: " PORT_INFO,
|
|
|
|
|
|
"Platform: " PLATFORM_NAME,
|
|
|
|
|
|
0 // sentinel
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2020-07-01 11:30:31 +02:00
|
|
|
|
static THD_WORKING_AREA(waThread1, 768);
|
2016-09-05 00:27:44 +02:00
|
|
|
|
static THD_FUNCTION(Thread1, arg)
|
|
|
|
|
|
{
|
2020-02-27 18:53:45 +01:00
|
|
|
|
(void)arg;
|
|
|
|
|
|
chRegSetThreadName("sweep");
|
2016-09-05 00:27:44 +02:00
|
|
|
|
|
2020-02-27 18:53:45 +01:00
|
|
|
|
while (1) {
|
|
|
|
|
|
bool completed = false;
|
2020-03-07 20:21:02 +01:00
|
|
|
|
if (sweep_mode&(SWEEP_ENABLE|SWEEP_ONCE)) {
|
2020-06-04 19:26:06 +02:00
|
|
|
|
completed = sweep(true, get_sweep_mode());
|
2020-03-07 20:21:02 +01:00
|
|
|
|
sweep_mode&=~SWEEP_ONCE;
|
2020-02-27 18:53:45 +01:00
|
|
|
|
} else {
|
|
|
|
|
|
__WFI();
|
|
|
|
|
|
}
|
2020-03-12 17:53:58 +01:00
|
|
|
|
// Run Shell command in sweep thread
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if (shell_function) {
|
|
|
|
|
|
shell_function(shell_nargs - 1, &shell_args[1]);
|
2020-03-12 17:53:58 +01:00
|
|
|
|
shell_function = 0;
|
2020-03-15 12:14:52 +01:00
|
|
|
|
osalThreadSleepMilliseconds(10);
|
|
|
|
|
|
continue;
|
2020-03-12 17:53:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
// Process UI inputs
|
2020-02-27 18:53:45 +01:00
|
|
|
|
ui_process();
|
2020-04-29 13:07:07 +02:00
|
|
|
|
// Process collected data, calculate trace coordinates and plot only if scan completed
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if (sweep_mode & SWEEP_ENABLE && completed) {
|
2020-04-29 13:07:07 +02:00
|
|
|
|
if (electrical_delay != 0) apply_edelay();
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if ((domain_mode & DOMAIN_MODE) == DOMAIN_TIME) transform_domain();
|
2020-04-29 13:07:07 +02:00
|
|
|
|
|
2020-03-12 17:53:58 +01:00
|
|
|
|
// Prepare draw graphics, cache all lines, mark screen cells for redraw
|
|
|
|
|
|
plot_into_index(measured);
|
2020-03-21 00:03:09 +01:00
|
|
|
|
redraw_request |= REDRAW_CELLS | REDRAW_BATTERY;
|
2020-03-12 17:53:58 +01:00
|
|
|
|
|
|
|
|
|
|
if (uistat.marker_tracking) {
|
|
|
|
|
|
int i = marker_search();
|
|
|
|
|
|
if (i != -1 && active_marker != -1) {
|
|
|
|
|
|
markers[active_marker].index = i;
|
|
|
|
|
|
redraw_request |= REDRAW_MARKER;
|
2019-09-24 19:40:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2016-09-05 00:27:44 +02:00
|
|
|
|
}
|
2020-02-27 18:53:45 +01:00
|
|
|
|
// plot trace and other indications as raster
|
2020-03-21 00:03:09 +01:00
|
|
|
|
draw_all(completed); // flush markmap only if scan completed to prevent
|
|
|
|
|
|
// remaining traces
|
2020-02-27 18:53:45 +01:00
|
|
|
|
}
|
2016-09-05 00:27:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-03-07 15:19:43 +01:00
|
|
|
|
static inline void
|
|
|
|
|
|
pause_sweep(void)
|
|
|
|
|
|
{
|
2020-03-21 00:03:09 +01:00
|
|
|
|
sweep_mode &= ~SWEEP_ENABLE;
|
2020-03-07 15:19:43 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
|
|
resume_sweep(void)
|
|
|
|
|
|
{
|
2020-03-21 00:03:09 +01:00
|
|
|
|
sweep_mode |= SWEEP_ENABLE;
|
2020-03-07 15:19:43 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
toggle_sweep(void)
|
|
|
|
|
|
{
|
2020-03-21 00:03:09 +01:00
|
|
|
|
sweep_mode ^= SWEEP_ENABLE;
|
2020-03-07 15:19:43 +01:00
|
|
|
|
}
|
2016-09-28 02:35:20 +02:00
|
|
|
|
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
static float
|
2020-03-21 00:03:09 +01:00
|
|
|
|
bessel0(float x)
|
|
|
|
|
|
{
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
const float eps = 0.0001;
|
2019-09-11 15:35:44 +02:00
|
|
|
|
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
float ret = 0;
|
|
|
|
|
|
float term = 1;
|
|
|
|
|
|
float m = 0;
|
2019-09-11 15:35:44 +02:00
|
|
|
|
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
while (term > eps * ret) {
|
|
|
|
|
|
ret += term;
|
|
|
|
|
|
++m;
|
|
|
|
|
|
term *= (x*x) / (4*m*m);
|
|
|
|
|
|
}
|
|
|
|
|
|
return ret;
|
2019-09-11 15:35:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
static float
|
2020-03-21 00:03:09 +01:00
|
|
|
|
kaiser_window(float k, float n, float beta)
|
|
|
|
|
|
{
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
if (beta == 0.0) return 1.0;
|
|
|
|
|
|
float r = (2 * k) / (n - 1) - 1;
|
|
|
|
|
|
return bessel0(beta * sqrt(1 - r * r)) / bessel0(beta);
|
2019-09-11 15:35:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
static void
|
2019-09-10 15:39:20 +02:00
|
|
|
|
transform_domain(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
// use spi_buffer as temporary buffer
|
|
|
|
|
|
// and calculate ifft for time domain
|
|
|
|
|
|
float* tmp = (float*)spi_buffer;
|
2019-09-11 15:35:44 +02:00
|
|
|
|
|
2020-03-31 23:36:43 +02:00
|
|
|
|
uint16_t window_size = POINTS_COUNT, offset = 0;
|
2019-09-21 15:20:08 +02:00
|
|
|
|
uint8_t is_lowpass = FALSE;
|
2019-09-11 16:05:01 +02:00
|
|
|
|
switch (domain_mode & TD_FUNC) {
|
2020-03-21 00:03:09 +01:00
|
|
|
|
case TD_FUNC_BANDPASS:
|
|
|
|
|
|
offset = 0;
|
|
|
|
|
|
window_size = POINTS_COUNT;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case TD_FUNC_LOWPASS_IMPULSE:
|
|
|
|
|
|
case TD_FUNC_LOWPASS_STEP:
|
|
|
|
|
|
is_lowpass = TRUE;
|
|
|
|
|
|
offset = POINTS_COUNT;
|
|
|
|
|
|
window_size = POINTS_COUNT * 2;
|
|
|
|
|
|
break;
|
2019-09-11 15:35:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float beta = 0.0;
|
2019-09-11 16:05:01 +02:00
|
|
|
|
switch (domain_mode & TD_WINDOW) {
|
2020-03-21 00:03:09 +01:00
|
|
|
|
case TD_WINDOW_MINIMUM:
|
|
|
|
|
|
beta = 0.0; // this is rectangular
|
|
|
|
|
|
break;
|
|
|
|
|
|
case TD_WINDOW_NORMAL:
|
|
|
|
|
|
beta = 6.0;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case TD_WINDOW_MAXIMUM:
|
|
|
|
|
|
beta = 13;
|
|
|
|
|
|
break;
|
2019-09-11 15:35:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-29 13:07:07 +02:00
|
|
|
|
uint16_t ch_mask = get_sweep_mode();
|
|
|
|
|
|
for (int ch = 0; ch < 2; ch++,ch_mask>>=1) {
|
|
|
|
|
|
if ((ch_mask&1)==0) continue;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
memcpy(tmp, measured[ch], sizeof(measured[0]));
|
|
|
|
|
|
for (int i = 0; i < POINTS_COUNT; i++) {
|
|
|
|
|
|
float w = kaiser_window(i + offset, window_size, beta);
|
|
|
|
|
|
tmp[i * 2 + 0] *= w;
|
|
|
|
|
|
tmp[i * 2 + 1] *= w;
|
|
|
|
|
|
}
|
|
|
|
|
|
for (int i = POINTS_COUNT; i < FFT_SIZE; i++) {
|
|
|
|
|
|
tmp[i * 2 + 0] = 0.0;
|
|
|
|
|
|
tmp[i * 2 + 1] = 0.0;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (is_lowpass) {
|
|
|
|
|
|
for (int i = 1; i < POINTS_COUNT; i++) {
|
|
|
|
|
|
tmp[(FFT_SIZE - i) * 2 + 0] = tmp[i * 2 + 0];
|
|
|
|
|
|
tmp[(FFT_SIZE - i) * 2 + 1] = -tmp[i * 2 + 1];
|
2019-09-21 15:20:08 +02:00
|
|
|
|
}
|
2020-03-21 00:03:09 +01:00
|
|
|
|
}
|
2019-09-21 15:20:08 +02:00
|
|
|
|
|
2020-03-21 00:03:09 +01:00
|
|
|
|
fft256_inverse((float(*)[2])tmp);
|
|
|
|
|
|
memcpy(measured[ch], tmp, sizeof(measured[0]));
|
|
|
|
|
|
for (int i = 0; i < POINTS_COUNT; i++) {
|
|
|
|
|
|
measured[ch][i][0] /= (float)FFT_SIZE;
|
|
|
|
|
|
if (is_lowpass) {
|
|
|
|
|
|
measured[ch][i][1] = 0.0;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
measured[ch][i][1] /= (float)FFT_SIZE;
|
2019-09-10 15:39:20 +02:00
|
|
|
|
}
|
2020-03-21 00:03:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
if ((domain_mode & TD_FUNC) == TD_FUNC_LOWPASS_STEP) {
|
|
|
|
|
|
for (int i = 1; i < POINTS_COUNT; i++) {
|
|
|
|
|
|
measured[ch][i][0] += measured[ch][i - 1][0];
|
2019-09-10 15:39:20 +02:00
|
|
|
|
}
|
2020-03-21 00:03:09 +01:00
|
|
|
|
}
|
2019-09-10 15:39:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
// Shell commands output
|
2020-03-21 00:03:09 +01:00
|
|
|
|
static int shell_printf(const char *fmt, ...)
|
|
|
|
|
|
{
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
va_list ap;
|
|
|
|
|
|
int formatted_bytes;
|
|
|
|
|
|
va_start(ap, fmt);
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
formatted_bytes = chvprintf(shell_stream, fmt, ap);
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
va_end(ap);
|
|
|
|
|
|
return formatted_bytes;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_pause)
|
2016-09-28 02:35:20 +02:00
|
|
|
|
{
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
|
|
|
|
|
pause_sweep();
|
2016-09-28 02:35:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_resume)
|
2016-09-28 02:35:20 +02:00
|
|
|
|
{
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
2019-09-28 03:01:19 +02:00
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
// restore frequencies array and cal
|
|
|
|
|
|
update_frequencies();
|
|
|
|
|
|
if (cal_auto_interpolate && (cal_status & CALSTAT_APPLY))
|
|
|
|
|
|
cal_interpolate(lastsaveid);
|
2019-09-28 03:01:19 +02:00
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
resume_sweep();
|
2016-09-28 02:35:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_reset)
|
2016-09-05 00:27:44 +02:00
|
|
|
|
{
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
2016-09-05 00:27:44 +02:00
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
if (argc == 1) {
|
|
|
|
|
|
if (strcmp(argv[0], "dfu") == 0) {
|
|
|
|
|
|
shell_printf("Performing reset to DFU mode\r\n");
|
|
|
|
|
|
enter_dfu();
|
|
|
|
|
|
return;
|
2019-09-06 13:46:39 +02:00
|
|
|
|
}
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
}
|
|
|
|
|
|
shell_printf("Performing reset\r\n");
|
2019-09-06 13:46:39 +02:00
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
rccEnableWWDG(FALSE);
|
|
|
|
|
|
WWDG->CFR = 0x60;
|
|
|
|
|
|
WWDG->CR = 0xff;
|
2016-09-05 00:27:44 +02:00
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
/* wait forever */
|
|
|
|
|
|
while (1)
|
|
|
|
|
|
;
|
2016-09-05 00:27:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-06-04 19:26:06 +02:00
|
|
|
|
static const uint8_t gain_table[][2] = {
|
2020-04-29 13:30:22 +02:00
|
|
|
|
{ 0, 0 }, // 1st: 0 ~ 300MHz
|
2020-04-30 13:01:04 +02:00
|
|
|
|
{ 50, 50 }, // 2nd: 300 ~ 900MHz
|
2020-04-29 13:30:22 +02:00
|
|
|
|
{ 75, 75 }, // 3th: 900 ~ 1500MHz
|
2020-06-20 11:07:38 +02:00
|
|
|
|
{ 85, 85 }, // 4th: 1500 ~ 2100MHz
|
|
|
|
|
|
{ 95, 95 }, // 5th: 2100 ~ 2700MHz
|
2019-10-05 12:08:20 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
2020-04-29 13:30:22 +02:00
|
|
|
|
#define DELAY_GAIN_CHANGE 4
|
2019-09-07 06:13:25 +02:00
|
|
|
|
|
2019-10-05 12:08:20 +02:00
|
|
|
|
static int
|
2020-03-07 12:54:51 +01:00
|
|
|
|
adjust_gain(uint32_t newfreq)
|
2019-10-05 12:08:20 +02:00
|
|
|
|
{
|
2020-04-29 13:30:22 +02:00
|
|
|
|
int new_order = si5351_get_harmonic_lvl(newfreq);
|
|
|
|
|
|
int old_order = si5351_get_harmonic_lvl(si5351_get_frequency());
|
2019-10-05 12:08:20 +02:00
|
|
|
|
if (new_order != old_order) {
|
2020-04-29 13:30:22 +02:00
|
|
|
|
tlv320aic3204_set_gain(gain_table[new_order][0], gain_table[new_order][1]);
|
2020-03-07 12:54:51 +01:00
|
|
|
|
return DELAY_GAIN_CHANGE;
|
2019-10-05 12:08:20 +02:00
|
|
|
|
}
|
2020-03-07 12:54:51 +01:00
|
|
|
|
return 0;
|
2019-10-05 12:08:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-10-06 00:56:25 +02:00
|
|
|
|
int set_frequency(uint32_t freq)
|
2016-09-05 00:27:44 +02:00
|
|
|
|
{
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
int delay = adjust_gain(freq);
|
2020-04-29 13:30:22 +02:00
|
|
|
|
uint8_t ds = drive_strength;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
delay += si5351_set_frequency(freq, ds);
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
return delay;
|
2016-09-05 00:27:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-11 09:54:05 +01:00
|
|
|
|
// Use macro, std isdigit more big
|
|
|
|
|
|
#define _isdigit(c) (c >= '0' && c <= '9')
|
|
|
|
|
|
// Rewrite universal standart str to value functions to more compact
|
|
|
|
|
|
//
|
|
|
|
|
|
// Convert string to int32
|
2020-03-21 00:03:09 +01:00
|
|
|
|
static int32_t my_atoi(const char *p)
|
|
|
|
|
|
{
|
2020-02-11 09:54:05 +01:00
|
|
|
|
int32_t value = 0;
|
|
|
|
|
|
uint32_t c;
|
|
|
|
|
|
bool neg = false;
|
|
|
|
|
|
|
|
|
|
|
|
if (*p == '-') {neg = true; p++;}
|
|
|
|
|
|
if (*p == '+') p++;
|
|
|
|
|
|
while ((c = *p++ - '0') < 10)
|
|
|
|
|
|
value = value * 10 + c;
|
|
|
|
|
|
return neg ? -value : value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Convert string to uint32
|
2020-03-12 17:53:58 +01:00
|
|
|
|
// 0x - for hex radix
|
|
|
|
|
|
// 0o - for oct radix
|
|
|
|
|
|
// 0b - for bin radix
|
|
|
|
|
|
// default dec radix
|
2020-04-29 13:07:07 +02:00
|
|
|
|
static uint32_t my_atoui(const char *p)
|
2020-03-21 00:03:09 +01:00
|
|
|
|
{
|
2020-03-12 17:53:58 +01:00
|
|
|
|
uint32_t value = 0, radix = 10, c;
|
2020-02-11 09:54:05 +01:00
|
|
|
|
if (*p == '+') p++;
|
2020-03-12 17:53:58 +01:00
|
|
|
|
if (*p == '0') {
|
|
|
|
|
|
switch (p[1]) {
|
|
|
|
|
|
case 'x': radix = 16; break;
|
|
|
|
|
|
case 'o': radix = 8; break;
|
|
|
|
|
|
case 'b': radix = 2; break;
|
|
|
|
|
|
default: goto calculate;
|
|
|
|
|
|
}
|
|
|
|
|
|
p+=2;
|
|
|
|
|
|
}
|
|
|
|
|
|
calculate:
|
|
|
|
|
|
while (1) {
|
|
|
|
|
|
c = *p++ - '0';
|
|
|
|
|
|
// c = to_upper(*p) - 'A' + 10
|
|
|
|
|
|
if (c >= 'A' - '0') c = (c&(~0x20)) - ('A' - '0') + 10;
|
|
|
|
|
|
if (c >= radix) return value;
|
|
|
|
|
|
value = value * radix + c;
|
|
|
|
|
|
}
|
2020-02-11 09:54:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
double
|
|
|
|
|
|
my_atof(const char *p)
|
|
|
|
|
|
{
|
|
|
|
|
|
int neg = FALSE;
|
|
|
|
|
|
if (*p == '-')
|
|
|
|
|
|
neg = TRUE;
|
|
|
|
|
|
if (*p == '-' || *p == '+')
|
|
|
|
|
|
p++;
|
|
|
|
|
|
double x = my_atoi(p);
|
|
|
|
|
|
while (_isdigit((int)*p))
|
|
|
|
|
|
p++;
|
|
|
|
|
|
if (*p == '.') {
|
|
|
|
|
|
double d = 1.0f;
|
|
|
|
|
|
p++;
|
|
|
|
|
|
while (_isdigit((int)*p)) {
|
|
|
|
|
|
d /= 10;
|
|
|
|
|
|
x += d * (*p - '0');
|
|
|
|
|
|
p++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (*p == 'e' || *p == 'E') {
|
|
|
|
|
|
p++;
|
|
|
|
|
|
int exp = my_atoi(p);
|
|
|
|
|
|
while (exp > 0) {
|
|
|
|
|
|
x *= 10;
|
|
|
|
|
|
exp--;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (exp < 0) {
|
|
|
|
|
|
x /= 10;
|
|
|
|
|
|
exp++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (neg)
|
|
|
|
|
|
x = -x;
|
|
|
|
|
|
return x;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-23 13:45:37 +01:00
|
|
|
|
//
|
|
|
|
|
|
// Function used for search substring v in list
|
|
|
|
|
|
// Example need search parameter "center" in "start|stop|center|span|cw" getStringIndex return 2
|
|
|
|
|
|
// If not found return -1
|
|
|
|
|
|
// Used for easy parse command arguments
|
2020-03-21 00:03:09 +01:00
|
|
|
|
static int get_str_index(char *v, const char *list)
|
|
|
|
|
|
{
|
2020-02-23 13:45:37 +01:00
|
|
|
|
int i = 0;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
while (1) {
|
2020-02-23 13:45:37 +01:00
|
|
|
|
char *p = v;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
while (1) {
|
|
|
|
|
|
char c = *list;
|
|
|
|
|
|
if (c == '|') c = 0;
|
|
|
|
|
|
if (c == *p++) {
|
2020-02-23 13:45:37 +01:00
|
|
|
|
// Found, return index
|
|
|
|
|
|
if (c == 0) return i;
|
|
|
|
|
|
list++; // Compare next symbol
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
break; // Not equal, break
|
|
|
|
|
|
}
|
|
|
|
|
|
// Set new substring ptr
|
2020-03-21 00:03:09 +01:00
|
|
|
|
while (1) {
|
2020-03-07 18:57:43 +01:00
|
|
|
|
// End of string, not found
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if (*list == 0) return -1;
|
2020-03-07 18:57:43 +01:00
|
|
|
|
if (*list++ == '|') break;
|
2020-02-23 13:45:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
i++;
|
|
|
|
|
|
}
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_offset)
|
2016-09-05 00:27:44 +02:00
|
|
|
|
{
|
2020-03-12 17:53:58 +01:00
|
|
|
|
if (argc != 1) {
|
|
|
|
|
|
shell_printf("usage: offset {frequency offset(Hz)}\r\n");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-03-21 14:15:03 +01:00
|
|
|
|
int32_t offset = my_atoi(argv[0]);
|
2020-04-29 13:30:22 +02:00
|
|
|
|
#ifdef USE_VARIABLE_OFFSET
|
|
|
|
|
|
generate_DSP_Table(offset);
|
|
|
|
|
|
#endif
|
2020-03-21 14:15:03 +01:00
|
|
|
|
si5351_set_frequency_offset(offset);
|
2016-09-05 00:27:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_freq)
|
2016-09-05 00:27:44 +02:00
|
|
|
|
{
|
2020-03-12 17:53:58 +01:00
|
|
|
|
if (argc != 1) {
|
|
|
|
|
|
goto usage;
|
|
|
|
|
|
}
|
|
|
|
|
|
uint32_t freq = my_atoui(argv[0]);
|
2020-02-11 09:54:05 +01:00
|
|
|
|
|
2020-03-12 17:53:58 +01:00
|
|
|
|
pause_sweep();
|
|
|
|
|
|
set_frequency(freq);
|
|
|
|
|
|
return;
|
2020-02-11 09:54:05 +01:00
|
|
|
|
usage:
|
2020-03-12 17:53:58 +01:00
|
|
|
|
shell_printf("usage: freq {frequency(Hz)}\r\n");
|
2016-09-05 00:27:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_power)
|
2016-09-10 11:24:44 +02:00
|
|
|
|
{
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
if (argc != 1) {
|
2020-04-29 13:30:22 +02:00
|
|
|
|
shell_printf("usage: power {0-3}\r\n");
|
2020-03-12 17:53:58 +01:00
|
|
|
|
return;
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
}
|
2020-04-29 13:30:22 +02:00
|
|
|
|
drive_strength = my_atoui(argv[0]);
|
2020-03-14 13:18:14 +01:00
|
|
|
|
// set_frequency(frequency);
|
2016-09-10 11:24:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-06-20 11:07:38 +02:00
|
|
|
|
#ifdef __USE_RTC__
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_time)
|
2016-09-05 00:27:44 +02:00
|
|
|
|
{
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
2020-06-20 11:07:38 +02:00
|
|
|
|
uint32_t dt_buf[2];
|
|
|
|
|
|
dt_buf[0] = rtc_get_tr_bcd(); // TR should be read first for sync
|
|
|
|
|
|
dt_buf[1] = rtc_get_dr_bcd(); // DR should be read second
|
|
|
|
|
|
static const uint8_t idx_to_time[] = {6,5,4,2, 1, 0};
|
|
|
|
|
|
static const char time_cmd[] = "y|m|d|h|min|sec";
|
|
|
|
|
|
// 0 1 2 4 5 6
|
|
|
|
|
|
// time[] ={sec, min, hr, 0, day, month, year, 0}
|
|
|
|
|
|
uint8_t *time = (uint8_t*)dt_buf;
|
|
|
|
|
|
|
|
|
|
|
|
if (argc!=2) goto usage;
|
|
|
|
|
|
int idx = get_str_index(argv[0], time_cmd);
|
|
|
|
|
|
uint32_t val = my_atoui(argv[1]);
|
|
|
|
|
|
if (idx < 0 || val > 99)
|
|
|
|
|
|
goto usage;
|
|
|
|
|
|
// Write byte value in struct
|
|
|
|
|
|
time[idx_to_time[idx]] = ((val/10)<<4)|(val%10); // value in bcd format
|
|
|
|
|
|
rtc_set_time(dt_buf[1], dt_buf[0]);
|
|
|
|
|
|
return;
|
|
|
|
|
|
usage:
|
|
|
|
|
|
shell_printf("20%02X/%02X/%02X %02X:%02X:%02X\r\n", time[6], time[5], time[4], time[2], time[1], time[0]);
|
|
|
|
|
|
shell_printf("usage: time [%s] 0-99\r\n", time_cmd);
|
2016-09-05 00:27:44 +02:00
|
|
|
|
}
|
2020-02-28 16:52:25 +01:00
|
|
|
|
#endif
|
2016-09-05 00:27:44 +02:00
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_dac)
|
2016-09-05 00:27:44 +02:00
|
|
|
|
{
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
int value;
|
|
|
|
|
|
if (argc != 1) {
|
|
|
|
|
|
shell_printf("usage: dac {value(0-4095)}\r\n"\
|
|
|
|
|
|
"current value: %d\r\n", config.dac_value);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-03-13 20:42:28 +01:00
|
|
|
|
value = my_atoui(argv[0]);
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
config.dac_value = value;
|
|
|
|
|
|
dacPutChannelX(&DACD2, 0, value);
|
2016-09-05 00:27:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_threshold)
|
2019-10-05 12:56:38 +02:00
|
|
|
|
{
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
uint32_t value;
|
|
|
|
|
|
if (argc != 1) {
|
|
|
|
|
|
shell_printf("usage: threshold {frequency in harmonic mode}\r\n"\
|
|
|
|
|
|
"current: %d\r\n", config.harmonic_freq_threshold);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
value = my_atoui(argv[0]);
|
|
|
|
|
|
config.harmonic_freq_threshold = value;
|
2019-10-05 12:56:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_saveconfig)
|
2017-01-02 14:03:20 +01:00
|
|
|
|
{
|
|
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
|
|
|
|
|
config_save();
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("Config saved.\r\n");
|
2017-01-02 14:03:20 +01:00
|
|
|
|
}
|
2016-09-05 00:27:44 +02:00
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_clearconfig)
|
2017-01-20 00:57:17 +01:00
|
|
|
|
{
|
|
|
|
|
|
if (argc != 1) {
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("usage: clearconfig {protection key}\r\n");
|
2017-01-20 00:57:17 +01:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (strcmp(argv[0], "1234") != 0) {
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("Key unmatched.\r\n");
|
2017-01-20 00:57:17 +01:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
clear_all_config_prop_data();
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("Config and all cal data cleared.\r\n"\
|
|
|
|
|
|
"Do reset manually to take effect. Then do touch cal and save.\r\n");
|
2017-01-20 00:57:17 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-09-05 00:27:44 +02:00
|
|
|
|
static struct {
|
|
|
|
|
|
int16_t rms[2];
|
|
|
|
|
|
int16_t ave[2];
|
|
|
|
|
|
int callback_count;
|
|
|
|
|
|
|
2016-12-11 09:26:33 +01:00
|
|
|
|
#if 0
|
2016-09-05 00:27:44 +02:00
|
|
|
|
int32_t last_counter_value;
|
|
|
|
|
|
int32_t interval_cycles;
|
|
|
|
|
|
int32_t busy_cycles;
|
2016-12-11 09:26:33 +01:00
|
|
|
|
#endif
|
2016-09-05 00:27:44 +02:00
|
|
|
|
} stat;
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_data)
|
2016-10-24 18:16:05 +02:00
|
|
|
|
{
|
|
|
|
|
|
int i;
|
|
|
|
|
|
int sel = 0;
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
float (*array)[2];
|
2016-10-24 18:16:05 +02:00
|
|
|
|
if (argc == 1)
|
2020-02-11 09:54:05 +01:00
|
|
|
|
sel = my_atoi(argv[0]);
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
|
|
|
|
|
|
if (sel == 0 || sel == 1)
|
|
|
|
|
|
array = measured[sel];
|
|
|
|
|
|
else if (sel >= 2 && sel < 7)
|
|
|
|
|
|
array = cal_data[sel-2];
|
|
|
|
|
|
else
|
|
|
|
|
|
goto usage;
|
|
|
|
|
|
for (i = 0; i < sweep_points; i++)
|
|
|
|
|
|
shell_printf("%f %f\r\n", array[i][0], array[i][1]);
|
|
|
|
|
|
return;
|
|
|
|
|
|
usage:
|
|
|
|
|
|
shell_printf("usage: data [array]\r\n");
|
2016-10-24 18:16:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-01-22 05:05:36 +01:00
|
|
|
|
#ifdef ENABLED_DUMP
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_dump)
|
2016-09-05 00:27:44 +02:00
|
|
|
|
{
|
|
|
|
|
|
int i, j;
|
2016-09-18 03:11:18 +02:00
|
|
|
|
int len;
|
|
|
|
|
|
|
|
|
|
|
|
if (argc == 1)
|
2020-02-11 09:54:05 +01:00
|
|
|
|
dump_selection = my_atoi(argv[0]);
|
2016-09-18 03:11:18 +02:00
|
|
|
|
|
2020-06-16 01:22:18 +02:00
|
|
|
|
dsp_start(3);
|
|
|
|
|
|
dsp_wait();
|
2016-11-28 15:44:21 +01:00
|
|
|
|
|
2016-09-18 03:11:18 +02:00
|
|
|
|
len = AUDIO_BUFFER_LEN;
|
2016-09-19 02:31:50 +02:00
|
|
|
|
if (dump_selection == 1 || dump_selection == 2)
|
2016-09-18 03:11:18 +02:00
|
|
|
|
len /= 2;
|
|
|
|
|
|
for (i = 0; i < len; ) {
|
2016-09-05 00:27:44 +02:00
|
|
|
|
for (j = 0; j < 16; j++, i++) {
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("%04x ", 0xffff & (int)dump_buffer[i]);
|
2016-09-05 00:27:44 +02:00
|
|
|
|
}
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("\r\n");
|
2016-09-05 00:27:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-01-22 05:05:36 +01:00
|
|
|
|
#endif
|
2016-09-05 00:27:44 +02:00
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_capture)
|
2019-08-22 19:07:22 +02:00
|
|
|
|
{
|
|
|
|
|
|
// read pixel count at one time (PART*2 bytes required for read buffer)
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
2020-06-04 19:26:06 +02:00
|
|
|
|
int y;
|
2020-03-30 19:01:51 +02:00
|
|
|
|
#if SPI_BUFFER_SIZE < (3*LCD_WIDTH + 1)
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
#error "Low size of spi_buffer for cmd_capture"
|
|
|
|
|
|
#endif
|
|
|
|
|
|
// read 2 row pixel time (read buffer limit by 2/3 + 1 from spi_buffer size)
|
2020-03-30 19:01:51 +02:00
|
|
|
|
for (y = 0; y < LCD_HEIGHT; y += 2) {
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
// use uint16_t spi_buffer[2048] (defined in ili9341) for read buffer
|
2020-03-30 19:01:51 +02:00
|
|
|
|
ili9341_read_memory(0, y, LCD_WIDTH, 2, 2 * LCD_WIDTH, spi_buffer);
|
2020-06-04 19:26:06 +02:00
|
|
|
|
streamWrite(shell_stream, (void*)spi_buffer, 2 * LCD_WIDTH * sizeof(uint16_t));
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
}
|
2019-08-22 19:07:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-01-20 00:57:17 +01:00
|
|
|
|
#if 0
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_gamma)
|
2016-09-19 02:31:50 +02:00
|
|
|
|
{
|
2016-10-04 01:16:01 +02:00
|
|
|
|
float gamma[2];
|
2016-09-19 02:31:50 +02:00
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
2016-10-04 01:16:01 +02:00
|
|
|
|
|
2016-09-28 02:35:20 +02:00
|
|
|
|
pause_sweep();
|
2017-01-16 17:49:22 +01:00
|
|
|
|
chMtxLock(&mutex);
|
2016-11-28 15:44:21 +01:00
|
|
|
|
wait_dsp(4);
|
|
|
|
|
|
calculate_gamma(gamma);
|
2017-01-16 17:49:22 +01:00
|
|
|
|
chMtxUnlock(&mutex);
|
2016-09-19 02:50:03 +02:00
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("%d %d\r\n", gamma[0], gamma[1]);
|
2016-09-19 02:31:50 +02:00
|
|
|
|
}
|
2017-01-20 00:57:17 +01:00
|
|
|
|
#endif
|
2016-09-19 02:31:50 +02:00
|
|
|
|
|
2019-08-12 13:53:33 +02:00
|
|
|
|
static void (*sample_func)(float *gamma) = calculate_gamma;
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_sample)
|
2019-08-12 13:53:33 +02:00
|
|
|
|
{
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if (argc != 1) goto usage;
|
2020-02-23 13:45:37 +01:00
|
|
|
|
// 0 1 2
|
|
|
|
|
|
static const char cmd_sample_list[] = "gamma|ampl|ref";
|
2020-03-21 00:03:09 +01:00
|
|
|
|
switch (get_str_index(argv[0], cmd_sample_list)) {
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
sample_func = calculate_gamma;
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
sample_func = fetch_amplitude;
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
sample_func = fetch_amplitude_ref;
|
|
|
|
|
|
return;
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
2019-08-12 13:53:33 +02:00
|
|
|
|
}
|
2020-02-23 13:45:37 +01:00
|
|
|
|
usage:
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("usage: sample {%s}\r\n", cmd_sample_list);
|
2019-08-12 13:53:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-01-02 11:15:16 +01:00
|
|
|
|
config_t config = {
|
2019-10-05 12:56:38 +02:00
|
|
|
|
.magic = CONFIG_MAGIC,
|
|
|
|
|
|
.dac_value = 1922,
|
2020-01-19 09:16:18 +01:00
|
|
|
|
.grid_color = DEFAULT_GRID_COLOR,
|
|
|
|
|
|
.menu_normal_color = DEFAULT_MENU_COLOR,
|
|
|
|
|
|
.menu_active_color = DEFAULT_MENU_ACTIVE_COLOR,
|
|
|
|
|
|
.trace_color = { DEFAULT_TRACE_1_COLOR, DEFAULT_TRACE_2_COLOR, DEFAULT_TRACE_3_COLOR, DEFAULT_TRACE_4_COLOR },
|
2019-11-17 03:28:50 +01:00
|
|
|
|
// .touch_cal = { 693, 605, 124, 171 }, // 2.4 inch LCD panel
|
2020-07-09 19:42:45 +02:00
|
|
|
|
.touch_cal = { 338, 522, 153, 192 }, // 2.8 inch LCD panel
|
2020-07-17 16:36:14 +02:00
|
|
|
|
// .touch_cal = { 272, 521, 114, 153 }, //4.0" LCD
|
2020-04-29 13:30:22 +02:00
|
|
|
|
.harmonic_freq_threshold = FREQUENCY_THRESHOLD,
|
2020-04-02 15:36:59 +02:00
|
|
|
|
.vbat_offset = 500,
|
|
|
|
|
|
.bandwidth = BANDWIDTH_1000
|
2017-01-02 11:15:16 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
2020-02-28 21:15:38 +01:00
|
|
|
|
properties_t current_props;
|
2017-01-16 16:33:15 +01:00
|
|
|
|
properties_t *active_props = ¤t_props;
|
2016-10-16 13:02:38 +02:00
|
|
|
|
|
2020-02-28 21:15:38 +01:00
|
|
|
|
// NanoVNA Default settings
|
|
|
|
|
|
static const trace_t def_trace[TRACES_MAX] = {//enable, type, channel, reserved, scale, refpos
|
|
|
|
|
|
{ 1, TRC_LOGMAG, 0, 0, 10.0, NGRIDY-1 },
|
|
|
|
|
|
{ 1, TRC_LOGMAG, 1, 0, 10.0, NGRIDY-1 },
|
|
|
|
|
|
{ 1, TRC_SMITH, 0, 0, 1.0, 0 },
|
|
|
|
|
|
{ 1, TRC_PHASE, 1, 0, 90.0, NGRIDY/2 }
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static const marker_t def_markers[MARKERS_MAX] = {
|
2020-04-29 13:30:22 +02:00
|
|
|
|
{ 1, 0, 30, 0 }, { 0, 0, 40, 0 }, { 0, 0, 60, 0 }, { 0, 0, 80, 0 }
|
2020-02-28 21:15:38 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Load propeties default settings
|
2020-03-21 00:03:09 +01:00
|
|
|
|
void load_default_properties(void)
|
|
|
|
|
|
{
|
2020-03-07 18:57:43 +01:00
|
|
|
|
//Magic add on caldata_save
|
|
|
|
|
|
//current_props.magic = CONFIG_MAGIC;
|
2020-02-28 21:15:38 +01:00
|
|
|
|
current_props._frequency0 = 50000; // start = 50kHz
|
|
|
|
|
|
current_props._frequency1 = 900000000; // end = 900MHz
|
2020-04-29 13:32:40 +02:00
|
|
|
|
current_props._sweep_points = POINTS_SET_101; // Set default 101 points
|
2020-02-28 21:15:38 +01:00
|
|
|
|
current_props._cal_status = 0;
|
|
|
|
|
|
//This data not loaded by default
|
|
|
|
|
|
//current_props._cal_data[5][POINTS_COUNT][2];
|
|
|
|
|
|
//=============================================
|
|
|
|
|
|
current_props._electrical_delay = 0.0;
|
|
|
|
|
|
memcpy(current_props._trace, def_trace, sizeof(def_trace));
|
|
|
|
|
|
memcpy(current_props._markers, def_markers, sizeof(def_markers));
|
|
|
|
|
|
current_props._velocity_factor = 0.7;
|
|
|
|
|
|
current_props._active_marker = 0;
|
|
|
|
|
|
current_props._domain_mode = 0;
|
|
|
|
|
|
current_props._marker_smith_format = MS_RLC;
|
2020-05-13 23:53:52 +02:00
|
|
|
|
current_props._freq_mode = FREQ_MODE_START_STOP;
|
|
|
|
|
|
|
2020-03-07 18:57:43 +01:00
|
|
|
|
//Checksum add on caldata_save
|
|
|
|
|
|
//current_props.checksum = 0;
|
2020-02-28 21:15:38 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-29 13:23:59 +02:00
|
|
|
|
int load_properties(uint32_t id){
|
|
|
|
|
|
int r = caldata_recall(id);
|
|
|
|
|
|
update_frequencies();
|
|
|
|
|
|
return r;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-11-04 17:22:48 +01:00
|
|
|
|
void
|
|
|
|
|
|
ensure_edit_config(void)
|
|
|
|
|
|
{
|
2017-01-16 16:33:15 +01:00
|
|
|
|
if (active_props == ¤t_props)
|
2016-11-04 17:22:48 +01:00
|
|
|
|
return;
|
|
|
|
|
|
|
2017-01-16 16:33:15 +01:00
|
|
|
|
//memcpy(¤t_props, active_props, sizeof(config_t));
|
|
|
|
|
|
active_props = ¤t_props;
|
2016-12-12 15:45:49 +01:00
|
|
|
|
// move to uncal state
|
2016-11-19 05:11:49 +01:00
|
|
|
|
cal_status = 0;
|
2016-11-04 17:22:48 +01:00
|
|
|
|
}
|
2016-10-16 13:02:38 +02:00
|
|
|
|
|
2020-03-21 14:15:03 +01:00
|
|
|
|
#ifdef ENABLED_DUMP
|
|
|
|
|
|
int16_t dump_buffer[AUDIO_BUFFER_LEN];
|
|
|
|
|
|
int16_t dump_selection = 0;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLED_DUMP
|
|
|
|
|
|
static void
|
|
|
|
|
|
duplicate_buffer_to_dump(int16_t *p)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (dump_selection == 1)
|
|
|
|
|
|
p = samp_buf;
|
|
|
|
|
|
else if (dump_selection == 2)
|
|
|
|
|
|
p = ref_buf;
|
|
|
|
|
|
memcpy(dump_buffer, p, sizeof dump_buffer);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
// DMA i2s callback function, called on get 'half' and 'full' buffer size data
|
|
|
|
|
|
// need for process data, while DMA fill next buffer
|
|
|
|
|
|
void i2s_end_callback(I2SDriver *i2sp, size_t offset, size_t n)
|
|
|
|
|
|
{
|
|
|
|
|
|
int16_t *p = &rx_buffer[offset];
|
|
|
|
|
|
(void)i2sp;
|
|
|
|
|
|
if (wait_count > 0){
|
2020-04-02 15:36:59 +02:00
|
|
|
|
if (wait_count <= config.bandwidth+1){
|
|
|
|
|
|
if (wait_count == config.bandwidth+1)
|
2020-03-21 14:15:03 +01:00
|
|
|
|
reset_dsp_accumerator();
|
|
|
|
|
|
dsp_process(p, n);
|
|
|
|
|
|
}
|
|
|
|
|
|
#ifdef ENABLED_DUMP
|
|
|
|
|
|
duplicate_buffer_to_dump(p);
|
|
|
|
|
|
#endif
|
|
|
|
|
|
--wait_count;
|
|
|
|
|
|
}
|
|
|
|
|
|
stat.callback_count++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const I2SConfig i2sconfig = {
|
|
|
|
|
|
NULL, // TX Buffer
|
|
|
|
|
|
rx_buffer, // RX Buffer
|
2020-03-21 14:40:49 +01:00
|
|
|
|
AUDIO_BUFFER_LEN * 2, // RX Buffer size
|
2020-03-21 14:15:03 +01:00
|
|
|
|
NULL, // tx callback
|
|
|
|
|
|
i2s_end_callback, // rx callback
|
|
|
|
|
|
0, // i2scfgr
|
|
|
|
|
|
0 // i2spr
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2020-04-02 15:36:59 +02:00
|
|
|
|
#define DSP_START(delay) {wait_count = delay + config.bandwidth;}
|
2020-03-21 14:15:03 +01:00
|
|
|
|
#define DSP_WAIT_READY while (wait_count) {if (operation_requested && break_on_operation) return false; __WFI();}
|
|
|
|
|
|
#define DSP_WAIT while (wait_count) {__WFI();}
|
|
|
|
|
|
#define RESET_SWEEP {p_sweep = 0;}
|
2020-03-05 20:36:44 +01:00
|
|
|
|
#define DELAY_CHANNEL_CHANGE 2
|
2019-09-07 06:13:25 +02:00
|
|
|
|
|
2020-04-29 13:07:07 +02:00
|
|
|
|
#define SWEEP_CH0_MEASURE 1
|
|
|
|
|
|
#define SWEEP_CH1_MEASURE 2
|
|
|
|
|
|
|
|
|
|
|
|
static uint16_t get_sweep_mode(void){
|
|
|
|
|
|
uint16_t sweep_mode = 0;
|
|
|
|
|
|
int t;
|
|
|
|
|
|
for (t = 0; t < TRACES_MAX; t++) {
|
|
|
|
|
|
if (!trace[t].enabled)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
if (trace[t].channel == 0) sweep_mode|=SWEEP_CH0_MEASURE;
|
|
|
|
|
|
if (trace[t].channel == 1) sweep_mode|=SWEEP_CH1_MEASURE;
|
|
|
|
|
|
}
|
|
|
|
|
|
return sweep_mode;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-01-16 16:13:42 +01:00
|
|
|
|
// main loop for measurement
|
2020-06-04 19:26:06 +02:00
|
|
|
|
bool sweep(bool break_on_operation, uint16_t sweep_mode)
|
2016-09-28 01:47:46 +02:00
|
|
|
|
{
|
2020-03-30 19:01:51 +02:00
|
|
|
|
int delay;
|
2020-03-21 14:15:03 +01:00
|
|
|
|
if (p_sweep>=sweep_points || break_on_operation == false) RESET_SWEEP;
|
2020-06-04 19:26:06 +02:00
|
|
|
|
if (break_on_operation && sweep_mode == 0)
|
2020-04-29 13:07:07 +02:00
|
|
|
|
return false;
|
2020-03-21 19:58:51 +01:00
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
// blink LED while scanning
|
|
|
|
|
|
palClearPad(GPIOC, GPIOC_LED);
|
2020-04-29 13:07:07 +02:00
|
|
|
|
// Power stabilization after LED off, before measure
|
|
|
|
|
|
int st_delay = 3;
|
2020-03-21 14:15:03 +01:00
|
|
|
|
for (; p_sweep < sweep_points; p_sweep++) { // 5300
|
|
|
|
|
|
if (frequencies[p_sweep] == 0) break;
|
2020-03-30 19:01:51 +02:00
|
|
|
|
delay = set_frequency(frequencies[p_sweep]);
|
2020-04-29 13:07:07 +02:00
|
|
|
|
if (sweep_mode & SWEEP_CH0_MEASURE){
|
|
|
|
|
|
tlv320aic3204_select(0); // CH0:REFLECTION, reset and begin measure
|
|
|
|
|
|
DSP_START(delay+st_delay);
|
|
|
|
|
|
delay = DELAY_CHANNEL_CHANGE;
|
|
|
|
|
|
//================================================
|
|
|
|
|
|
// Place some code thats need execute while delay
|
|
|
|
|
|
//================================================
|
|
|
|
|
|
DSP_WAIT_READY;
|
|
|
|
|
|
(*sample_func)(measured[0][p_sweep]); // calculate reflection coefficient
|
|
|
|
|
|
if (cal_status & CALSTAT_APPLY)
|
|
|
|
|
|
apply_CH0_error_term_at(p_sweep);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (sweep_mode & SWEEP_CH1_MEASURE){
|
|
|
|
|
|
tlv320aic3204_select(1); // CH1:TRANSMISSION, reset and begin measure
|
2020-06-04 19:26:06 +02:00
|
|
|
|
DSP_START(delay+st_delay);
|
2020-04-29 13:07:07 +02:00
|
|
|
|
//================================================
|
|
|
|
|
|
// Place some code thats need execute while delay
|
|
|
|
|
|
//================================================
|
|
|
|
|
|
DSP_WAIT_READY;
|
|
|
|
|
|
(*sample_func)(measured[1][p_sweep]); // calculate transmission coefficient
|
|
|
|
|
|
if (cal_status & CALSTAT_APPLY)
|
|
|
|
|
|
apply_CH1_error_term_at(p_sweep);
|
|
|
|
|
|
}
|
2020-03-30 19:01:51 +02:00
|
|
|
|
st_delay = 0;
|
2020-03-21 14:15:03 +01:00
|
|
|
|
// Display SPI made noise on measurement (can see in CW mode)
|
|
|
|
|
|
// ili9341_fill(OFFSETX+CELLOFFSETX, OFFSETY, (p_sweep * WIDTH)/(sweep_points-1), 1, RGB565(0,0,255));
|
2016-09-28 01:47:46 +02:00
|
|
|
|
}
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
// blink LED while scanning
|
|
|
|
|
|
palSetPad(GPIOC, GPIOC_LED);
|
2019-09-24 19:40:00 +02:00
|
|
|
|
return true;
|
2016-09-28 01:47:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-04 07:43:32 +02:00
|
|
|
|
uint32_t get_bandwidth_frequency(void){
|
|
|
|
|
|
return (AUDIO_ADC_FREQ/AUDIO_SAMPLES_COUNT)/(config.bandwidth+1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-03-21 16:25:36 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_bandwidth)
|
|
|
|
|
|
{
|
2020-03-21 19:58:51 +01:00
|
|
|
|
if (argc != 1)
|
|
|
|
|
|
goto result;
|
2020-04-29 13:07:07 +02:00
|
|
|
|
config.bandwidth = my_atoui(argv[0])&0xFF;
|
2020-03-21 19:58:51 +01:00
|
|
|
|
result:
|
2020-04-04 07:43:32 +02:00
|
|
|
|
shell_printf("bandwidth %d (%uHz)\r\n", config.bandwidth, get_bandwidth_frequency());
|
2020-03-21 16:25:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-29 13:32:40 +02:00
|
|
|
|
void set_sweep_points(uint16_t points){
|
|
|
|
|
|
if (points == sweep_points || points > POINTS_COUNT)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
sweep_points = points;
|
|
|
|
|
|
update_frequencies();
|
|
|
|
|
|
|
|
|
|
|
|
if (cal_auto_interpolate && (cal_status & CALSTAT_APPLY))
|
|
|
|
|
|
cal_interpolate(lastsaveid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_scan)
|
2019-09-24 19:43:02 +02:00
|
|
|
|
{
|
2020-02-11 09:54:05 +01:00
|
|
|
|
uint32_t start, stop;
|
2020-04-04 07:43:32 +02:00
|
|
|
|
uint16_t points = sweep_points;
|
2020-03-14 14:05:26 +01:00
|
|
|
|
int i;
|
|
|
|
|
|
if (argc < 2 || argc > 4) {
|
|
|
|
|
|
shell_printf("usage: scan {start(Hz)} {stop(Hz)} [points] [outmask]\r\n");
|
2019-09-24 19:43:02 +02:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-11 09:54:05 +01:00
|
|
|
|
start = my_atoui(argv[0]);
|
|
|
|
|
|
stop = my_atoui(argv[1]);
|
2019-09-24 19:43:02 +02:00
|
|
|
|
if (start == 0 || stop == 0 || start > stop) {
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("frequency range is invalid\r\n");
|
2019-09-24 19:43:02 +02:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-03-14 14:48:36 +01:00
|
|
|
|
if (argc >= 3) {
|
2020-04-04 07:43:32 +02:00
|
|
|
|
points = my_atoui(argv[2]);
|
|
|
|
|
|
if (points == 0 || points > POINTS_COUNT) {
|
2020-03-14 14:48:36 +01:00
|
|
|
|
shell_printf("sweep points exceeds range "define_to_STR(POINTS_COUNT)"\r\n");
|
2019-09-24 19:43:02 +02:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-04-29 13:32:40 +02:00
|
|
|
|
sweep_points = points;
|
2019-09-24 19:43:02 +02:00
|
|
|
|
}
|
2020-06-04 19:26:06 +02:00
|
|
|
|
uint16_t mask = 0;
|
|
|
|
|
|
uint16_t sweep_mode = SWEEP_CH0_MEASURE|SWEEP_CH1_MEASURE;
|
|
|
|
|
|
if (argc == 4) {
|
|
|
|
|
|
mask = my_atoui(argv[3]);
|
|
|
|
|
|
sweep_mode = (mask>>1)&3;
|
|
|
|
|
|
}
|
2019-09-24 19:43:02 +02:00
|
|
|
|
set_frequencies(start, stop, points);
|
2019-09-28 03:01:19 +02:00
|
|
|
|
if (cal_auto_interpolate && (cal_status & CALSTAT_APPLY))
|
|
|
|
|
|
cal_interpolate(lastsaveid);
|
2020-03-12 17:53:58 +01:00
|
|
|
|
pause_sweep();
|
2020-06-04 19:26:06 +02:00
|
|
|
|
sweep(false, sweep_mode);
|
2020-03-14 14:05:26 +01:00
|
|
|
|
// Output data after if set (faster data recive)
|
2020-06-04 19:26:06 +02:00
|
|
|
|
if (mask) {
|
|
|
|
|
|
for (i = 0; i < points; i++) {
|
|
|
|
|
|
if (mask & 1) shell_printf("%u ", frequencies[i]);
|
|
|
|
|
|
if (mask & 2) shell_printf("%f %f ", measured[0][i][0], measured[0][i][1]);
|
|
|
|
|
|
if (mask & 4) shell_printf("%f %f ", measured[1][i][0], measured[1][i][1]);
|
|
|
|
|
|
shell_printf("\r\n");
|
2020-03-14 14:05:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-09-24 19:43:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-09-17 13:19:12 +02:00
|
|
|
|
static void
|
|
|
|
|
|
update_marker_index(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
int m;
|
|
|
|
|
|
int i;
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
for (m = 0; m < MARKERS_MAX; m++) {
|
2017-09-17 13:19:12 +02:00
|
|
|
|
if (!markers[m].enabled)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
uint32_t f = markers[m].frequency;
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
uint32_t fstart = get_sweep_frequency(ST_START);
|
|
|
|
|
|
uint32_t fstop = get_sweep_frequency(ST_STOP);
|
|
|
|
|
|
if (f < fstart) {
|
2017-09-17 13:19:12 +02:00
|
|
|
|
markers[m].index = 0;
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
markers[m].frequency = fstart;
|
|
|
|
|
|
} else if (f >= fstop) {
|
2017-09-17 13:19:12 +02:00
|
|
|
|
markers[m].index = sweep_points-1;
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
markers[m].frequency = fstop;
|
2017-09-17 13:19:12 +02:00
|
|
|
|
} else {
|
|
|
|
|
|
for (i = 0; i < sweep_points-1; i++) {
|
|
|
|
|
|
if (frequencies[i] <= f && f < frequencies[i+1]) {
|
2020-03-21 00:03:09 +01:00
|
|
|
|
markers[m].index = f < (frequencies[i] / 2 + frequencies[i + 1] / 2) ? i : i + 1;
|
2017-09-17 13:19:12 +02:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2020-04-04 07:43:32 +02:00
|
|
|
|
}
|
2017-09-17 13:19:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-03-14 13:18:14 +01:00
|
|
|
|
static void
|
2020-02-11 09:54:05 +01:00
|
|
|
|
set_frequencies(uint32_t start, uint32_t stop, uint16_t points)
|
|
|
|
|
|
{
|
|
|
|
|
|
uint32_t i;
|
|
|
|
|
|
uint32_t step = (points - 1);
|
|
|
|
|
|
uint32_t span = stop - start;
|
|
|
|
|
|
uint32_t delta = span / step;
|
|
|
|
|
|
uint32_t error = span % step;
|
|
|
|
|
|
uint32_t f = start, df = step>>1;
|
|
|
|
|
|
for (i = 0; i <= step; i++, f+=delta) {
|
|
|
|
|
|
frequencies[i] = f;
|
|
|
|
|
|
df+=error;
|
|
|
|
|
|
if (df >=step) {
|
|
|
|
|
|
f++;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
df -= step;
|
2020-02-11 09:54:05 +01:00
|
|
|
|
}
|
2019-09-29 04:19:20 +02:00
|
|
|
|
}
|
2019-09-28 14:49:59 +02:00
|
|
|
|
// disable at out of sweep range
|
2020-03-14 19:23:02 +01:00
|
|
|
|
for (; i < POINTS_COUNT; i++)
|
2019-09-24 19:40:00 +02:00
|
|
|
|
frequencies[i] = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-03-14 13:18:14 +01:00
|
|
|
|
static void
|
2019-09-24 19:40:00 +02:00
|
|
|
|
update_frequencies(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
uint32_t start, stop;
|
2020-03-09 16:24:31 +01:00
|
|
|
|
start = get_sweep_frequency(ST_START);
|
|
|
|
|
|
stop = get_sweep_frequency(ST_STOP);
|
2016-12-11 13:51:54 +01:00
|
|
|
|
|
2019-09-24 19:40:00 +02:00
|
|
|
|
set_frequencies(start, stop, sweep_points);
|
2020-03-21 00:03:09 +01:00
|
|
|
|
// operation_requested|= OP_FREQCHANGE;
|
|
|
|
|
|
|
2017-09-17 13:19:12 +02:00
|
|
|
|
update_marker_index();
|
2020-03-21 00:03:09 +01:00
|
|
|
|
|
2016-12-04 08:19:31 +01:00
|
|
|
|
// set grid layout
|
2016-12-12 15:45:49 +01:00
|
|
|
|
update_grid();
|
2020-03-21 14:15:03 +01:00
|
|
|
|
RESET_SWEEP;
|
2016-12-04 08:19:31 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2020-01-18 04:07:21 +01:00
|
|
|
|
set_sweep_frequency(int type, uint32_t freq)
|
2016-12-04 08:19:31 +01:00
|
|
|
|
{
|
2019-09-28 09:07:39 +02:00
|
|
|
|
int cal_applied = cal_status & CALSTAT_APPLY;
|
2020-02-11 09:54:05 +01:00
|
|
|
|
|
|
|
|
|
|
// Check frequency for out of bounds (minimum SPAN can be any value)
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if (type != ST_SPAN && freq < START_MIN)
|
2020-02-11 09:54:05 +01:00
|
|
|
|
freq = START_MIN;
|
|
|
|
|
|
if (freq > STOP_MAX)
|
|
|
|
|
|
freq = STOP_MAX;
|
|
|
|
|
|
|
2020-03-09 16:24:31 +01:00
|
|
|
|
ensure_edit_config();
|
2016-12-04 08:19:31 +01:00
|
|
|
|
switch (type) {
|
2020-03-21 00:03:09 +01:00
|
|
|
|
case ST_START:
|
2020-05-13 23:53:52 +02:00
|
|
|
|
freq_mode &= ~FREQ_MODE_CENTER_SPAN;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if (frequency0 != freq) {
|
2017-02-01 21:49:49 +01:00
|
|
|
|
frequency0 = freq;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
// if start > stop then make start = stop
|
|
|
|
|
|
if (frequency1 < freq) frequency1 = freq;
|
2016-12-12 13:03:43 +01:00
|
|
|
|
}
|
2020-03-21 00:03:09 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case ST_STOP:
|
2020-05-13 23:53:52 +02:00
|
|
|
|
freq_mode &= ~FREQ_MODE_CENTER_SPAN;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if (frequency1 != freq) {
|
|
|
|
|
|
frequency1 = freq;
|
|
|
|
|
|
// if start > stop then make start = stop
|
|
|
|
|
|
if (frequency0 > freq) frequency0 = freq;
|
2016-12-12 13:03:43 +01:00
|
|
|
|
}
|
2020-03-21 00:03:09 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case ST_CENTER:
|
2020-05-13 23:53:52 +02:00
|
|
|
|
freq_mode |= FREQ_MODE_CENTER_SPAN;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
uint32_t center = frequency0 / 2 + frequency1 / 2;
|
|
|
|
|
|
if (center != freq) {
|
|
|
|
|
|
uint32_t span = frequency1 - frequency0;
|
|
|
|
|
|
if (freq < START_MIN + span / 2) {
|
|
|
|
|
|
span = (freq - START_MIN) * 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (freq > STOP_MAX - span / 2) {
|
|
|
|
|
|
span = (STOP_MAX - freq) * 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
frequency0 = freq - span / 2;
|
|
|
|
|
|
frequency1 = freq + span / 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case ST_SPAN:
|
2020-05-13 23:53:52 +02:00
|
|
|
|
freq_mode |= FREQ_MODE_CENTER_SPAN;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if (frequency1 - frequency0 != freq) {
|
|
|
|
|
|
uint32_t center = frequency0 / 2 + frequency1 / 2;
|
|
|
|
|
|
if (center < START_MIN + freq / 2) {
|
|
|
|
|
|
center = START_MIN + freq / 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (center > STOP_MAX - freq / 2) {
|
|
|
|
|
|
center = STOP_MAX - freq / 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
frequency0 = center - freq / 2;
|
|
|
|
|
|
frequency1 = center + freq / 2;
|
2016-12-12 13:03:43 +01:00
|
|
|
|
}
|
2020-03-21 00:03:09 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case ST_CW:
|
2020-05-13 23:53:52 +02:00
|
|
|
|
freq_mode |= FREQ_MODE_CENTER_SPAN;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if (frequency0 != freq || frequency1 != freq) {
|
|
|
|
|
|
frequency0 = freq;
|
|
|
|
|
|
frequency1 = freq;
|
2016-12-12 13:03:43 +01:00
|
|
|
|
}
|
2020-03-21 00:03:09 +01:00
|
|
|
|
break;
|
2016-12-04 08:19:31 +01:00
|
|
|
|
}
|
2020-02-11 09:54:05 +01:00
|
|
|
|
update_frequencies();
|
2019-09-28 09:07:39 +02:00
|
|
|
|
if (cal_auto_interpolate && cal_applied)
|
2019-08-15 21:51:46 +02:00
|
|
|
|
cal_interpolate(lastsaveid);
|
2016-10-04 01:16:01 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-09-30 16:06:21 +02:00
|
|
|
|
uint32_t
|
|
|
|
|
|
get_sweep_frequency(int type)
|
|
|
|
|
|
{
|
2020-03-09 16:24:31 +01:00
|
|
|
|
// Obsolete, ensure correct start/stop, start always must be < stop
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if (frequency0 > frequency1) {
|
|
|
|
|
|
uint32_t t = frequency0;
|
|
|
|
|
|
frequency0 = frequency1;
|
|
|
|
|
|
frequency1 = t;
|
|
|
|
|
|
}
|
2020-03-09 16:24:31 +01:00
|
|
|
|
switch (type) {
|
|
|
|
|
|
case ST_START: return frequency0;
|
|
|
|
|
|
case ST_STOP: return frequency1;
|
2020-01-18 04:07:21 +01:00
|
|
|
|
case ST_CENTER: return frequency0/2 + frequency1/2;
|
2020-03-09 16:24:31 +01:00
|
|
|
|
case ST_SPAN: return frequency1 - frequency0;
|
|
|
|
|
|
case ST_CW: return frequency0;
|
2017-09-30 16:06:21 +02:00
|
|
|
|
}
|
2017-09-30 16:58:31 +02:00
|
|
|
|
return 0;
|
2017-09-30 16:06:21 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_sweep)
|
2016-09-24 11:51:32 +02:00
|
|
|
|
{
|
|
|
|
|
|
if (argc == 0) {
|
2020-04-04 07:43:32 +02:00
|
|
|
|
shell_printf("%u %u %d\r\n", get_sweep_frequency(ST_START), get_sweep_frequency(ST_STOP), sweep_points);
|
2016-09-24 11:51:32 +02:00
|
|
|
|
return;
|
|
|
|
|
|
} else if (argc > 3) {
|
2019-09-28 06:05:27 +02:00
|
|
|
|
goto usage;
|
2016-09-24 11:51:32 +02:00
|
|
|
|
}
|
2020-02-11 09:54:05 +01:00
|
|
|
|
uint32_t value0 = 0;
|
|
|
|
|
|
uint32_t value1 = 0;
|
2020-04-29 13:32:40 +02:00
|
|
|
|
uint32_t value2 = 0;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if (argc >= 1) value0 = my_atoui(argv[0]);
|
|
|
|
|
|
if (argc >= 2) value1 = my_atoui(argv[1]);
|
2020-04-29 13:32:40 +02:00
|
|
|
|
if (argc >= 3) value2 = my_atoui(argv[2]);
|
2020-03-21 00:03:09 +01:00
|
|
|
|
#if MAX_FREQ_TYPE != 5
|
2020-02-23 13:45:37 +01:00
|
|
|
|
#error "Sweep mode possibly changed, check cmd_sweep function"
|
|
|
|
|
|
#endif
|
2020-02-11 09:54:05 +01:00
|
|
|
|
// Parse sweep {start|stop|center|span|cw} {freq(Hz)}
|
2020-02-23 13:45:37 +01:00
|
|
|
|
// get enum ST_START, ST_STOP, ST_CENTER, ST_SPAN, ST_CW
|
|
|
|
|
|
static const char sweep_cmd[] = "start|stop|center|span|cw";
|
2020-02-11 09:54:05 +01:00
|
|
|
|
if (argc == 2 && value0 == 0) {
|
2020-03-21 00:03:09 +01:00
|
|
|
|
int type = get_str_index(argv[0], sweep_cmd);
|
2020-02-23 13:45:37 +01:00
|
|
|
|
if (type == -1)
|
2019-09-28 06:05:27 +02:00
|
|
|
|
goto usage;
|
2020-02-11 09:54:05 +01:00
|
|
|
|
set_sweep_frequency(type, value1);
|
|
|
|
|
|
return;
|
2016-12-11 13:51:54 +01:00
|
|
|
|
}
|
2020-02-11 09:54:05 +01:00
|
|
|
|
// Parse sweep {start(Hz)} [stop(Hz)]
|
|
|
|
|
|
if (value0)
|
|
|
|
|
|
set_sweep_frequency(ST_START, value0);
|
|
|
|
|
|
if (value1)
|
|
|
|
|
|
set_sweep_frequency(ST_STOP, value1);
|
2020-04-29 13:32:40 +02:00
|
|
|
|
if (value2)
|
|
|
|
|
|
set_sweep_points(value2);
|
2019-09-28 06:05:27 +02:00
|
|
|
|
return;
|
|
|
|
|
|
usage:
|
2020-04-29 13:32:40 +02:00
|
|
|
|
shell_printf("usage: sweep {start(Hz)} [stop(Hz)] [points]\r\n"\
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
"\tsweep {%s} {freq(Hz)}\r\n", sweep_cmd);
|
2016-09-24 11:51:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-10-13 20:56:08 +02:00
|
|
|
|
|
2016-10-16 01:11:16 +02:00
|
|
|
|
static void
|
|
|
|
|
|
eterm_set(int term, float re, float im)
|
|
|
|
|
|
{
|
|
|
|
|
|
int i;
|
2017-01-16 16:13:42 +01:00
|
|
|
|
for (i = 0; i < sweep_points; i++) {
|
2016-10-16 01:11:16 +02:00
|
|
|
|
cal_data[term][i][0] = re;
|
|
|
|
|
|
cal_data[term][i][1] = im;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2016-10-13 20:56:08 +02:00
|
|
|
|
|
2016-10-16 01:11:16 +02:00
|
|
|
|
static void
|
|
|
|
|
|
eterm_copy(int dst, int src)
|
|
|
|
|
|
{
|
|
|
|
|
|
memcpy(cal_data[dst], cal_data[src], sizeof cal_data[dst]);
|
|
|
|
|
|
}
|
2016-10-13 20:56:08 +02:00
|
|
|
|
|
2020-02-23 13:45:37 +01:00
|
|
|
|
#if 0
|
2016-11-30 17:08:13 +01:00
|
|
|
|
const struct open_model {
|
2016-10-24 18:16:05 +02:00
|
|
|
|
float c0;
|
|
|
|
|
|
float c1;
|
|
|
|
|
|
float c2;
|
|
|
|
|
|
float c3;
|
|
|
|
|
|
} open_model = { 50, 0, -300, 27 };
|
2020-02-23 13:45:37 +01:00
|
|
|
|
#endif
|
2016-10-24 18:16:05 +02:00
|
|
|
|
|
2017-01-02 09:32:48 +01:00
|
|
|
|
#if 0
|
2016-10-24 18:16:05 +02:00
|
|
|
|
static void
|
|
|
|
|
|
adjust_ed(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
int i;
|
2017-01-16 16:13:42 +01:00
|
|
|
|
for (i = 0; i < sweep_points; i++) {
|
2016-10-24 18:16:05 +02:00
|
|
|
|
// z=1/(jwc*z0) = 1/(2*pi*f*c*z0) Note: normalized with Z0
|
|
|
|
|
|
// s11ao = (z-1)/(z+1) = (1-1/z)/(1+1/z) = (1-jwcz0)/(1+jwcz0)
|
2017-01-02 11:15:16 +01:00
|
|
|
|
// prepare 1/s11ao to avoid dividing complex
|
2016-10-24 18:16:05 +02:00
|
|
|
|
float c = 1000e-15;
|
|
|
|
|
|
float z0 = 50;
|
2020-03-14 13:18:14 +01:00
|
|
|
|
//float z = 2 * VNA_PI * frequencies[i] * c * z0;
|
2016-10-24 18:16:05 +02:00
|
|
|
|
float z = 0.02;
|
|
|
|
|
|
cal_data[ETERM_ED][i][0] += z;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2016-10-16 01:11:16 +02:00
|
|
|
|
static void
|
|
|
|
|
|
eterm_calc_es(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
int i;
|
2017-01-16 16:13:42 +01:00
|
|
|
|
for (i = 0; i < sweep_points; i++) {
|
2016-10-19 00:18:41 +02:00
|
|
|
|
// z=1/(jwc*z0) = 1/(2*pi*f*c*z0) Note: normalized with Z0
|
|
|
|
|
|
// s11ao = (z-1)/(z+1) = (1-1/z)/(1+1/z) = (1-jwcz0)/(1+jwcz0)
|
|
|
|
|
|
// prepare 1/s11ao for effeiciency
|
2016-10-24 18:16:05 +02:00
|
|
|
|
float c = 50e-15;
|
|
|
|
|
|
//float c = 1.707e-12;
|
2016-10-19 00:18:41 +02:00
|
|
|
|
float z0 = 50;
|
2020-03-14 13:18:14 +01:00
|
|
|
|
float z = 2 * VNA_PI * frequencies[i] * c * z0;
|
2016-10-19 00:18:41 +02:00
|
|
|
|
float sq = 1 + z*z;
|
|
|
|
|
|
float s11aor = (1 - z*z) / sq;
|
|
|
|
|
|
float s11aoi = 2*z / sq;
|
|
|
|
|
|
|
2016-10-16 01:11:16 +02:00
|
|
|
|
// S11mo’= S11mo - Ed
|
|
|
|
|
|
// S11ms’= S11ms - Ed
|
|
|
|
|
|
float s11or = cal_data[CAL_OPEN][i][0] - cal_data[ETERM_ED][i][0];
|
|
|
|
|
|
float s11oi = cal_data[CAL_OPEN][i][1] - cal_data[ETERM_ED][i][1];
|
|
|
|
|
|
float s11sr = cal_data[CAL_SHORT][i][0] - cal_data[ETERM_ED][i][0];
|
|
|
|
|
|
float s11si = cal_data[CAL_SHORT][i][1] - cal_data[ETERM_ED][i][1];
|
2016-10-19 00:18:41 +02:00
|
|
|
|
// Es = (S11mo'/s11ao + S11ms’)/(S11mo' - S11ms’)
|
|
|
|
|
|
float numr = s11sr + s11or * s11aor - s11oi * s11aoi;
|
|
|
|
|
|
float numi = s11si + s11oi * s11aor + s11or * s11aoi;
|
2016-10-16 01:11:16 +02:00
|
|
|
|
float denomr = s11or - s11sr;
|
|
|
|
|
|
float denomi = s11oi - s11si;
|
2016-10-19 00:18:41 +02:00
|
|
|
|
sq = denomr*denomr+denomi*denomi;
|
2016-10-16 01:11:16 +02:00
|
|
|
|
cal_data[ETERM_ES][i][0] = (numr*denomr + numi*denomi)/sq;
|
|
|
|
|
|
cal_data[ETERM_ES][i][1] = (numi*denomr - numr*denomi)/sq;
|
|
|
|
|
|
}
|
2016-10-19 00:18:41 +02:00
|
|
|
|
cal_status &= ~CALSTAT_OPEN;
|
2016-10-16 01:11:16 +02:00
|
|
|
|
cal_status |= CALSTAT_ES;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
|
eterm_calc_er(int sign)
|
|
|
|
|
|
{
|
|
|
|
|
|
int i;
|
2017-01-16 16:13:42 +01:00
|
|
|
|
for (i = 0; i < sweep_points; i++) {
|
2016-10-24 18:16:05 +02:00
|
|
|
|
// Er = sign*(1-sign*Es)S11ms'
|
|
|
|
|
|
float s11sr = cal_data[CAL_SHORT][i][0] - cal_data[ETERM_ED][i][0];
|
|
|
|
|
|
float s11si = cal_data[CAL_SHORT][i][1] - cal_data[ETERM_ED][i][1];
|
2016-10-19 00:18:41 +02:00
|
|
|
|
float esr = cal_data[ETERM_ES][i][0];
|
|
|
|
|
|
float esi = cal_data[ETERM_ES][i][1];
|
|
|
|
|
|
if (sign > 0) {
|
|
|
|
|
|
esr = -esr;
|
|
|
|
|
|
esi = -esi;
|
|
|
|
|
|
}
|
|
|
|
|
|
esr = 1 + esr;
|
2016-10-24 18:16:05 +02:00
|
|
|
|
float err = esr * s11sr - esi * s11si;
|
|
|
|
|
|
float eri = esr * s11si + esi * s11sr;
|
2016-10-16 01:11:16 +02:00
|
|
|
|
if (sign < 0) {
|
|
|
|
|
|
err = -err;
|
|
|
|
|
|
eri = -eri;
|
|
|
|
|
|
}
|
|
|
|
|
|
cal_data[ETERM_ER][i][0] = err;
|
|
|
|
|
|
cal_data[ETERM_ER][i][1] = eri;
|
|
|
|
|
|
}
|
2016-10-19 00:18:41 +02:00
|
|
|
|
cal_status &= ~CALSTAT_SHORT;
|
2016-10-16 01:11:16 +02:00
|
|
|
|
cal_status |= CALSTAT_ER;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CAUTION: Et is inversed for efficiency
|
|
|
|
|
|
static void
|
|
|
|
|
|
eterm_calc_et(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
int i;
|
2017-01-16 16:13:42 +01:00
|
|
|
|
for (i = 0; i < sweep_points; i++) {
|
2019-09-27 01:31:19 +02:00
|
|
|
|
// Et = 1/(S21mt - Ex)
|
|
|
|
|
|
float etr = cal_data[CAL_THRU][i][0] - cal_data[CAL_ISOLN][i][0];
|
|
|
|
|
|
float eti = cal_data[CAL_THRU][i][1] - cal_data[CAL_ISOLN][i][1];
|
2016-10-16 01:11:16 +02:00
|
|
|
|
float sq = etr*etr + eti*eti;
|
|
|
|
|
|
float invr = etr / sq;
|
|
|
|
|
|
float invi = -eti / sq;
|
|
|
|
|
|
cal_data[ETERM_ET][i][0] = invr;
|
|
|
|
|
|
cal_data[ETERM_ET][i][1] = invi;
|
|
|
|
|
|
}
|
|
|
|
|
|
cal_status &= ~CALSTAT_THRU;
|
|
|
|
|
|
cal_status |= CALSTAT_ET;
|
|
|
|
|
|
}
|
2016-10-13 20:56:08 +02:00
|
|
|
|
|
2019-10-06 00:56:25 +02:00
|
|
|
|
#if 0
|
2016-10-16 01:11:16 +02:00
|
|
|
|
void apply_error_term(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
int i;
|
2017-01-16 16:13:42 +01:00
|
|
|
|
for (i = 0; i < sweep_points; i++) {
|
2016-10-16 01:11:16 +02:00
|
|
|
|
// S11m' = S11m - Ed
|
|
|
|
|
|
// S11a = S11m' / (Er + Es S11m')
|
|
|
|
|
|
float s11mr = measured[0][i][0] - cal_data[ETERM_ED][i][0];
|
|
|
|
|
|
float s11mi = measured[0][i][1] - cal_data[ETERM_ED][i][1];
|
|
|
|
|
|
float err = cal_data[ETERM_ER][i][0] + s11mr * cal_data[ETERM_ES][i][0] - s11mi * cal_data[ETERM_ES][i][1];
|
|
|
|
|
|
float eri = cal_data[ETERM_ER][i][1] + s11mr * cal_data[ETERM_ES][i][1] + s11mi * cal_data[ETERM_ES][i][0];
|
|
|
|
|
|
float sq = err*err + eri*eri;
|
|
|
|
|
|
float s11ar = (s11mr * err + s11mi * eri) / sq;
|
|
|
|
|
|
float s11ai = (s11mi * err - s11mr * eri) / sq;
|
|
|
|
|
|
measured[0][i][0] = s11ar;
|
|
|
|
|
|
measured[0][i][1] = s11ai;
|
|
|
|
|
|
|
|
|
|
|
|
// CAUTION: Et is inversed for efficiency
|
|
|
|
|
|
// S21m' = S21m - Ex
|
|
|
|
|
|
// S21a = S21m' (1-EsS11a)Et
|
|
|
|
|
|
float s21mr = measured[1][i][0] - cal_data[ETERM_EX][i][0];
|
|
|
|
|
|
float s21mi = measured[1][i][1] - cal_data[ETERM_EX][i][1];
|
|
|
|
|
|
float esr = 1 - (cal_data[ETERM_ES][i][0] * s11ar - cal_data[ETERM_ES][i][1] * s11ai);
|
|
|
|
|
|
float esi = - (cal_data[ETERM_ES][i][1] * s11ar + cal_data[ETERM_ES][i][0] * s11ai);
|
|
|
|
|
|
float etr = esr * cal_data[ETERM_ET][i][0] - esi * cal_data[ETERM_ET][i][1];
|
|
|
|
|
|
float eti = esr * cal_data[ETERM_ET][i][1] + esi * cal_data[ETERM_ET][i][0];
|
|
|
|
|
|
float s21ar = s21mr * etr - s21mi * eti;
|
|
|
|
|
|
float s21ai = s21mi * etr + s21mr * eti;
|
|
|
|
|
|
measured[1][i][0] = s21ar;
|
|
|
|
|
|
measured[1][i][1] = s21ai;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2016-10-13 20:56:08 +02:00
|
|
|
|
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
static void apply_error_term_at(int i)
|
2017-09-17 11:52:02 +02:00
|
|
|
|
{
|
|
|
|
|
|
// S11m' = S11m - Ed
|
|
|
|
|
|
// S11a = S11m' / (Er + Es S11m')
|
|
|
|
|
|
float s11mr = measured[0][i][0] - cal_data[ETERM_ED][i][0];
|
|
|
|
|
|
float s11mi = measured[0][i][1] - cal_data[ETERM_ED][i][1];
|
|
|
|
|
|
float err = cal_data[ETERM_ER][i][0] + s11mr * cal_data[ETERM_ES][i][0] - s11mi * cal_data[ETERM_ES][i][1];
|
|
|
|
|
|
float eri = cal_data[ETERM_ER][i][1] + s11mr * cal_data[ETERM_ES][i][1] + s11mi * cal_data[ETERM_ES][i][0];
|
|
|
|
|
|
float sq = err*err + eri*eri;
|
|
|
|
|
|
float s11ar = (s11mr * err + s11mi * eri) / sq;
|
|
|
|
|
|
float s11ai = (s11mi * err - s11mr * eri) / sq;
|
|
|
|
|
|
measured[0][i][0] = s11ar;
|
|
|
|
|
|
measured[0][i][1] = s11ai;
|
|
|
|
|
|
|
|
|
|
|
|
// CAUTION: Et is inversed for efficiency
|
|
|
|
|
|
// S21m' = S21m - Ex
|
|
|
|
|
|
// S21a = S21m' (1-EsS11a)Et
|
|
|
|
|
|
float s21mr = measured[1][i][0] - cal_data[ETERM_EX][i][0];
|
|
|
|
|
|
float s21mi = measured[1][i][1] - cal_data[ETERM_EX][i][1];
|
2020-04-29 13:07:07 +02:00
|
|
|
|
#if 0
|
2017-09-17 11:52:02 +02:00
|
|
|
|
float esr = 1 - (cal_data[ETERM_ES][i][0] * s11ar - cal_data[ETERM_ES][i][1] * s11ai);
|
2020-04-29 13:07:07 +02:00
|
|
|
|
float esi = 0 - (cal_data[ETERM_ES][i][1] * s11ar + cal_data[ETERM_ES][i][0] * s11ai);
|
2017-09-17 11:52:02 +02:00
|
|
|
|
float etr = esr * cal_data[ETERM_ET][i][0] - esi * cal_data[ETERM_ET][i][1];
|
|
|
|
|
|
float eti = esr * cal_data[ETERM_ET][i][1] + esi * cal_data[ETERM_ET][i][0];
|
|
|
|
|
|
float s21ar = s21mr * etr - s21mi * eti;
|
|
|
|
|
|
float s21ai = s21mi * etr + s21mr * eti;
|
2020-04-29 13:07:07 +02:00
|
|
|
|
#else
|
|
|
|
|
|
// Not made CH1 correction by CH0 data
|
|
|
|
|
|
float s21ar = s21mr * cal_data[ETERM_ET][i][0] - s21mi * cal_data[ETERM_ET][i][1];
|
|
|
|
|
|
float s21ai = s21mi * cal_data[ETERM_ET][i][0] + s21mr * cal_data[ETERM_ET][i][1];
|
|
|
|
|
|
#endif
|
|
|
|
|
|
measured[1][i][0] = s21ar;
|
|
|
|
|
|
measured[1][i][1] = s21ai;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
static void apply_CH0_error_term_at(int i)
|
|
|
|
|
|
{
|
|
|
|
|
|
// S11m' = S11m - Ed
|
|
|
|
|
|
// S11a = S11m' / (Er + Es S11m')
|
|
|
|
|
|
float s11mr = measured[0][i][0] - cal_data[ETERM_ED][i][0];
|
|
|
|
|
|
float s11mi = measured[0][i][1] - cal_data[ETERM_ED][i][1];
|
|
|
|
|
|
float err = cal_data[ETERM_ER][i][0] + s11mr * cal_data[ETERM_ES][i][0] - s11mi * cal_data[ETERM_ES][i][1];
|
|
|
|
|
|
float eri = cal_data[ETERM_ER][i][1] + s11mr * cal_data[ETERM_ES][i][1] + s11mi * cal_data[ETERM_ES][i][0];
|
|
|
|
|
|
float sq = err*err + eri*eri;
|
|
|
|
|
|
float s11ar = (s11mr * err + s11mi * eri) / sq;
|
|
|
|
|
|
float s11ai = (s11mi * err - s11mr * eri) / sq;
|
|
|
|
|
|
measured[0][i][0] = s11ar;
|
|
|
|
|
|
measured[0][i][1] = s11ai;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void apply_CH1_error_term_at(int i)
|
|
|
|
|
|
{
|
|
|
|
|
|
// CAUTION: Et is inversed for efficiency
|
|
|
|
|
|
// S21a = (S21m - Ex) * Et
|
|
|
|
|
|
float s21mr = measured[1][i][0] - cal_data[ETERM_EX][i][0];
|
|
|
|
|
|
float s21mi = measured[1][i][1] - cal_data[ETERM_EX][i][1];
|
|
|
|
|
|
// Not made CH1 correction by CH0 data
|
|
|
|
|
|
float s21ar = s21mr * cal_data[ETERM_ET][i][0] - s21mi * cal_data[ETERM_ET][i][1];
|
|
|
|
|
|
float s21ai = s21mi * cal_data[ETERM_ET][i][0] + s21mr * cal_data[ETERM_ET][i][1];
|
2017-09-17 11:52:02 +02:00
|
|
|
|
measured[1][i][0] = s21ar;
|
|
|
|
|
|
measured[1][i][1] = s21ai;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-29 13:07:07 +02:00
|
|
|
|
static void apply_edelay(void)
|
2017-09-19 15:49:59 +02:00
|
|
|
|
{
|
2020-04-29 13:07:07 +02:00
|
|
|
|
int i;
|
|
|
|
|
|
uint16_t sweep_mode = get_sweep_mode();
|
|
|
|
|
|
for (i=0;i<sweep_points;i++){
|
|
|
|
|
|
float w = 2 * VNA_PI * electrical_delay * frequencies[i] * 1E-12;
|
|
|
|
|
|
float s = sin(w);
|
|
|
|
|
|
float c = cos(w);
|
|
|
|
|
|
float real, imag;
|
|
|
|
|
|
if (sweep_mode & SWEEP_CH0_MEASURE){
|
|
|
|
|
|
real = measured[0][i][0];
|
|
|
|
|
|
imag = measured[0][i][1];
|
|
|
|
|
|
measured[0][i][0] = real * c - imag * s;
|
|
|
|
|
|
measured[0][i][1] = imag * c + real * s;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (sweep_mode & SWEEP_CH1_MEASURE){
|
|
|
|
|
|
real = measured[1][i][0];
|
|
|
|
|
|
imag = measured[1][i][1];
|
|
|
|
|
|
measured[1][i][0] = real * c - imag * s;
|
|
|
|
|
|
measured[1][i][1] = imag * c + real * s;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-09-19 15:49:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-11-19 05:11:49 +01:00
|
|
|
|
void
|
|
|
|
|
|
cal_collect(int type)
|
|
|
|
|
|
{
|
2020-06-04 19:26:06 +02:00
|
|
|
|
//ensure_edit_config();
|
|
|
|
|
|
active_props = ¤t_props;
|
2020-03-08 20:48:36 +01:00
|
|
|
|
int dst, src;
|
2016-11-19 05:11:49 +01:00
|
|
|
|
switch (type) {
|
2020-03-08 20:48:36 +01:00
|
|
|
|
case CAL_LOAD: cal_status|= CALSTAT_LOAD; dst = CAL_LOAD; src = 0; break;
|
2020-06-04 19:26:06 +02:00
|
|
|
|
case CAL_OPEN: cal_status|= CALSTAT_OPEN; dst = CAL_OPEN; src = 0; cal_status&= ~(CALSTAT_ES); break;
|
|
|
|
|
|
case CAL_SHORT: cal_status|= CALSTAT_SHORT; dst = CAL_SHORT; src = 0; cal_status&= ~(CALSTAT_ER); break;
|
2020-03-08 20:48:36 +01:00
|
|
|
|
case CAL_THRU: cal_status|= CALSTAT_THRU; dst = CAL_THRU; src = 1; break;
|
|
|
|
|
|
case CAL_ISOLN: cal_status|= CALSTAT_ISOLN; dst = CAL_ISOLN; src = 1; break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
return;
|
2016-11-19 05:11:49 +01:00
|
|
|
|
}
|
2020-06-04 19:26:06 +02:00
|
|
|
|
// Run sweep for collect data (use minimum BANDWIDTH_30, or bigger if set)
|
2020-04-02 15:36:59 +02:00
|
|
|
|
uint8_t bw = config.bandwidth; // store current setting
|
2020-06-04 19:26:06 +02:00
|
|
|
|
uint16_t status = cal_status;
|
|
|
|
|
|
if (bw < BANDWIDTH_30)
|
|
|
|
|
|
config.bandwidth = BANDWIDTH_30;
|
|
|
|
|
|
cal_status&= ~(CALSTAT_APPLY);
|
2020-04-29 13:32:40 +02:00
|
|
|
|
// Set MAX settings for sweep_points on calibrate
|
|
|
|
|
|
// if (sweep_points != POINTS_COUNT)
|
|
|
|
|
|
// set_sweep_points(POINTS_COUNT);
|
2020-06-04 19:26:06 +02:00
|
|
|
|
sweep(false, src == 0 ? SWEEP_CH0_MEASURE : SWEEP_CH1_MEASURE);
|
2020-04-02 15:36:59 +02:00
|
|
|
|
config.bandwidth = bw; // restore
|
2020-06-04 19:26:06 +02:00
|
|
|
|
cal_status = status;
|
2020-03-08 20:48:36 +01:00
|
|
|
|
// Copy calibration data
|
|
|
|
|
|
memcpy(cal_data[dst], measured[src], sizeof measured[0]);
|
2020-03-07 15:19:43 +01:00
|
|
|
|
redraw_request |= REDRAW_CAL_STATUS;
|
2016-11-19 05:11:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
cal_done(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
ensure_edit_config();
|
|
|
|
|
|
if (!(cal_status & CALSTAT_LOAD))
|
|
|
|
|
|
eterm_set(ETERM_ED, 0.0, 0.0);
|
|
|
|
|
|
//adjust_ed();
|
|
|
|
|
|
if ((cal_status & CALSTAT_SHORT) && (cal_status & CALSTAT_OPEN)) {
|
|
|
|
|
|
eterm_calc_es();
|
|
|
|
|
|
eterm_calc_er(-1);
|
|
|
|
|
|
} else if (cal_status & CALSTAT_OPEN) {
|
|
|
|
|
|
eterm_copy(CAL_SHORT, CAL_OPEN);
|
|
|
|
|
|
eterm_set(ETERM_ES, 0.0, 0.0);
|
|
|
|
|
|
eterm_calc_er(1);
|
|
|
|
|
|
} else if (cal_status & CALSTAT_SHORT) {
|
|
|
|
|
|
eterm_set(ETERM_ES, 0.0, 0.0);
|
|
|
|
|
|
cal_status &= ~CALSTAT_SHORT;
|
|
|
|
|
|
eterm_calc_er(-1);
|
2020-06-04 19:26:06 +02:00
|
|
|
|
} else if (!(cal_status & CALSTAT_ER)){
|
2016-11-19 05:11:49 +01:00
|
|
|
|
eterm_set(ETERM_ER, 1.0, 0.0);
|
2020-06-04 19:26:06 +02:00
|
|
|
|
} else if (!(cal_status & CALSTAT_ES)) {
|
2016-11-19 05:11:49 +01:00
|
|
|
|
eterm_set(ETERM_ES, 0.0, 0.0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!(cal_status & CALSTAT_ISOLN))
|
|
|
|
|
|
eterm_set(ETERM_EX, 0.0, 0.0);
|
|
|
|
|
|
if (cal_status & CALSTAT_THRU) {
|
|
|
|
|
|
eterm_calc_et();
|
2020-06-04 19:26:06 +02:00
|
|
|
|
} else if (!(cal_status & CALSTAT_ET)) {
|
2016-11-19 05:11:49 +01:00
|
|
|
|
eterm_set(ETERM_ET, 1.0, 0.0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cal_status |= CALSTAT_APPLY;
|
2019-09-23 05:43:39 +02:00
|
|
|
|
redraw_request |= REDRAW_CAL_STATUS;
|
2016-11-19 05:11:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
static void
|
2017-09-15 15:13:17 +02:00
|
|
|
|
cal_interpolate(int s)
|
|
|
|
|
|
{
|
|
|
|
|
|
const properties_t *src = caldata_ref(s);
|
2020-04-29 13:23:59 +02:00
|
|
|
|
uint32_t i, j;
|
2017-09-15 15:13:17 +02:00
|
|
|
|
int eterm;
|
|
|
|
|
|
if (src == NULL)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
ensure_edit_config();
|
|
|
|
|
|
|
2020-04-29 13:23:59 +02:00
|
|
|
|
uint32_t src_f = src->_frequency0;
|
2017-09-15 15:13:17 +02:00
|
|
|
|
// lower than start freq of src range
|
|
|
|
|
|
for (i = 0; i < sweep_points; i++) {
|
2020-04-29 13:23:59 +02:00
|
|
|
|
if (frequencies[i] >= src_f)
|
2017-09-15 15:13:17 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
// fill cal_data at head of src range
|
|
|
|
|
|
for (eterm = 0; eterm < 5; eterm++) {
|
|
|
|
|
|
cal_data[eterm][i][0] = src->_cal_data[eterm][0][0];
|
|
|
|
|
|
cal_data[eterm][i][1] = src->_cal_data[eterm][0][1];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-29 13:23:59 +02:00
|
|
|
|
// ReBuild src freq list
|
|
|
|
|
|
uint32_t src_points = (src->_sweep_points - 1);
|
|
|
|
|
|
uint32_t span = src->_frequency1 - src->_frequency0;
|
|
|
|
|
|
uint32_t delta = span / src_points;
|
|
|
|
|
|
uint32_t error = span % src_points;
|
|
|
|
|
|
uint32_t df = src_points>>1;
|
2017-09-15 15:13:17 +02:00
|
|
|
|
j = 0;
|
|
|
|
|
|
for (; i < sweep_points; i++) {
|
|
|
|
|
|
uint32_t f = frequencies[i];
|
2020-03-15 12:14:52 +01:00
|
|
|
|
if (f == 0) goto interpolate_finish;
|
2020-04-29 13:23:59 +02:00
|
|
|
|
for (; j < src_points; j++) {
|
|
|
|
|
|
if (src_f <= f && f < src_f + delta) {
|
2017-09-15 15:13:17 +02:00
|
|
|
|
// found f between freqs at j and j+1
|
2020-04-29 13:23:59 +02:00
|
|
|
|
float k1 = (delta == 0) ? 0.0 : (float)(f - src_f) / delta;
|
2019-10-05 14:11:19 +02:00
|
|
|
|
// avoid glitch between freqs in different harmonics mode
|
2020-04-29 13:23:59 +02:00
|
|
|
|
uint16_t idx = j;
|
|
|
|
|
|
if (si5351_get_harmonic_lvl(src_f) != si5351_get_harmonic_lvl(src_f+delta)) {
|
|
|
|
|
|
// f in prev harmonic, need extrapolate from prev 2 points
|
|
|
|
|
|
if (si5351_get_harmonic_lvl(f) == si5351_get_harmonic_lvl(src_f)){
|
|
|
|
|
|
if (idx >=1){
|
|
|
|
|
|
idx--; k1+= 1.0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else // point limit
|
|
|
|
|
|
k1 = 0.0;
|
|
|
|
|
|
}
|
|
|
|
|
|
// f in next harmonic, need extrapolate from next 2 points
|
|
|
|
|
|
else {
|
|
|
|
|
|
if (idx<src_points){
|
|
|
|
|
|
idx++; k1-=1.0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else // point limit
|
|
|
|
|
|
k1 = 1.0;
|
|
|
|
|
|
}
|
2019-10-05 14:11:19 +02:00
|
|
|
|
}
|
2017-09-15 15:13:17 +02:00
|
|
|
|
float k0 = 1.0 - k1;
|
|
|
|
|
|
for (eterm = 0; eterm < 5; eterm++) {
|
2020-04-29 13:23:59 +02:00
|
|
|
|
cal_data[eterm][i][0] = src->_cal_data[eterm][idx][0] * k0 + src->_cal_data[eterm][idx+1][0] * k1;
|
|
|
|
|
|
cal_data[eterm][i][1] = src->_cal_data[eterm][idx][1] * k0 + src->_cal_data[eterm][idx+1][1] * k1;
|
2017-09-15 15:13:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2020-04-29 13:23:59 +02:00
|
|
|
|
df+=error;if (df >=src_points) {src_f++;df -= src_points;}
|
|
|
|
|
|
src_f+=delta;
|
2017-09-15 15:13:17 +02:00
|
|
|
|
}
|
2020-04-29 13:23:59 +02:00
|
|
|
|
if (j == src_points)
|
2017-09-15 15:13:17 +02:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2020-03-21 00:03:09 +01:00
|
|
|
|
|
2017-09-15 15:13:17 +02:00
|
|
|
|
// upper than end freq of src range
|
|
|
|
|
|
for (; i < sweep_points; i++) {
|
|
|
|
|
|
// fill cal_data at tail of src
|
|
|
|
|
|
for (eterm = 0; eterm < 5; eterm++) {
|
2020-04-29 13:23:59 +02:00
|
|
|
|
cal_data[eterm][i][0] = src->_cal_data[eterm][src_points][0];
|
|
|
|
|
|
cal_data[eterm][i][1] = src->_cal_data[eterm][src_points][1];
|
2017-09-15 15:13:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-03-15 12:14:52 +01:00
|
|
|
|
interpolate_finish:
|
2017-09-15 15:13:17 +02:00
|
|
|
|
cal_status |= src->_cal_status | CALSTAT_APPLY | CALSTAT_INTERPOLATED;
|
2019-10-17 17:03:13 +02:00
|
|
|
|
redraw_request |= REDRAW_CAL_STATUS;
|
2017-09-15 15:13:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_cal)
|
2016-10-13 20:56:08 +02:00
|
|
|
|
{
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
static const char *items[] = { "load", "open", "short", "thru", "isoln", "Es", "Er", "Et", "cal'ed" };
|
2016-10-16 01:11:16 +02:00
|
|
|
|
|
2016-10-13 20:56:08 +02:00
|
|
|
|
if (argc == 0) {
|
2016-10-16 01:11:16 +02:00
|
|
|
|
int i;
|
|
|
|
|
|
for (i = 0; i < 9; i++) {
|
|
|
|
|
|
if (cal_status & (1<<i))
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("%s ", items[i]);
|
2016-10-16 01:11:16 +02:00
|
|
|
|
}
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("\r\n");
|
2016-10-13 20:56:08 +02:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-03-05 20:36:44 +01:00
|
|
|
|
redraw_request|=REDRAW_CAL_STATUS;
|
2020-02-23 13:45:37 +01:00
|
|
|
|
// 0 1 2 3 4 5 6 7 8 9 10
|
|
|
|
|
|
static const char cmd_cal_list[] = "load|open|short|thru|isoln|done|on|off|reset|data|in";
|
2020-03-21 00:03:09 +01:00
|
|
|
|
switch (get_str_index(argv[0], cmd_cal_list)) {
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
cal_collect(CAL_LOAD);
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
cal_collect(CAL_OPEN);
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
cal_collect(CAL_SHORT);
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
cal_collect(CAL_THRU);
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
cal_collect(CAL_ISOLN);
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 5:
|
|
|
|
|
|
cal_done();
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 6:
|
|
|
|
|
|
cal_status |= CALSTAT_APPLY;
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 7:
|
|
|
|
|
|
cal_status &= ~CALSTAT_APPLY;
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 8:
|
|
|
|
|
|
cal_status = 0;
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 9:
|
|
|
|
|
|
shell_printf("%f %f\r\n", cal_data[CAL_LOAD][0][0], cal_data[CAL_LOAD][0][1]);
|
|
|
|
|
|
shell_printf("%f %f\r\n", cal_data[CAL_OPEN][0][0], cal_data[CAL_OPEN][0][1]);
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("%f %f\r\n", cal_data[CAL_SHORT][0][0], cal_data[CAL_SHORT][0][1]);
|
2020-03-21 00:03:09 +01:00
|
|
|
|
shell_printf("%f %f\r\n", cal_data[CAL_THRU][0][0], cal_data[CAL_THRU][0][1]);
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("%f %f\r\n", cal_data[CAL_ISOLN][0][0], cal_data[CAL_ISOLN][0][1]);
|
2020-02-23 13:45:37 +01:00
|
|
|
|
return;
|
|
|
|
|
|
case 10:
|
|
|
|
|
|
cal_interpolate((argc > 1) ? my_atoi(argv[1]) : 0);
|
|
|
|
|
|
return;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
default:
|
|
|
|
|
|
break;
|
2016-10-14 14:47:00 +02:00
|
|
|
|
}
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("usage: cal [%s]\r\n", cmd_cal_list);
|
2016-10-13 20:56:08 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_save)
|
2016-10-16 13:02:38 +02:00
|
|
|
|
{
|
2016-11-04 17:22:48 +01:00
|
|
|
|
if (argc != 1)
|
|
|
|
|
|
goto usage;
|
|
|
|
|
|
|
2020-02-11 09:54:05 +01:00
|
|
|
|
int id = my_atoi(argv[0]);
|
2016-11-04 17:22:48 +01:00
|
|
|
|
if (id < 0 || id >= SAVEAREA_MAX)
|
|
|
|
|
|
goto usage;
|
|
|
|
|
|
caldata_save(id);
|
2019-09-23 05:43:39 +02:00
|
|
|
|
redraw_request |= REDRAW_CAL_STATUS;
|
2016-11-04 17:22:48 +01:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
usage:
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("save {id}\r\n");
|
2016-10-16 13:02:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_recall)
|
2016-10-16 13:02:38 +02:00
|
|
|
|
{
|
2016-11-04 17:22:48 +01:00
|
|
|
|
if (argc != 1)
|
|
|
|
|
|
goto usage;
|
|
|
|
|
|
|
2020-02-11 09:54:05 +01:00
|
|
|
|
int id = my_atoi(argv[0]);
|
2016-11-04 17:22:48 +01:00
|
|
|
|
if (id < 0 || id >= SAVEAREA_MAX)
|
|
|
|
|
|
goto usage;
|
2020-02-28 21:15:38 +01:00
|
|
|
|
// Check for success
|
2020-04-29 13:23:59 +02:00
|
|
|
|
if (load_properties(id) == -1)
|
2020-02-28 21:15:38 +01:00
|
|
|
|
shell_printf("Err, default load\r\n");
|
|
|
|
|
|
redraw_request |= REDRAW_CAL_STATUS;
|
2016-11-04 17:22:48 +01:00
|
|
|
|
return;
|
|
|
|
|
|
usage:
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("recall {id}\r\n");
|
2016-10-16 13:02:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
static const struct {
|
2019-08-26 16:58:47 +02:00
|
|
|
|
const char *name;
|
|
|
|
|
|
uint16_t refpos;
|
|
|
|
|
|
float scale_unit;
|
2020-03-21 14:15:03 +01:00
|
|
|
|
} trace_info[MAX_TRACE_TYPE-1] = {
|
2020-02-23 13:58:12 +01:00
|
|
|
|
{ "LOGMAG", NGRIDY-1, 10.0 },
|
|
|
|
|
|
{ "PHASE", NGRIDY/2, 90.0 },
|
|
|
|
|
|
{ "DELAY", NGRIDY/2, 1e-9 },
|
|
|
|
|
|
{ "SMITH", 0, 1.00 },
|
|
|
|
|
|
{ "POLAR", 0, 1.00 },
|
|
|
|
|
|
{ "LINEAR", 0, 0.125},
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
{ "SWR", 0, 0.25 },
|
2020-02-23 13:58:12 +01:00
|
|
|
|
{ "REAL", NGRIDY/2, 0.25 },
|
|
|
|
|
|
{ "IMAG", NGRIDY/2, 0.25 },
|
|
|
|
|
|
{ "R", NGRIDY/2, 100.0 },
|
2020-06-16 02:23:10 +02:00
|
|
|
|
{ "X", NGRIDY/2, 100.0 },
|
|
|
|
|
|
{ "Q", 0, 10.0 }
|
2017-01-15 15:27:05 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
static const char * const trc_channel_name[] = {
|
2016-11-30 17:08:13 +01:00
|
|
|
|
"CH0", "CH1"
|
2016-10-16 17:05:19 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
const char *get_trace_typename(int t)
|
2019-08-26 16:58:47 +02:00
|
|
|
|
{
|
|
|
|
|
|
return trace_info[trace[t].type].name;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-11-28 01:17:54 +01:00
|
|
|
|
void set_trace_type(int t, int type)
|
|
|
|
|
|
{
|
|
|
|
|
|
int enabled = type != TRC_OFF;
|
|
|
|
|
|
int force = FALSE;
|
|
|
|
|
|
|
|
|
|
|
|
if (trace[t].enabled != enabled) {
|
|
|
|
|
|
trace[t].enabled = enabled;
|
|
|
|
|
|
force = TRUE;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (trace[t].type != type) {
|
|
|
|
|
|
trace[t].type = type;
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
// Set default trace refpos
|
2019-08-26 16:58:47 +02:00
|
|
|
|
trace[t].refpos = trace_info[type].refpos;
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
// Set default trace scale
|
|
|
|
|
|
trace[t].scale = trace_info[type].scale_unit;
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
force = TRUE;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
}
|
2017-01-01 14:54:12 +01:00
|
|
|
|
if (force) {
|
|
|
|
|
|
plot_into_index(measured);
|
2020-07-01 11:23:57 +02:00
|
|
|
|
force_set_markmap();
|
2017-01-01 14:54:12 +01:00
|
|
|
|
}
|
2016-11-28 01:17:54 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-11-30 17:08:13 +01:00
|
|
|
|
void set_trace_channel(int t, int channel)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (trace[t].channel != channel) {
|
|
|
|
|
|
trace[t].channel = channel;
|
2020-07-01 11:23:57 +02:00
|
|
|
|
force_set_markmap();
|
2016-11-30 17:08:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-12-04 08:19:31 +01:00
|
|
|
|
void set_trace_scale(int t, float scale)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (trace[t].scale != scale) {
|
|
|
|
|
|
trace[t].scale = scale;
|
2020-07-01 11:23:57 +02:00
|
|
|
|
force_set_markmap();
|
2016-12-04 08:19:31 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-09-30 17:56:43 +02:00
|
|
|
|
float get_trace_scale(int t)
|
|
|
|
|
|
{
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
return trace[t].scale;
|
2017-09-30 17:56:43 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-01-15 15:27:05 +01:00
|
|
|
|
void set_trace_refpos(int t, float refpos)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (trace[t].refpos != refpos) {
|
|
|
|
|
|
trace[t].refpos = refpos;
|
|
|
|
|
|
force_set_markmap();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-09-30 17:56:43 +02:00
|
|
|
|
float get_trace_refpos(int t)
|
|
|
|
|
|
{
|
|
|
|
|
|
return trace[t].refpos;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_trace)
|
2016-10-16 17:05:19 +02:00
|
|
|
|
{
|
|
|
|
|
|
int t;
|
|
|
|
|
|
if (argc == 0) {
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
for (t = 0; t < TRACES_MAX; t++) {
|
2016-10-16 17:05:19 +02:00
|
|
|
|
if (trace[t].enabled) {
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
const char *type = get_trace_typename(t);
|
2016-10-24 18:16:05 +02:00
|
|
|
|
const char *channel = trc_channel_name[trace[t].channel];
|
2019-08-26 16:58:47 +02:00
|
|
|
|
float scale = get_trace_scale(t);
|
|
|
|
|
|
float refpos = get_trace_refpos(t);
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("%d %s %s %f %f\r\n", t, type, channel, scale, refpos);
|
2016-10-16 17:05:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
}
|
2016-11-28 15:44:21 +01:00
|
|
|
|
|
|
|
|
|
|
if (strcmp(argv[0], "all") == 0 &&
|
|
|
|
|
|
argc > 1 && strcmp(argv[1], "off") == 0) {
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
for (t = 0; t < TRACES_MAX; t++)
|
|
|
|
|
|
set_trace_type(t, TRC_OFF);
|
2016-11-28 15:44:21 +01:00
|
|
|
|
goto exit;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-11 09:54:05 +01:00
|
|
|
|
t = my_atoi(argv[0]);
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
if (t < 0 || t >= TRACES_MAX)
|
2016-10-16 17:05:19 +02:00
|
|
|
|
goto usage;
|
|
|
|
|
|
if (argc == 1) {
|
2019-08-26 16:58:47 +02:00
|
|
|
|
const char *type = get_trace_typename(t);
|
2016-10-24 18:16:05 +02:00
|
|
|
|
const char *channel = trc_channel_name[trace[t].channel];
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("%d %s %s\r\n", t, type, channel);
|
2016-10-16 17:05:19 +02:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-06-21 07:00:01 +02:00
|
|
|
|
#if MAX_TRACE_TYPE != 13
|
2020-02-23 13:45:37 +01:00
|
|
|
|
#error "Trace type enum possibly changed, check cmd_trace function"
|
|
|
|
|
|
#endif
|
2020-06-16 02:23:10 +02:00
|
|
|
|
// enum TRC_LOGMAG, TRC_PHASE, TRC_DELAY, TRC_SMITH, TRC_POLAR, TRC_LINEAR, TRC_SWR, TRC_REAL, TRC_IMAG, TRC_R, TRC_X, TRC_Q, TRC_OFF
|
|
|
|
|
|
static const char cmd_type_list[] = "logmag|phase|delay|smith|polar|linear|swr|real|imag|r|x|q|off";
|
2020-03-21 00:03:09 +01:00
|
|
|
|
int type = get_str_index(argv[1], cmd_type_list);
|
|
|
|
|
|
if (type >= 0) {
|
2020-02-23 13:45:37 +01:00
|
|
|
|
set_trace_type(t, type);
|
|
|
|
|
|
goto check_ch_num;
|
|
|
|
|
|
}
|
|
|
|
|
|
// 0 1
|
|
|
|
|
|
static const char cmd_scale_ref_list[] = "scale|refpos";
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if (argc >= 3) {
|
|
|
|
|
|
switch (get_str_index(argv[1], cmd_scale_ref_list)) {
|
2020-02-23 13:45:37 +01:00
|
|
|
|
case 0:
|
|
|
|
|
|
//trace[t].scale = my_atof(argv[2]);
|
|
|
|
|
|
set_trace_scale(t, my_atof(argv[2]));
|
|
|
|
|
|
goto exit;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
//trace[t].refpos = my_atof(argv[2]);
|
|
|
|
|
|
set_trace_refpos(t, my_atof(argv[2]));
|
|
|
|
|
|
goto exit;
|
|
|
|
|
|
default:
|
|
|
|
|
|
goto usage;
|
2020-02-11 09:54:05 +01:00
|
|
|
|
}
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
}
|
2020-02-23 13:45:37 +01:00
|
|
|
|
check_ch_num:
|
2016-10-16 17:05:19 +02:00
|
|
|
|
if (argc > 2) {
|
2020-02-11 09:54:05 +01:00
|
|
|
|
int src = my_atoi(argv[2]);
|
2016-10-16 17:05:19 +02:00
|
|
|
|
if (src != 0 && src != 1)
|
|
|
|
|
|
goto usage;
|
2016-10-24 18:16:05 +02:00
|
|
|
|
trace[t].channel = src;
|
2020-01-19 14:14:22 +01:00
|
|
|
|
}
|
2020-02-23 13:45:37 +01:00
|
|
|
|
exit:
|
2016-10-16 17:05:19 +02:00
|
|
|
|
return;
|
2020-02-23 13:45:37 +01:00
|
|
|
|
usage:
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("trace {0|1|2|3|all} [%s] [src]\r\n"\
|
|
|
|
|
|
"trace {0|1|2|3} {%s} {value}\r\n", cmd_type_list, cmd_scale_ref_list);
|
2016-10-16 17:05:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-09-19 15:49:59 +02:00
|
|
|
|
|
|
|
|
|
|
void set_electrical_delay(float picoseconds)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (electrical_delay != picoseconds) {
|
|
|
|
|
|
electrical_delay = picoseconds;
|
|
|
|
|
|
force_set_markmap();
|
|
|
|
|
|
}
|
2020-03-01 00:50:46 +01:00
|
|
|
|
redraw_request |= REDRAW_MARKER;
|
2017-09-19 15:49:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-09-30 17:56:43 +02:00
|
|
|
|
float get_electrical_delay(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
return electrical_delay;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_edelay)
|
2017-09-19 15:49:59 +02:00
|
|
|
|
{
|
|
|
|
|
|
if (argc == 0) {
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("%f\r\n", electrical_delay);
|
2017-09-19 15:49:59 +02:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (argc > 0) {
|
|
|
|
|
|
set_electrical_delay(my_atof(argv[0]));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_marker)
|
2016-10-28 20:11:13 +02:00
|
|
|
|
{
|
|
|
|
|
|
int t;
|
|
|
|
|
|
if (argc == 0) {
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
for (t = 0; t < MARKERS_MAX; t++) {
|
2016-10-28 20:11:13 +02:00
|
|
|
|
if (markers[t].enabled) {
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("%d %d %d\r\n", t+1, markers[t].index, markers[t].frequency);
|
2016-10-28 20:11:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return;
|
2020-02-23 13:45:37 +01:00
|
|
|
|
}
|
2020-03-05 20:36:44 +01:00
|
|
|
|
redraw_request |= REDRAW_MARKER;
|
2016-10-29 09:52:48 +02:00
|
|
|
|
if (strcmp(argv[0], "off") == 0) {
|
|
|
|
|
|
active_marker = -1;
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
for (t = 0; t < MARKERS_MAX; t++)
|
2016-10-29 09:52:48 +02:00
|
|
|
|
markers[t].enabled = FALSE;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-02-11 09:54:05 +01:00
|
|
|
|
t = my_atoi(argv[0])-1;
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
if (t < 0 || t >= MARKERS_MAX)
|
2016-10-28 20:11:13 +02:00
|
|
|
|
goto usage;
|
|
|
|
|
|
if (argc == 1) {
|
2020-03-14 13:18:14 +01:00
|
|
|
|
shell_printf("%d %d %d\r\n", t+1, markers[t].index, markers[t].frequency);
|
2016-10-29 09:52:48 +02:00
|
|
|
|
active_marker = t;
|
2019-09-23 05:43:39 +02:00
|
|
|
|
// select active marker
|
2016-10-29 09:52:48 +02:00
|
|
|
|
markers[t].enabled = TRUE;
|
2016-10-28 20:11:13 +02:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-02-23 13:45:37 +01:00
|
|
|
|
static const char cmd_marker_list[] = "on|off";
|
2020-03-21 00:03:09 +01:00
|
|
|
|
switch (get_str_index(argv[1], cmd_marker_list)) {
|
2020-03-05 20:36:44 +01:00
|
|
|
|
case 0: markers[t].enabled = TRUE; active_marker = t; return;
|
|
|
|
|
|
case 1: markers[t].enabled =FALSE; if (active_marker == t) active_marker = -1; return;
|
2020-02-23 13:45:37 +01:00
|
|
|
|
default:
|
2019-09-23 05:43:39 +02:00
|
|
|
|
// select active marker and move to index
|
2016-10-28 20:11:13 +02:00
|
|
|
|
markers[t].enabled = TRUE;
|
2020-02-11 09:54:05 +01:00
|
|
|
|
int index = my_atoi(argv[1]);
|
2016-10-28 20:11:13 +02:00
|
|
|
|
markers[t].index = index;
|
2017-09-17 13:19:12 +02:00
|
|
|
|
markers[t].frequency = frequencies[index];
|
2016-10-28 20:11:13 +02:00
|
|
|
|
active_marker = t;
|
2020-02-23 13:45:37 +01:00
|
|
|
|
return;
|
2016-10-28 20:11:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
usage:
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("marker [n] [%s|{index}]\r\n", cmd_marker_list);
|
2016-10-28 20:11:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_touchcal)
|
2016-12-17 10:32:27 +01:00
|
|
|
|
{
|
|
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
2017-01-04 10:28:52 +01:00
|
|
|
|
//extern int16_t touch_cal[4];
|
2016-12-17 10:32:27 +01:00
|
|
|
|
int i;
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("first touch upper left, then lower right...");
|
2016-12-17 10:32:27 +01:00
|
|
|
|
touch_cal_exec();
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("done\r\n");
|
2016-12-17 10:32:27 +01:00
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("touch cal params: ");
|
2016-12-17 10:32:27 +01:00
|
|
|
|
for (i = 0; i < 4; i++) {
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("%d ", config.touch_cal[i]);
|
2016-12-17 10:32:27 +01:00
|
|
|
|
}
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("\r\n");
|
2016-12-17 10:32:27 +01:00
|
|
|
|
}
|
2016-10-28 20:11:13 +02:00
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_touchtest)
|
2017-02-02 21:40:57 +01:00
|
|
|
|
{
|
|
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
|
|
|
|
|
do {
|
|
|
|
|
|
touch_draw_test();
|
2020-03-21 00:03:09 +01:00
|
|
|
|
} while (argc);
|
2017-02-02 21:40:57 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_frequencies)
|
2017-01-02 09:32:48 +01:00
|
|
|
|
{
|
|
|
|
|
|
int i;
|
|
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
|
|
|
|
|
for (i = 0; i < sweep_points; i++) {
|
2019-09-24 19:40:00 +02:00
|
|
|
|
if (frequencies[i] != 0)
|
2020-03-14 14:05:26 +01:00
|
|
|
|
shell_printf("%u\r\n", frequencies[i]);
|
2017-01-02 09:32:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-10-05 03:13:00 +02:00
|
|
|
|
static void
|
|
|
|
|
|
set_domain_mode(int mode) // accept DOMAIN_FREQ or DOMAIN_TIME
|
|
|
|
|
|
{
|
|
|
|
|
|
if (mode != (domain_mode & DOMAIN_MODE)) {
|
|
|
|
|
|
domain_mode = (domain_mode & ~DOMAIN_MODE) | (mode & DOMAIN_MODE);
|
|
|
|
|
|
redraw_request |= REDRAW_FREQUENCY;
|
2019-11-17 03:16:08 +01:00
|
|
|
|
uistat.lever_mode = LM_MARKER;
|
2019-10-05 03:13:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
|
set_timedomain_func(int func) // accept TD_FUNC_LOWPASS_IMPULSE, TD_FUNC_LOWPASS_STEP or TD_FUNC_BANDPASS
|
|
|
|
|
|
{
|
|
|
|
|
|
domain_mode = (domain_mode & ~TD_FUNC) | (func & TD_FUNC);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
|
set_timedomain_window(int func) // accept TD_WINDOW_MINIMUM/TD_WINDOW_NORMAL/TD_WINDOW_MAXIMUM
|
|
|
|
|
|
{
|
|
|
|
|
|
domain_mode = (domain_mode & ~TD_WINDOW) | (func & TD_WINDOW);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_transform)
|
2019-10-05 03:13:00 +02:00
|
|
|
|
{
|
|
|
|
|
|
int i;
|
|
|
|
|
|
if (argc == 0) {
|
|
|
|
|
|
goto usage;
|
|
|
|
|
|
}
|
2020-02-23 13:45:37 +01:00
|
|
|
|
// 0 1 2 3 4 5 6 7
|
|
|
|
|
|
static const char cmd_transform_list[] = "on|off|impulse|step|bandpass|minimum|normal|maximum";
|
2019-10-05 03:13:00 +02:00
|
|
|
|
for (i = 0; i < argc; i++) {
|
2020-03-21 00:03:09 +01:00
|
|
|
|
switch (get_str_index(argv[i], cmd_transform_list)) {
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
set_domain_mode(DOMAIN_TIME);
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
set_domain_mode(DOMAIN_FREQ);
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
set_timedomain_func(TD_FUNC_LOWPASS_IMPULSE);
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
set_timedomain_func(TD_FUNC_LOWPASS_STEP);
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
set_timedomain_func(TD_FUNC_BANDPASS);
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 5:
|
|
|
|
|
|
set_timedomain_window(TD_WINDOW_MINIMUM);
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 6:
|
|
|
|
|
|
set_timedomain_window(TD_WINDOW_NORMAL);
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 7:
|
|
|
|
|
|
set_timedomain_window(TD_WINDOW_MAXIMUM);
|
|
|
|
|
|
return;
|
|
|
|
|
|
default:
|
|
|
|
|
|
goto usage;
|
2019-10-05 03:13:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
|
|
|
usage:
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("usage: transform {%s} [...]\r\n", cmd_transform_list);
|
2019-10-05 03:13:00 +02:00
|
|
|
|
}
|
2017-01-02 09:32:48 +01:00
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_test)
|
2016-09-19 06:13:42 +02:00
|
|
|
|
{
|
|
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
|
|
|
|
|
|
2016-09-26 17:06:00 +02:00
|
|
|
|
#if 0
|
2016-12-17 10:32:27 +01:00
|
|
|
|
int i;
|
2016-09-19 06:13:42 +02:00
|
|
|
|
for (i = 0; i < 100; i++) {
|
|
|
|
|
|
palClearPad(GPIOC, GPIOC_LED);
|
|
|
|
|
|
set_frequency(10000000);
|
|
|
|
|
|
palSetPad(GPIOC, GPIOC_LED);
|
|
|
|
|
|
chThdSleepMilliseconds(50);
|
|
|
|
|
|
|
|
|
|
|
|
palClearPad(GPIOC, GPIOC_LED);
|
2016-09-24 03:25:13 +02:00
|
|
|
|
set_frequency(90000000);
|
2016-09-19 06:13:42 +02:00
|
|
|
|
palSetPad(GPIOC, GPIOC_LED);
|
|
|
|
|
|
chThdSleepMilliseconds(50);
|
|
|
|
|
|
}
|
2016-09-26 17:06:00 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2016-12-06 19:34:33 +01:00
|
|
|
|
#if 0
|
2016-12-17 10:32:27 +01:00
|
|
|
|
int i;
|
2016-09-26 17:06:00 +02:00
|
|
|
|
int mode = 0;
|
|
|
|
|
|
if (argc >= 1)
|
2020-02-11 09:54:05 +01:00
|
|
|
|
mode = my_atoi(argv[0]);
|
2016-09-26 17:06:00 +02:00
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 20; i++) {
|
|
|
|
|
|
palClearPad(GPIOC, GPIOC_LED);
|
|
|
|
|
|
ili9341_test(mode);
|
|
|
|
|
|
palSetPad(GPIOC, GPIOC_LED);
|
|
|
|
|
|
chThdSleepMilliseconds(50);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
2016-12-06 19:34:33 +01:00
|
|
|
|
|
2016-12-17 10:32:27 +01:00
|
|
|
|
#if 0
|
2016-12-06 19:34:33 +01:00
|
|
|
|
//extern adcsample_t adc_samples[2];
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
//shell_printf("adc: %d %d\r\n", adc_samples[0], adc_samples[1]);
|
2016-12-17 10:32:27 +01:00
|
|
|
|
int i;
|
2016-12-06 19:34:33 +01:00
|
|
|
|
int x, y;
|
2016-12-11 09:26:33 +01:00
|
|
|
|
for (i = 0; i < 50; i++) {
|
|
|
|
|
|
test_touch(&x, &y);
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("adc: %d %d\r\n", x, y);
|
2016-12-11 09:26:33 +01:00
|
|
|
|
chThdSleepMilliseconds(200);
|
|
|
|
|
|
}
|
|
|
|
|
|
//extern int touch_x, touch_y;
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
//shell_printf("adc: %d %d\r\n", touch_x, touch_y);
|
2016-12-17 10:32:27 +01:00
|
|
|
|
#endif
|
2020-06-04 19:26:06 +02:00
|
|
|
|
#if 0
|
2017-10-01 04:14:41 +02:00
|
|
|
|
while (argc > 1) {
|
2020-06-04 19:26:06 +02:00
|
|
|
|
int16_t x, y;
|
2017-10-01 04:14:41 +02:00
|
|
|
|
touch_position(&x, &y);
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("touch: %d %d\r\n", x, y);
|
2017-10-01 04:14:41 +02:00
|
|
|
|
chThdSleepMilliseconds(200);
|
|
|
|
|
|
}
|
2020-06-04 19:26:06 +02:00
|
|
|
|
#endif
|
2016-09-19 06:13:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_gain)
|
2016-09-05 00:27:44 +02:00
|
|
|
|
{
|
2020-04-29 13:30:22 +02:00
|
|
|
|
int rvalue = 0;
|
2016-09-05 00:27:44 +02:00
|
|
|
|
int lvalue = 0;
|
2020-04-29 13:30:22 +02:00
|
|
|
|
int idx = 0;
|
|
|
|
|
|
if (argc < 1 && argc > 3) {
|
|
|
|
|
|
shell_printf("usage: gain idx {lgain(0-95)} [rgain(0-95)]\r\n");
|
2016-09-05 00:27:44 +02:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-04-29 13:30:22 +02:00
|
|
|
|
idx = my_atoui(argv[0]);
|
|
|
|
|
|
lvalue = rvalue = my_atoui(argv[1]);
|
|
|
|
|
|
if (argc == 3)
|
|
|
|
|
|
rvalue = my_atoui(argv[2]);
|
2016-09-05 00:27:44 +02:00
|
|
|
|
tlv320aic3204_set_gain(lvalue, rvalue);
|
2020-04-29 13:30:22 +02:00
|
|
|
|
// gain_table[idx][0] = lvalue;
|
|
|
|
|
|
// gain_table[idx][1] = rvalue;
|
2016-09-05 00:27:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_port)
|
2016-09-05 00:27:44 +02:00
|
|
|
|
{
|
|
|
|
|
|
int port;
|
|
|
|
|
|
if (argc != 1) {
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("usage: port {0:TX 1:RX}\r\n");
|
2016-09-05 00:27:44 +02:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-02-11 09:54:05 +01:00
|
|
|
|
port = my_atoi(argv[0]);
|
2019-10-20 16:59:15 +02:00
|
|
|
|
tlv320aic3204_select(port);
|
2016-09-05 00:27:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_stat)
|
2016-09-05 00:27:44 +02:00
|
|
|
|
{
|
|
|
|
|
|
int16_t *p = &rx_buffer[0];
|
|
|
|
|
|
int32_t acc0, acc1;
|
|
|
|
|
|
int32_t ave0, ave1;
|
2020-03-21 14:15:03 +01:00
|
|
|
|
// float sample[2], ref[2];
|
|
|
|
|
|
// minr, maxr, mins, maxs;
|
2016-09-05 00:27:44 +02:00
|
|
|
|
int32_t count = AUDIO_BUFFER_LEN;
|
|
|
|
|
|
int i;
|
|
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
2020-03-21 14:15:03 +01:00
|
|
|
|
for (int ch=0;ch<2;ch++){
|
|
|
|
|
|
tlv320aic3204_select(ch);
|
|
|
|
|
|
DSP_START(4);
|
|
|
|
|
|
DSP_WAIT;
|
|
|
|
|
|
// reset_dsp_accumerator();
|
|
|
|
|
|
// dsp_process(&p[ 0], AUDIO_BUFFER_LEN);
|
|
|
|
|
|
// dsp_process(&p[AUDIO_BUFFER_LEN], AUDIO_BUFFER_LEN);
|
|
|
|
|
|
|
|
|
|
|
|
acc0 = acc1 = 0;
|
|
|
|
|
|
for (i = 0; i < AUDIO_BUFFER_LEN*2; i += 2) {
|
|
|
|
|
|
acc0 += p[i ];
|
|
|
|
|
|
acc1 += p[i+1];
|
|
|
|
|
|
}
|
|
|
|
|
|
ave0 = acc0 / count;
|
|
|
|
|
|
ave1 = acc1 / count;
|
|
|
|
|
|
acc0 = acc1 = 0;
|
|
|
|
|
|
// minr = maxr = 0;
|
|
|
|
|
|
// mins = maxs = 0;
|
|
|
|
|
|
for (i = 0; i < AUDIO_BUFFER_LEN*2; i += 2) {
|
|
|
|
|
|
acc0 += (p[i ] - ave0)*(p[i ] - ave0);
|
|
|
|
|
|
acc1 += (p[i+1] - ave1)*(p[i+1] - ave1);
|
|
|
|
|
|
// if (minr < p[i ]) minr = p[i ];
|
|
|
|
|
|
// if (maxr > p[i ]) maxr = p[i ];
|
|
|
|
|
|
// if (mins < p[i+1]) mins = p[i+1];
|
|
|
|
|
|
// if (maxs > p[i+1]) maxs = p[i+1];
|
|
|
|
|
|
}
|
|
|
|
|
|
stat.rms[0] = sqrtf(acc0 / count);
|
|
|
|
|
|
stat.rms[1] = sqrtf(acc1 / count);
|
|
|
|
|
|
stat.ave[0] = ave0;
|
|
|
|
|
|
stat.ave[1] = ave1;
|
|
|
|
|
|
shell_printf("Ch: %d\r\n", ch);
|
|
|
|
|
|
shell_printf("average: r: %6d s: %6d\r\n", stat.ave[0], stat.ave[1]);
|
|
|
|
|
|
shell_printf("rms: r: %6d s: %6d\r\n", stat.rms[0], stat.rms[1]);
|
|
|
|
|
|
// shell_printf("min: ref %6d ch %6d\r\n", minr, mins);
|
|
|
|
|
|
// shell_printf("max: ref %6d ch %6d\r\n", maxr, maxs);
|
|
|
|
|
|
}
|
|
|
|
|
|
//shell_printf("callback count: %d\r\n", stat.callback_count);
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
//shell_printf("interval cycle: %d\r\n", stat.interval_cycles);
|
|
|
|
|
|
//shell_printf("busy cycle: %d\r\n", stat.busy_cycles);
|
|
|
|
|
|
//shell_printf("load: %d\r\n", stat.busy_cycles * 100 / stat.interval_cycles);
|
2020-03-05 20:36:44 +01:00
|
|
|
|
// extern int awd_count;
|
|
|
|
|
|
// shell_printf("awd: %d\r\n", awd_count);
|
2016-09-05 00:27:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-08-18 01:19:17 +02:00
|
|
|
|
#ifndef VERSION
|
|
|
|
|
|
#define VERSION "unknown"
|
|
|
|
|
|
#endif
|
2016-09-05 00:27:44 +02:00
|
|
|
|
|
2019-08-18 14:11:03 +02:00
|
|
|
|
const char NANOVNA_VERSION[] = VERSION;
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_version)
|
2019-08-18 01:19:17 +02:00
|
|
|
|
{
|
|
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("%s\r\n", NANOVNA_VERSION);
|
2019-08-18 01:19:17 +02:00
|
|
|
|
}
|
2016-09-05 00:27:44 +02:00
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_vbat)
|
2019-09-09 13:28:10 +02:00
|
|
|
|
{
|
|
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
2020-03-07 21:37:39 +01:00
|
|
|
|
shell_printf("%d mV\r\n", adc_vbat_read());
|
2019-09-09 13:28:10 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-03-07 21:37:39 +01:00
|
|
|
|
#ifdef ENABLE_VBAT_OFFSET_COMMAND
|
|
|
|
|
|
VNA_SHELL_FUNCTION(cmd_vbat_offset)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (argc != 1) {
|
|
|
|
|
|
shell_printf("%d\r\n", config.vbat_offset);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
config.vbat_offset = (int16_t)my_atoi(argv[0]);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2020-03-08 06:32:38 +01:00
|
|
|
|
#ifdef ENABLE_INFO_COMMAND
|
|
|
|
|
|
VNA_SHELL_FUNCTION(cmd_info)
|
|
|
|
|
|
{
|
|
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
int i = 0;
|
2020-03-08 06:32:38 +01:00
|
|
|
|
while (info_about[i])
|
|
|
|
|
|
shell_printf("%s\r\n", info_about[i++]);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2020-03-12 19:43:35 +01:00
|
|
|
|
#ifdef ENABLE_COLOR_COMMAND
|
|
|
|
|
|
VNA_SHELL_FUNCTION(cmd_color)
|
|
|
|
|
|
{
|
|
|
|
|
|
uint32_t color;
|
|
|
|
|
|
int i;
|
|
|
|
|
|
if (argc != 2) {
|
|
|
|
|
|
shell_printf("usage: color {id} {rgb24}\r\n");
|
|
|
|
|
|
for (i=-3; i < TRACES_MAX; i++) {
|
|
|
|
|
|
#if 0
|
2020-03-21 00:03:09 +01:00
|
|
|
|
switch(i) {
|
2020-03-12 19:43:35 +01:00
|
|
|
|
case -3: color = config.grid_color; break;
|
|
|
|
|
|
case -2: color = config.menu_normal_color; break;
|
|
|
|
|
|
case -1: color = config.menu_active_color; break;
|
|
|
|
|
|
default: color = config.trace_color[i];break;
|
|
|
|
|
|
}
|
|
|
|
|
|
#else
|
|
|
|
|
|
// WARNING!!! Dirty hack for size, depend from config struct
|
|
|
|
|
|
color = config.trace_color[i];
|
|
|
|
|
|
#endif
|
|
|
|
|
|
color = ((color >> 3) & 0x001c00) |
|
|
|
|
|
|
((color >> 5) & 0x0000f8) |
|
|
|
|
|
|
((color << 16) & 0xf80000) |
|
|
|
|
|
|
((color << 13) & 0x00e000);
|
|
|
|
|
|
// color = (color>>8)|(color<<8);
|
|
|
|
|
|
// color = ((color<<8)&0xF80000)|((color<<5)&0x00FC00)|((color<<3)&0x0000F8);
|
|
|
|
|
|
shell_printf(" %d: 0x%06x\r\n", i, color);
|
|
|
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
i = my_atoi(argv[0]);
|
|
|
|
|
|
if (i < -3 && i >= TRACES_MAX)
|
|
|
|
|
|
return;
|
|
|
|
|
|
color = RGBHEX(my_atoui(argv[1]));
|
|
|
|
|
|
#if 0
|
2020-03-21 00:03:09 +01:00
|
|
|
|
switch(i) {
|
2020-03-12 19:43:35 +01:00
|
|
|
|
case -3: config.grid_color = color; break;
|
|
|
|
|
|
case -2: config.menu_normal_color = color; break;
|
|
|
|
|
|
case -1: config.menu_active_color = color; break;
|
|
|
|
|
|
default: config.trace_color[i] = color;break;
|
|
|
|
|
|
}
|
|
|
|
|
|
#else
|
|
|
|
|
|
// WARNING!!! Dirty hack for size, depend from config struct
|
|
|
|
|
|
config.trace_color[i] = color;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
// Redraw all
|
|
|
|
|
|
redraw_request|= REDRAW_AREA;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2020-03-21 14:15:03 +01:00
|
|
|
|
#ifdef ENABLE_I2C_COMMAND
|
|
|
|
|
|
VNA_SHELL_FUNCTION(cmd_i2c){
|
2020-04-29 13:30:22 +02:00
|
|
|
|
if (argc != 3) {
|
|
|
|
|
|
shell_printf("usage: i2c page reg data\r\n");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-03-21 14:15:03 +01:00
|
|
|
|
uint8_t page = my_atoui(argv[0]);
|
|
|
|
|
|
uint8_t reg = my_atoui(argv[1]);
|
|
|
|
|
|
uint8_t data = my_atoui(argv[2]);
|
2020-04-29 13:30:22 +02:00
|
|
|
|
tlv320aic3204_write_reg(page, reg, data);
|
2020-03-21 14:15:03 +01:00
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2020-07-17 16:36:14 +02:00
|
|
|
|
#ifdef ENABLE_LCD_COMMAND
|
|
|
|
|
|
VNA_SHELL_FUNCTION(cmd_lcd){
|
|
|
|
|
|
uint8_t d[VNA_SHELL_MAX_ARGUMENTS];
|
|
|
|
|
|
if (argc == 0) return;
|
|
|
|
|
|
for (int i=0;i<argc;i++)
|
|
|
|
|
|
d[i] = my_atoui(argv[i]);
|
|
|
|
|
|
uint32_t ret = lcd_send_command(d[0], argc-1, &d[1]);
|
|
|
|
|
|
shell_printf("ret = 0x%08X\r\n", ret);
|
|
|
|
|
|
chThdSleepMilliseconds(5);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
#ifdef ENABLE_THREADS_COMMAND
|
|
|
|
|
|
#if CH_CFG_USE_REGISTRY == FALSE
|
|
|
|
|
|
#error "Threads Requite enabled CH_CFG_USE_REGISTRY in chconf.h"
|
|
|
|
|
|
#endif
|
2020-03-21 00:03:09 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_threads)
|
|
|
|
|
|
{
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
static const char *states[] = {CH_STATE_NAMES};
|
|
|
|
|
|
thread_t *tp;
|
2020-02-23 13:45:37 +01:00
|
|
|
|
(void)argc;
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
(void)argv;
|
2020-02-27 18:53:45 +01:00
|
|
|
|
shell_printf("stklimit| stack|stk free| addr|refs|prio| state| name"VNA_SHELL_NEWLINE_STR);
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
tp = chRegFirstThread();
|
|
|
|
|
|
do {
|
2020-02-27 18:53:45 +01:00
|
|
|
|
uint32_t max_stack_use = 0U;
|
|
|
|
|
|
#if (CH_DBG_ENABLE_STACK_CHECK == TRUE) || (CH_CFG_USE_DYNAMIC == TRUE)
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
uint32_t stklimit = (uint32_t)tp->wabase;
|
2020-02-27 18:53:45 +01:00
|
|
|
|
#if CH_DBG_FILL_THREADS == TRUE
|
|
|
|
|
|
uint8_t *p = (uint8_t *)tp->wabase; while(p[max_stack_use]==CH_DBG_STACK_FILL_VALUE) max_stack_use++;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
#else
|
|
|
|
|
|
uint32_t stklimit = 0U;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
shell_printf("%08x|%08x|%08x|%08x|%4u|%4u|%9s|%12s"VNA_SHELL_NEWLINE_STR,
|
|
|
|
|
|
stklimit, (uint32_t)tp->ctx.sp, max_stack_use, (uint32_t)tp,
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
(uint32_t)tp->refs - 1, (uint32_t)tp->prio, states[tp->state],
|
|
|
|
|
|
tp->name == NULL ? "" : tp->name);
|
|
|
|
|
|
tp = chRegNextThread(tp);
|
|
|
|
|
|
} while (tp != NULL);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_help);
|
|
|
|
|
|
|
|
|
|
|
|
#pragma pack(push, 2)
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
typedef struct {
|
|
|
|
|
|
const char *sc_name;
|
|
|
|
|
|
vna_shellcmd_t sc_function;
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
uint16_t flags;
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
} VNAShellCommand;
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
#pragma pack(pop)
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
|
2020-03-12 17:53:58 +01:00
|
|
|
|
// Some commands can executed only in sweep thread, not in main cycle
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
#define CMD_WAIT_MUTEX 1
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
static const VNAShellCommand commands[] =
|
|
|
|
|
|
{
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
{"version" , cmd_version , 0},
|
|
|
|
|
|
{"reset" , cmd_reset , 0},
|
|
|
|
|
|
{"freq" , cmd_freq , CMD_WAIT_MUTEX},
|
2020-03-21 14:15:03 +01:00
|
|
|
|
{"offset" , cmd_offset , CMD_WAIT_MUTEX},
|
2020-03-31 23:36:43 +02:00
|
|
|
|
{"bandwidth" , cmd_bandwidth , 0},
|
2020-06-20 11:07:38 +02:00
|
|
|
|
#ifdef __USE_RTC__
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
{"time" , cmd_time , 0},
|
2020-02-28 16:52:25 +01:00
|
|
|
|
#endif
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
{"dac" , cmd_dac , 0},
|
|
|
|
|
|
{"saveconfig" , cmd_saveconfig , 0},
|
|
|
|
|
|
{"clearconfig" , cmd_clearconfig , 0},
|
|
|
|
|
|
{"data" , cmd_data , CMD_WAIT_MUTEX},
|
2017-01-22 05:05:36 +01:00
|
|
|
|
#ifdef ENABLED_DUMP
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
{"dump" , cmd_dump , 0},
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
#endif
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
{"frequencies" , cmd_frequencies , 0},
|
|
|
|
|
|
{"port" , cmd_port , 0},
|
2020-03-21 14:15:03 +01:00
|
|
|
|
{"stat" , cmd_stat , CMD_WAIT_MUTEX},
|
|
|
|
|
|
{"gain" , cmd_gain , CMD_WAIT_MUTEX},
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
{"power" , cmd_power , 0},
|
|
|
|
|
|
{"sample" , cmd_sample , 0},
|
|
|
|
|
|
// {"gamma" , cmd_gamma , 0},
|
2020-03-12 17:53:58 +01:00
|
|
|
|
{"scan" , cmd_scan , CMD_WAIT_MUTEX},
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
{"sweep" , cmd_sweep , 0},
|
|
|
|
|
|
{"test" , cmd_test , 0},
|
|
|
|
|
|
{"touchcal" , cmd_touchcal , CMD_WAIT_MUTEX},
|
|
|
|
|
|
{"touchtest" , cmd_touchtest , CMD_WAIT_MUTEX},
|
|
|
|
|
|
{"pause" , cmd_pause , 0},
|
|
|
|
|
|
{"resume" , cmd_resume , 0},
|
|
|
|
|
|
{"cal" , cmd_cal , CMD_WAIT_MUTEX},
|
|
|
|
|
|
{"save" , cmd_save , 0},
|
|
|
|
|
|
{"recall" , cmd_recall , CMD_WAIT_MUTEX},
|
|
|
|
|
|
{"trace" , cmd_trace , 0},
|
|
|
|
|
|
{"marker" , cmd_marker , 0},
|
|
|
|
|
|
{"edelay" , cmd_edelay , 0},
|
|
|
|
|
|
{"capture" , cmd_capture , CMD_WAIT_MUTEX},
|
|
|
|
|
|
{"vbat" , cmd_vbat , 0},
|
2020-03-07 21:37:39 +01:00
|
|
|
|
#ifdef ENABLE_VBAT_OFFSET_COMMAND
|
|
|
|
|
|
{"vbat_offset" , cmd_vbat_offset , 0},
|
|
|
|
|
|
#endif
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
{"transform" , cmd_transform , 0},
|
|
|
|
|
|
{"threshold" , cmd_threshold , 0},
|
|
|
|
|
|
{"help" , cmd_help , 0},
|
2020-03-08 06:32:38 +01:00
|
|
|
|
#ifdef ENABLE_INFO_COMMAND
|
|
|
|
|
|
{"info" , cmd_info , 0},
|
|
|
|
|
|
#endif
|
2020-03-12 19:43:35 +01:00
|
|
|
|
#ifdef ENABLE_COLOR_COMMAND
|
|
|
|
|
|
{"color" , cmd_color , 0},
|
|
|
|
|
|
#endif
|
2020-03-21 14:15:03 +01:00
|
|
|
|
#ifdef ENABLE_I2C_COMMAND
|
|
|
|
|
|
{"i2c" , cmd_i2c , CMD_WAIT_MUTEX},
|
|
|
|
|
|
#endif
|
2020-07-17 16:36:14 +02:00
|
|
|
|
#ifdef ENABLE_LCD_COMMAND
|
|
|
|
|
|
{"lcd" , cmd_lcd , CMD_WAIT_MUTEX},
|
|
|
|
|
|
#endif
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
#ifdef ENABLE_THREADS_COMMAND
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
{"threads" , cmd_threads , 0},
|
2017-01-22 05:05:36 +01:00
|
|
|
|
#endif
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
{NULL , NULL , 0}
|
2016-09-05 00:27:44 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
VNA_SHELL_FUNCTION(cmd_help)
|
2016-09-05 00:27:44 +02:00
|
|
|
|
{
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
(void)argc;
|
|
|
|
|
|
(void)argv;
|
|
|
|
|
|
const VNAShellCommand *scp = commands;
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf("Commands:");
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
while (scp->sc_name != NULL) {
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf(" %s", scp->sc_name);
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
scp++;
|
|
|
|
|
|
}
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf(VNA_SHELL_NEWLINE_STR);
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* VNA shell functions
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
// Read command line from shell_stream
|
|
|
|
|
|
//
|
2020-03-21 00:03:09 +01:00
|
|
|
|
static int VNAShell_readLine(char *line, int max_size)
|
|
|
|
|
|
{
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
// Read line from input stream
|
|
|
|
|
|
uint8_t c;
|
|
|
|
|
|
char *ptr = line;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
while (1) {
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
// Return 0 only if stream not active
|
|
|
|
|
|
if (streamRead(shell_stream, &c, 1) == 0)
|
|
|
|
|
|
return 0;
|
2020-02-23 13:45:37 +01:00
|
|
|
|
// Backspace or Delete
|
2020-02-23 00:20:01 +01:00
|
|
|
|
if (c == 8 || c == 0x7f) {
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
if (ptr != line) {
|
2020-03-21 00:03:09 +01:00
|
|
|
|
static const char backspace[] = {0x08, 0x20, 0x08, 0x00};
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf(backspace);
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
ptr--;
|
|
|
|
|
|
}
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
// New line (Enter)
|
|
|
|
|
|
if (c == '\r') {
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf(VNA_SHELL_NEWLINE_STR);
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
*ptr = 0;
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
// Others (skip)
|
|
|
|
|
|
if (c < 0x20)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
// Store
|
|
|
|
|
|
if (ptr < line + max_size - 1) {
|
|
|
|
|
|
streamPut(shell_stream, c); // Echo
|
|
|
|
|
|
*ptr++ = (char)c;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
// Parse and run command line
|
|
|
|
|
|
//
|
2020-03-21 00:03:09 +01:00
|
|
|
|
static void VNAShell_executeLine(char *line)
|
|
|
|
|
|
{
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
// Parse and execute line
|
|
|
|
|
|
char *lp = line, *ep;
|
2020-03-12 17:53:58 +01:00
|
|
|
|
shell_nargs = 0;
|
2020-07-17 16:36:14 +02:00
|
|
|
|
#if 0 // debug console log
|
|
|
|
|
|
ili9341_fill(0, FREQUENCIES_YPOS, LCD_WIDTH, FONT_GET_HEIGHT, DEFAULT_BG_COLOR);
|
|
|
|
|
|
ili9341_drawstring(lp, FREQUENCIES_XPOS1, FREQUENCIES_YPOS);
|
|
|
|
|
|
osalThreadSleepMilliseconds(1000);
|
|
|
|
|
|
#endif
|
2020-03-21 00:03:09 +01:00
|
|
|
|
while (*lp != 0) {
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
// Skipping white space and tabs at string begin.
|
2020-03-21 00:03:09 +01:00
|
|
|
|
while (*lp == ' ' || *lp == '\t') lp++;
|
|
|
|
|
|
// If an argument starts with a double quote then its delimiter is another quote, else
|
|
|
|
|
|
// delimiter is white space.
|
|
|
|
|
|
ep = (*lp == '"') ? strpbrk(++lp, "\"") : strpbrk(lp, " \t");
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
// Store in args string
|
2020-03-21 00:03:09 +01:00
|
|
|
|
shell_args[shell_nargs++] = lp;
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
// Stop, end of input string
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if ((lp = ep) == NULL) break;
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
// Argument limits check
|
2020-03-12 17:53:58 +01:00
|
|
|
|
if (shell_nargs > VNA_SHELL_MAX_ARGUMENTS) {
|
2020-03-21 00:03:09 +01:00
|
|
|
|
shell_printf("too many arguments, max " define_to_STR(
|
|
|
|
|
|
VNA_SHELL_MAX_ARGUMENTS) "" VNA_SHELL_NEWLINE_STR);
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
// Set zero at the end of string and continue check
|
|
|
|
|
|
*lp++ = 0;
|
|
|
|
|
|
}
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if (shell_nargs == 0) return;
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
// Execute line
|
|
|
|
|
|
const VNAShellCommand *scp;
|
2020-03-21 00:03:09 +01:00
|
|
|
|
for (scp = commands; scp->sc_name != NULL; scp++) {
|
2020-03-12 17:53:58 +01:00
|
|
|
|
if (strcmp(scp->sc_name, shell_args[0]) == 0) {
|
2020-03-21 00:03:09 +01:00
|
|
|
|
if (scp->flags & CMD_WAIT_MUTEX) {
|
|
|
|
|
|
shell_function = scp->sc_function;
|
2020-03-12 17:53:58 +01:00
|
|
|
|
// Wait execute command in sweep thread
|
2020-03-21 00:03:09 +01:00
|
|
|
|
do {
|
2020-03-15 12:14:52 +01:00
|
|
|
|
osalThreadSleepMilliseconds(100);
|
2020-03-21 00:03:09 +01:00
|
|
|
|
} while (shell_function);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
scp->sc_function(shell_nargs - 1, &shell_args[1]);
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
}
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-03-21 00:03:09 +01:00
|
|
|
|
shell_printf("%s?" VNA_SHELL_NEWLINE_STR, shell_args[0]);
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef VNA_SHELL_THREAD
|
|
|
|
|
|
static THD_WORKING_AREA(waThread2, /* cmd_* max stack size + alpha */442);
|
2020-03-21 00:03:09 +01:00
|
|
|
|
THD_FUNCTION(myshellThread, p)
|
|
|
|
|
|
{
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
(void)p;
|
|
|
|
|
|
chRegSetThreadName("shell");
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf(VNA_SHELL_NEWLINE_STR"NanoVNA Shell"VNA_SHELL_NEWLINE_STR);
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
while (true) {
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf(VNA_SHELL_PROMPT_STR);
|
2020-02-23 13:45:37 +01:00
|
|
|
|
if (VNAShell_readLine(shell_line, VNA_SHELL_MAX_LENGTH))
|
|
|
|
|
|
VNAShell_executeLine(shell_line);
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
else // Putting a delay in order to avoid an endless loop trying to read an unavailable stream.
|
|
|
|
|
|
osalThreadSleepMilliseconds(100);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
2016-09-05 00:27:44 +02:00
|
|
|
|
|
2020-03-05 20:36:44 +01:00
|
|
|
|
// I2C clock bus setting: depend from STM32_I2C1SW in mcuconf.h
|
2017-01-01 12:03:21 +01:00
|
|
|
|
static const I2CConfig i2ccfg = {
|
2020-03-07 12:54:51 +01:00
|
|
|
|
.timingr = // TIMINGR register initialization. (use I2C timing configuration tool for STM32F3xx and STM32F0xx microcontrollers (AN4235))
|
|
|
|
|
|
#if STM32_I2C1SW == STM32_I2C1SW_HSI
|
|
|
|
|
|
// STM32_I2C1SW == STM32_I2C1SW_HSI (HSI=8MHz)
|
|
|
|
|
|
// 400kHz @ HSI 8MHz (Use 26.4.10 I2C_TIMINGR register configuration examples from STM32 RM0091 Reference manual)
|
2020-03-05 20:36:44 +01:00
|
|
|
|
STM32_TIMINGR_PRESC(0U) |
|
|
|
|
|
|
STM32_TIMINGR_SCLDEL(3U) | STM32_TIMINGR_SDADEL(1U) |
|
|
|
|
|
|
STM32_TIMINGR_SCLH(3U) | STM32_TIMINGR_SCLL(9U),
|
2020-03-07 12:54:51 +01:00
|
|
|
|
// Old values voodoo magic 400kHz @ HSI 8MHz
|
|
|
|
|
|
//0x00300506,
|
|
|
|
|
|
#elif STM32_I2C1SW == STM32_I2C1SW_SYSCLK
|
|
|
|
|
|
// STM32_I2C1SW == STM32_I2C1SW_SYSCLK (SYSCLK = 48MHz)
|
|
|
|
|
|
// 400kHz @ SYSCLK 48MHz (Use 26.4.10 I2C_TIMINGR register configuration examples from STM32 RM0091 Reference manual)
|
2020-03-21 14:15:03 +01:00
|
|
|
|
// STM32_TIMINGR_PRESC(5U) |
|
|
|
|
|
|
// STM32_TIMINGR_SCLDEL(3U) | STM32_TIMINGR_SDADEL(3U) |
|
|
|
|
|
|
// STM32_TIMINGR_SCLH(3U) | STM32_TIMINGR_SCLL(9U),
|
2020-03-08 20:48:36 +01:00
|
|
|
|
// 600kHz @ SYSCLK 48MHz, manually get values, x1.5 I2C speed, but need calc timings
|
2020-03-21 14:15:03 +01:00
|
|
|
|
STM32_TIMINGR_PRESC(3U) |
|
|
|
|
|
|
STM32_TIMINGR_SCLDEL(2U) | STM32_TIMINGR_SDADEL(2U) |
|
|
|
|
|
|
STM32_TIMINGR_SCLH(4U) | STM32_TIMINGR_SCLL(4U),
|
2020-03-07 12:54:51 +01:00
|
|
|
|
#else
|
|
|
|
|
|
#error "Need Define STM32_I2C1SW and set correct TIMINGR settings"
|
|
|
|
|
|
#endif
|
|
|
|
|
|
.cr1 = 0, // CR1 register initialization.
|
|
|
|
|
|
.cr2 = 0 // CR2 register initialization.
|
2017-01-01 12:03:21 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
2017-01-02 14:03:20 +01:00
|
|
|
|
static DACConfig dac1cfg1 = {
|
2017-01-01 12:03:21 +01:00
|
|
|
|
//init: 2047U,
|
|
|
|
|
|
init: 1922U,
|
|
|
|
|
|
datamode: DAC_DHRM_12BIT_RIGHT
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2020-02-27 18:53:45 +01:00
|
|
|
|
|
|
|
|
|
|
// Main thread stack size defined in makefile USE_PROCESS_STACKSIZE = 0x200
|
|
|
|
|
|
// Profile stack usage (enable threads command by def ENABLE_THREADS_COMMAND) show:
|
|
|
|
|
|
// Stack maximum usage = 472 bytes (need test more and run all commands), free stack = 40 bytes
|
|
|
|
|
|
//
|
2016-09-05 00:27:44 +02:00
|
|
|
|
int main(void)
|
|
|
|
|
|
{
|
2020-02-27 18:53:45 +01:00
|
|
|
|
halInit();
|
|
|
|
|
|
chSysInit();
|
2020-06-20 11:07:38 +02:00
|
|
|
|
#ifdef __USE_RTC__
|
|
|
|
|
|
rtc_init(); // Initialize RTC library
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2020-04-29 13:30:22 +02:00
|
|
|
|
#ifdef USE_VARIABLE_OFFSET
|
|
|
|
|
|
generate_DSP_Table(FREQUENCY_OFFSET);
|
|
|
|
|
|
#endif
|
2020-02-27 18:53:45 +01:00
|
|
|
|
//palSetPadMode(GPIOB, 8, PAL_MODE_ALTERNATE(1) | PAL_STM32_OTYPE_OPENDRAIN);
|
|
|
|
|
|
//palSetPadMode(GPIOB, 9, PAL_MODE_ALTERNATE(1) | PAL_STM32_OTYPE_OPENDRAIN);
|
|
|
|
|
|
i2cStart(&I2CD1, &i2ccfg);
|
|
|
|
|
|
si5351_init();
|
|
|
|
|
|
|
|
|
|
|
|
// MCO on PA8
|
|
|
|
|
|
//palSetPadMode(GPIOA, 8, PAL_MODE_ALTERNATE(0));
|
|
|
|
|
|
/*
|
|
|
|
|
|
* Initializes a serial-over-USB CDC driver.
|
|
|
|
|
|
*/
|
|
|
|
|
|
sduObjectInit(&SDU1);
|
|
|
|
|
|
sduStart(&SDU1, &serusbcfg);
|
|
|
|
|
|
/*
|
|
|
|
|
|
* Activates the USB driver and then the USB bus pull-up on D+.
|
|
|
|
|
|
* Note, a delay is inserted in order to not have to disconnect the cable
|
|
|
|
|
|
* after a reset.
|
|
|
|
|
|
*/
|
|
|
|
|
|
usbDisconnectBus(serusbcfg.usbp);
|
|
|
|
|
|
chThdSleepMilliseconds(100);
|
|
|
|
|
|
usbStart(serusbcfg.usbp, &usbcfg);
|
|
|
|
|
|
usbConnectBus(serusbcfg.usbp);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* SPI LCD Initialize
|
|
|
|
|
|
*/
|
|
|
|
|
|
ili9341_init();
|
2016-10-28 13:50:51 +02:00
|
|
|
|
|
2020-02-27 18:53:45 +01:00
|
|
|
|
/* restore config */
|
2017-01-02 14:03:20 +01:00
|
|
|
|
config_recall();
|
2020-02-28 21:15:38 +01:00
|
|
|
|
/* restore frequencies and calibration 0 slot properties from flash memory */
|
2020-04-29 13:23:59 +02:00
|
|
|
|
load_properties(0);
|
2017-01-02 14:03:20 +01:00
|
|
|
|
|
|
|
|
|
|
dac1cfg1.init = config.dac_value;
|
2020-02-27 18:53:45 +01:00
|
|
|
|
/*
|
|
|
|
|
|
* Starting DAC1 driver, setting up the output pin as analog as suggested
|
|
|
|
|
|
* by the Reference Manual.
|
|
|
|
|
|
*/
|
2017-01-02 14:03:20 +01:00
|
|
|
|
dacStart(&DACD2, &dac1cfg1);
|
|
|
|
|
|
|
2017-09-15 15:13:17 +02:00
|
|
|
|
|
2020-02-27 18:53:45 +01:00
|
|
|
|
/*
|
|
|
|
|
|
* I2S Initialize
|
|
|
|
|
|
*/
|
2016-09-05 00:27:44 +02:00
|
|
|
|
tlv320aic3204_init();
|
|
|
|
|
|
i2sInit();
|
|
|
|
|
|
i2sObjectInit(&I2SD2);
|
|
|
|
|
|
i2sStart(&I2SD2, &i2sconfig);
|
|
|
|
|
|
i2sStartExchange(&I2SD2);
|
|
|
|
|
|
|
2016-11-03 13:56:56 +01:00
|
|
|
|
ui_init();
|
2020-02-27 18:53:45 +01:00
|
|
|
|
//Initialize graph plotting
|
|
|
|
|
|
plot_init();
|
|
|
|
|
|
redraw_frame();
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO-1, Thread1, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
|
|
if (SDU1.config->usbp->state == USB_ACTIVE) {
|
|
|
|
|
|
#ifdef VNA_SHELL_THREAD
|
2020-02-27 18:53:45 +01:00
|
|
|
|
#if CH_CFG_USE_WAITEXIT == FALSE
|
|
|
|
|
|
#error "VNA_SHELL_THREAD use chThdWait, need enable CH_CFG_USE_WAITEXIT in chconf.h"
|
|
|
|
|
|
#endif
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
thread_t *shelltp = chThdCreateStatic(waThread2, sizeof(waThread2),
|
|
|
|
|
|
NORMALPRIO + 1,
|
|
|
|
|
|
myshellThread, NULL);
|
|
|
|
|
|
chThdWait(shelltp);
|
|
|
|
|
|
#else
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf(VNA_SHELL_NEWLINE_STR"NanoVNA Shell"VNA_SHELL_NEWLINE_STR);
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
do {
|
Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 20:47:52 +01:00
|
|
|
|
shell_printf(VNA_SHELL_PROMPT_STR);
|
2020-02-23 13:45:37 +01:00
|
|
|
|
if (VNAShell_readLine(shell_line, VNA_SHELL_MAX_LENGTH))
|
|
|
|
|
|
VNAShell_executeLine(shell_line);
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
else
|
|
|
|
|
|
chThdSleepMilliseconds(200);
|
|
|
|
|
|
} while (SDU1.config->usbp->state == USB_ACTIVE);
|
|
|
|
|
|
#endif
|
2016-09-05 00:27:44 +02:00
|
|
|
|
}
|
Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix
main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
(possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)
Replace some hardcoded values
MARKERS_MAX
SAVEAREA_MAX
TRACES_MAX
plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe
ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols
All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value
Fix printf on print HEX values
2020-02-22 08:50:54 +01:00
|
|
|
|
chThdSleepMilliseconds(1000);
|
|
|
|
|
|
}
|
2016-09-05 00:27:44 +02:00
|
|
|
|
}
|
2017-01-22 05:03:40 +01:00
|
|
|
|
|
|
|
|
|
|
/* The prototype shows it is a naked function - in effect this is just an
|
|
|
|
|
|
assembly function. */
|
2020-03-21 00:03:09 +01:00
|
|
|
|
void HardFault_Handler(void);
|
2017-01-22 05:03:40 +01:00
|
|
|
|
|
2020-03-21 00:03:09 +01:00
|
|
|
|
void hard_fault_handler_c(uint32_t *sp) __attribute__((naked));
|
2017-01-22 05:03:40 +01:00
|
|
|
|
|
|
|
|
|
|
void HardFault_Handler(void)
|
|
|
|
|
|
{
|
2020-03-21 00:03:09 +01:00
|
|
|
|
uint32_t *sp;
|
2017-01-22 05:03:40 +01:00
|
|
|
|
//__asm volatile ("mrs %0, msp \n\t": "=r" (sp) );
|
2020-03-21 00:03:09 +01:00
|
|
|
|
__asm volatile("mrs %0, psp \n\t" : "=r"(sp));
|
2017-01-22 05:03:40 +01:00
|
|
|
|
hard_fault_handler_c(sp);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-03-21 00:03:09 +01:00
|
|
|
|
void hard_fault_handler_c(uint32_t *sp)
|
2017-01-22 05:03:40 +01:00
|
|
|
|
{
|
2020-06-20 11:12:38 +02:00
|
|
|
|
#if 0
|
|
|
|
|
|
uint32_t r0 = sp[0];
|
|
|
|
|
|
uint32_t r1 = sp[1];
|
|
|
|
|
|
uint32_t r2 = sp[2];
|
|
|
|
|
|
uint32_t r3 = sp[3];
|
|
|
|
|
|
register uint32_t r4 __asm("r4");
|
|
|
|
|
|
register uint32_t r5 __asm("r5");
|
|
|
|
|
|
register uint32_t r6 __asm("r6");
|
|
|
|
|
|
register uint32_t r7 __asm("r7");
|
|
|
|
|
|
register uint32_t r8 __asm("r8");
|
|
|
|
|
|
register uint32_t r9 __asm("r9");
|
|
|
|
|
|
register uint32_t r10 __asm("r10");
|
|
|
|
|
|
register uint32_t r11 __asm("r11");
|
|
|
|
|
|
uint32_t r12 = sp[4];
|
|
|
|
|
|
uint32_t lr = sp[5];
|
|
|
|
|
|
uint32_t pc = sp[6];
|
|
|
|
|
|
uint32_t psr = sp[7];
|
|
|
|
|
|
int y = 0;
|
|
|
|
|
|
int x = 20;
|
|
|
|
|
|
char buf[16];
|
|
|
|
|
|
ili9341_set_background(0x0000);
|
|
|
|
|
|
ili9341_set_foreground(0xFFFF);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "SP 0x%08x", (uint32_t)sp);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "R0 0x%08x", r0);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "R1 0x%08x", r1);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "R2 0x%08x", r2);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "R3 0x%08x", r3);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "R4 0x%08x", r4);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "R5 0x%08x", r5);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "R6 0x%08x", r6);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "R7 0x%08x", r7);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "R8 0x%08x", r8);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "R9 0x%08x", r9);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "R10 0x%08x", r10);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "R11 0x%08x", r11);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "R12 0x%08x", r12);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "LR 0x%08x", lr);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "PC 0x%08x", pc);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
plot_printf(buf, sizeof(buf), "PSR 0x%08x", psr);ili9341_drawstring(buf, x, y+=FONT_STR_HEIGHT);
|
|
|
|
|
|
|
|
|
|
|
|
shell_printf("===================================\r\n");
|
|
|
|
|
|
#else
|
2019-10-06 00:56:25 +02:00
|
|
|
|
(void)sp;
|
2020-06-20 11:12:38 +02:00
|
|
|
|
#endif
|
2020-03-21 00:03:09 +01:00
|
|
|
|
while (true) {
|
|
|
|
|
|
}
|
2017-01-22 05:03:40 +01:00
|
|
|
|
}
|