New Feature:Add keys untreated counter

This commit is contained in:
hqm 2021-09-14 18:11:49 +08:00
parent 203f233923
commit dab8f76f3f
2 changed files with 17 additions and 1 deletions

View File

@ -60,7 +60,16 @@ static void xcmd_key_match(xcmder_t *cmder, XCMD_KEY_T key)
{
if(p->key == key)
{
p->func(cmder);
if(p->func(cmder) < 0)
{
cmder->key_list.untreated.key = key;
cmder->key_list.untreated.count++;
}
else
{
cmder->key_list.untreated.key = 0;
cmder->key_list.untreated.count = 0;
}
break;
}
p = p->next;
@ -476,6 +485,8 @@ xcmder_t *xcmd_create( int (*get_c)(uint8_t*), int (*put_c)(uint8_t), uint16_t c
cmder->cmd_list.len = 0;
cmder->cmd_list.next = NULL;
cmder->key_list.untreated.key = 0;
cmder->key_list.untreated.count = 0;
}
else
{

View File

@ -103,6 +103,11 @@ typedef struct
{
uint16_t len;
xcmd_key_t *next;
struct
{
XCMD_KEY_T key;
uint16_t count;
}untreated;
}key_list;