Fixed bug of password screen.
This commit is contained in:
parent
7f2b5dfcc0
commit
d8c26975bd
|
@ -1,6 +1,7 @@
|
||||||
#include "PrjInc.h"
|
#include "PrjInc.h"
|
||||||
#include "UIFlowLVGL/UIFlowLVGL.h"
|
#include "UIFlowLVGL/UIFlowLVGL.h"
|
||||||
#include "UIFlowLVGL/UIFlowWrnMsg/UIFlowWrnMsgAPI.h"
|
#include "UIFlowLVGL/UIFlowWrnMsg/UIFlowWrnMsgAPI.h"
|
||||||
|
#include "UIFlowLVGL_SPORTCAM.h"
|
||||||
#include "sf_mcu.h"
|
#include "sf_mcu.h"
|
||||||
#include "sf_common.h"
|
#include "sf_common.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -32,6 +33,8 @@ static const char* PasswordMap[7] =
|
||||||
};
|
};
|
||||||
#define LONG_PRESS_INTERVAL 500
|
#define LONG_PRESS_INTERVAL 500
|
||||||
static unsigned long KeyRightPressingTimeMs = 0;
|
static unsigned long KeyRightPressingTimeMs = 0;
|
||||||
|
static unsigned long KeyUpPressingTimeMs = 0;
|
||||||
|
static unsigned long KeyDownPressingTimeMs = 0;
|
||||||
|
|
||||||
static lv_group_t* gp = NULL;
|
static lv_group_t* gp = NULL;
|
||||||
static void set_indev_keypad_group(lv_obj_t* obj)
|
static void set_indev_keypad_group(lv_obj_t* obj)
|
||||||
|
@ -228,6 +231,11 @@ static void UIFlowPassword_Key(lv_obj_t* obj, uint32_t key)
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case LV_USER_KEY_NEXT:
|
case LV_USER_KEY_NEXT:
|
||||||
|
if (KeyDownPressingTimeMs >= LONG_PRESS_INTERVAL)
|
||||||
|
{
|
||||||
|
KeyDownPressingTimeMs = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
printf("\033[33m[UIFlowPassword_Key]s\033[0m\n");
|
printf("\033[33m[UIFlowPassword_Key]s\033[0m\n");
|
||||||
if(PasswordIndex >= 0 && PasswordIndex <= 5)
|
if(PasswordIndex >= 0 && PasswordIndex <= 5)
|
||||||
{
|
{
|
||||||
|
@ -236,6 +244,11 @@ static void UIFlowPassword_Key(lv_obj_t* obj, uint32_t key)
|
||||||
update_Password_msg(obj);
|
update_Password_msg(obj);
|
||||||
break;
|
break;
|
||||||
case LV_USER_KEY_PREV:
|
case LV_USER_KEY_PREV:
|
||||||
|
if (KeyUpPressingTimeMs >= LONG_PRESS_INTERVAL)
|
||||||
|
{
|
||||||
|
KeyUpPressingTimeMs = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
printf("\033[33m[UIFlowPassword_Key]w\033[0m\n");
|
printf("\033[33m[UIFlowPassword_Key]w\033[0m\n");
|
||||||
if(PasswordIndex >= 0 && PasswordIndex <= 5)
|
if(PasswordIndex >= 0 && PasswordIndex <= 5)
|
||||||
{
|
{
|
||||||
|
@ -313,6 +326,32 @@ void UIFlowPassword_KeyLongPress(lv_obj_t* obj, uint32_t key)
|
||||||
printf("Super password is wrong.\n");
|
printf("Super password is wrong.\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case LV_USER_KEY_NEXT:
|
||||||
|
{
|
||||||
|
KeyDownPressingTimeMs += LONG_PRESS_INTERVAL;
|
||||||
|
if (KeyDownPressingTimeMs % 1000 == 0)
|
||||||
|
{
|
||||||
|
if(PasswordIndex >= 0 && PasswordIndex <= 5)
|
||||||
|
{
|
||||||
|
PwdStr[PasswordIndex] = (PwdStr[PasswordIndex] - '0' + 10 - 1) % 10 + '0';
|
||||||
|
}
|
||||||
|
update_Password_msg(obj);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LV_USER_KEY_PREV:
|
||||||
|
{
|
||||||
|
KeyUpPressingTimeMs += LONG_PRESS_INTERVAL;
|
||||||
|
if (KeyUpPressingTimeMs % 1000 == 0)
|
||||||
|
{
|
||||||
|
if(PasswordIndex >= 0 && PasswordIndex <= 5)
|
||||||
|
{
|
||||||
|
PwdStr[PasswordIndex] = (PwdStr[PasswordIndex] - '0' + 1) % 10 + '0';
|
||||||
|
}
|
||||||
|
update_Password_msg(obj);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user