Skip to content

Commit

Permalink
COMM: updated help
Browse files Browse the repository at this point in the history
  • Loading branch information
thegabriele97 committed Dec 21, 2021
1 parent 09f32e0 commit 9155ab4
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/comm.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@

#define STR_PROMPT "\nthor@cnt++ > "
#define STR_NOTFOUND "\r\nCOMMAND NOT FOUND!\r\n"
#define STR_HELP "\r\n\
The following commands are available:\r\n\
set_time : Set the system date and time. Usage: set_time dd/mm/yyyy hh/mm/ss\r\n\
set : Set the threshold for people count. Usage: set <N>\r\n\
get : Retrieves the log of the system. Usage: <use external script to decode>\r\n\
help : Shows this help. Usage: help\r\n"


static struct COMM_Handle *phcomm;
static uint8_t buf[0x160];
static uint8_t buf[0x200];
static uint8_t send_etx = 0;
static uint8_t buf_cnt = 0;
static volatile uint32_t setValue = 0;
Expand Down Expand Up @@ -108,15 +115,9 @@ static void rxCpltCback(UART_HandleTypeDef *huart) {
len = -4;

} else if (!strncmp((char *)buf, "help", 0x4)) {

len = sprintf((char *)buf, "\r\nThe following commands are available:\r\n");
len += sprintf((char *)buf + len, "\t%14s:\tSet the system date and time\r\n", "set_time");
len += sprintf((char *)buf + len, "\t%14s:\tSet the threshold for people count\r\n", "set");
len += sprintf((char *)buf + len, "\t%14s:\tRetrieves the log of the system. Needs external script to decode the output\r\n", "get");
len += sprintf((char *)buf + len, "\t%14s:\tShows this help\r\n", "help");
strcpy((char *)buf, STR_HELP);
len = sizeof(STR_HELP) - 3;
buf_cnt = 0;
// len -= sizeof(STR_PROMPT);

} else if (buf_cnt) {
strcpy((char *)buf, STR_NOTFOUND);
len = sizeof(STR_NOTFOUND) - 3;
Expand Down

0 comments on commit 9155ab4

Please sign in to comment.