mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
Implement info command, move info_about[] to main.c
Command enabled by default: ENABLE_INFO_COMMAND This feature not increase flash size
This commit is contained in:
parent
fc6e090595
commit
45f04420cb
32
main.c
32
main.c
|
|
@ -58,6 +58,7 @@ static char shell_line[VNA_SHELL_MAX_LENGTH];
|
||||||
//#define ENABLE_THREADS_COMMAND
|
//#define ENABLE_THREADS_COMMAND
|
||||||
//#define ENABLE_TIME_COMMAND
|
//#define ENABLE_TIME_COMMAND
|
||||||
#define ENABLE_VBAT_OFFSET_COMMAND
|
#define ENABLE_VBAT_OFFSET_COMMAND
|
||||||
|
#define ENABLE_INFO_COMMAND
|
||||||
|
|
||||||
static void apply_error_term_at(int i);
|
static void apply_error_term_at(int i);
|
||||||
static void apply_edelay_at(int i);
|
static void apply_edelay_at(int i);
|
||||||
|
|
@ -82,6 +83,21 @@ static int8_t drive_strength = DRIVE_STRENGTH_AUTO;
|
||||||
int8_t sweep_mode = SWEEP_ENABLE;
|
int8_t sweep_mode = SWEEP_ENABLE;
|
||||||
volatile uint8_t redraw_request = 0; // contains REDRAW_XXX flags
|
volatile uint8_t redraw_request = 0; // contains REDRAW_XXX flags
|
||||||
|
|
||||||
|
// Version text, displayed in Config->Version menu, also send by info command
|
||||||
|
const char *info_about[]={
|
||||||
|
BOARD_NAME,
|
||||||
|
"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
|
||||||
|
};
|
||||||
|
|
||||||
static THD_WORKING_AREA(waThread1, 640);
|
static THD_WORKING_AREA(waThread1, 640);
|
||||||
static THD_FUNCTION(Thread1, arg)
|
static THD_FUNCTION(Thread1, arg)
|
||||||
{
|
{
|
||||||
|
|
@ -1949,6 +1965,17 @@ VNA_SHELL_FUNCTION(cmd_vbat_offset)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_INFO_COMMAND
|
||||||
|
VNA_SHELL_FUNCTION(cmd_info)
|
||||||
|
{
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
int i=0;
|
||||||
|
while (info_about[i])
|
||||||
|
shell_printf("%s\r\n", info_about[i++]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_THREADS_COMMAND
|
#ifdef ENABLE_THREADS_COMMAND
|
||||||
#if CH_CFG_USE_REGISTRY == FALSE
|
#if CH_CFG_USE_REGISTRY == FALSE
|
||||||
#error "Threads Requite enabled CH_CFG_USE_REGISTRY in chconf.h"
|
#error "Threads Requite enabled CH_CFG_USE_REGISTRY in chconf.h"
|
||||||
|
|
@ -1970,8 +1997,6 @@ VNA_SHELL_FUNCTION(cmd_threads) {
|
||||||
#else
|
#else
|
||||||
uint32_t stklimit = 0U;
|
uint32_t stklimit = 0U;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
shell_printf("%08x|%08x|%08x|%08x|%4u|%4u|%9s|%12s"VNA_SHELL_NEWLINE_STR,
|
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,
|
stklimit, (uint32_t)tp->ctx.sp, max_stack_use, (uint32_t)tp,
|
||||||
(uint32_t)tp->refs - 1, (uint32_t)tp->prio, states[tp->state],
|
(uint32_t)tp->refs - 1, (uint32_t)tp->prio, states[tp->state],
|
||||||
|
|
@ -2038,6 +2063,9 @@ static const VNAShellCommand commands[] =
|
||||||
{"transform" , cmd_transform , 0},
|
{"transform" , cmd_transform , 0},
|
||||||
{"threshold" , cmd_threshold , 0},
|
{"threshold" , cmd_threshold , 0},
|
||||||
{"help" , cmd_help , 0},
|
{"help" , cmd_help , 0},
|
||||||
|
#ifdef ENABLE_INFO_COMMAND
|
||||||
|
{"info" , cmd_info , 0},
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_THREADS_COMMAND
|
#ifdef ENABLE_THREADS_COMMAND
|
||||||
{"threads" , cmd_threads , 0},
|
{"threads" , cmd_threads , 0},
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ void loadDefaultProps(void);
|
||||||
#define SWEEP_ENABLE 0x01
|
#define SWEEP_ENABLE 0x01
|
||||||
#define SWEEP_ONCE 0x02
|
#define SWEEP_ONCE 0x02
|
||||||
extern int8_t sweep_mode;
|
extern int8_t sweep_mode;
|
||||||
|
extern const char *info_about[];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* dsp.c
|
* dsp.c
|
||||||
|
|
|
||||||
23
ui.c
23
ui.c
|
|
@ -367,30 +367,21 @@ touch_position(int *x, int *y)
|
||||||
*y = (last_touch_y - config.touch_cal[1]) * 16 / config.touch_cal[3];
|
*y = (last_touch_y - config.touch_cal[1]) * 16 / config.touch_cal[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
show_version(void)
|
show_version(void)
|
||||||
{
|
{
|
||||||
int x = 5, y = 5;
|
int x = 5, y = 5, i = 0;
|
||||||
adc_stop();
|
adc_stop();
|
||||||
setForegroundColor(DEFAULT_FG_COLOR);
|
setForegroundColor(DEFAULT_FG_COLOR);
|
||||||
setBackgroundColor(DEFAULT_BG_COLOR);
|
setBackgroundColor(DEFAULT_BG_COLOR);
|
||||||
|
|
||||||
clearScreen();
|
clearScreen();
|
||||||
ili9341_drawstring_size(BOARD_NAME, x, y, 4);
|
uint16_t shift = 0b0000010000111110;
|
||||||
y += 25;
|
ili9341_drawstring_size(info_about[i++], x , y, 4);
|
||||||
|
while (info_about[i]){
|
||||||
ili9341_drawstring("2016-2020 Copyright @edy555", x, y += 10);
|
do {shift>>=1; y+=5;} while (shift&1);
|
||||||
ili9341_drawstring("Licensed under GPL. See: https://github.com/ttrftech/NanoVNA", x, y += 10);
|
ili9341_drawstring(info_about[i++], x, y+=5);
|
||||||
ili9341_drawstring("Version: " VERSION, x, y += 10);
|
}
|
||||||
ili9341_drawstring("Build Time: " __DATE__ " - " __TIME__, x, y += 10);
|
|
||||||
y += 5;
|
|
||||||
ili9341_drawstring("Kernel: " CH_KERNEL_VERSION, x, y += 10);
|
|
||||||
ili9341_drawstring("Compiler: " PORT_COMPILER_NAME, x, y += 10);
|
|
||||||
ili9341_drawstring("Architecture: " PORT_ARCHITECTURE_NAME " Core Variant: " PORT_CORE_VARIANT_NAME, x, y += 10);
|
|
||||||
ili9341_drawstring("Port Info: " PORT_INFO, x, y += 10);
|
|
||||||
ili9341_drawstring("Platform: " PLATFORM_NAME, x, y += 10);
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (touch_check() == EVT_TOUCH_PRESSED)
|
if (touch_check() == EVT_TOUCH_PRESSED)
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue