mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
feat: add version command
This commit is contained in:
parent
b823a8060d
commit
53d07e8c12
7
Makefile
7
Makefile
|
|
@ -53,6 +53,11 @@ endif
|
||||||
# Build global options
|
# Build global options
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
ifeq ($(VERSION),)
|
||||||
|
#VERSION="unknown"
|
||||||
|
VERSION="$(shell git describe --tags)"
|
||||||
|
endif
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Architecture or project specific options
|
# Architecture or project specific options
|
||||||
#
|
#
|
||||||
|
|
@ -200,7 +205,7 @@ CPPWARN = -Wall -Wextra -Wundef
|
||||||
#
|
#
|
||||||
|
|
||||||
# List all user C define here, like -D_DEBUG=1
|
# List all user C define here, like -D_DEBUG=1
|
||||||
UDEFS = -DSHELL_CMD_TEST_ENABLED=FALSE -DSHELL_CMD_MEM_ENABLED=FALSE -DARM_MATH_CM0
|
UDEFS = -DSHELL_CMD_TEST_ENABLED=FALSE -DSHELL_CMD_MEM_ENABLED=FALSE -DARM_MATH_CM0 -DVERSION=\"$(VERSION)\"
|
||||||
|
|
||||||
# Define ASM defines here
|
# Define ASM defines here
|
||||||
UADEFS =
|
UADEFS =
|
||||||
|
|
|
||||||
11
main.c
11
main.c
|
|
@ -1663,14 +1663,23 @@ static void cmd_stat(BaseSequentialStream *chp, int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef VERSION
|
||||||
|
#define VERSION "unknown"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void cmd_version(BaseSequentialStream *chp, int argc, char *argv[])
|
||||||
|
{
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
chprintf(chp, VERSION "\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(256)
|
#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(256)
|
||||||
static THD_WORKING_AREA(waThread2, SHELL_WA_SIZE);
|
static THD_WORKING_AREA(waThread2, SHELL_WA_SIZE);
|
||||||
|
|
||||||
static const ShellCommand commands[] =
|
static const ShellCommand commands[] =
|
||||||
{
|
{
|
||||||
|
{ "version", cmd_version },
|
||||||
{ "reset", cmd_reset },
|
{ "reset", cmd_reset },
|
||||||
{ "freq", cmd_freq },
|
{ "freq", cmd_freq },
|
||||||
{ "offset", cmd_offset },
|
{ "offset", cmd_offset },
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue