Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 94b053d

Browse files
authoredOct 24, 2021
Merge pull request #267 from Tinyu-Zhao/master
fix some error
2 parents cd7915f + a4e71e7 commit 94b053d

File tree

4 files changed

+724
-432
lines changed

4 files changed

+724
-432
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,92 @@
1-
/*
2-
*******************************************************************************
3-
* Copyright (c) 2021 by M5Stack
4-
* Equipped with M5Core sample source code
5-
* 配套 M5Core 示例源代码
6-
* Visit the website for more information:https://docs.m5stack.com/en/unit/finger
7-
* 获取更多资料请访问:https://docs.m5stack.com/zh_CN/unit/finger
8-
*
9-
* describe: Finger.
10-
* date:2021/8/26
11-
*******************************************************************************
12-
*/
131
#include <M5Stack.h>
14-
#include "M5_FPC1020A.h"
2+
#include "finger.h"
153

164
uint8_t userNum; //User number
175
FingerPrint FP_M;
186

197
void CleanScreen()
208
{
21-
M5.Lcd.fillRect(0,50,400,300,BLACK);
22-
M5.Lcd.setCursor(0, 50);
23-
M5.Lcd.setTextSize(2);
24-
userNum = FP_M.fpm_getUserNum(); //Get users Numbers. 获取用户数量
25-
M5.Lcd.print("userNum:");
26-
M5.Lcd.println(userNum);
9+
M5.Lcd.setTextColor(WHITE);
10+
M5.Lcd.fillRect(0,50,400,300,BLACK);
11+
M5.Lcd.setCursor(0, 50);
12+
M5.Lcd.setTextSize(2);
13+
userNum = FP_M.fpm_getUserNum();
14+
M5.Lcd.print("userNum:");
15+
M5.Lcd.println(userNum);
2716
}
2817

2918
void setup() {
30-
M5.begin();
31-
M5.Power.begin();
32-
Serial.begin(115200);
33-
Serial2.begin(19200, SERIAL_8N1, 16, 17);
34-
M5.Lcd.clear(BLACK);
35-
M5.Lcd.setTextColor(YELLOW);
36-
M5.Lcd.setTextSize(3);
37-
M5.Lcd.setCursor(20, 0);
38-
M5.Lcd.println("Finger example");
39-
M5.Lcd.setTextColor(WHITE);
40-
M5.Lcd.fillRect(0,50,400,300,BLACK);
41-
M5.Lcd.setCursor(0, 50);
42-
M5.Lcd.setTextSize(2);
43-
userNum = FP_M.fpm_getUserNum();
44-
M5.Lcd.print("userNum:");
45-
M5.Lcd.println(userNum);
19+
M5.begin();
20+
M5.Power.begin();
21+
Serial.begin(115200);
22+
Serial2.begin(19200, SERIAL_8N1, 16, 17);
23+
M5.Lcd.clear(BLACK);
24+
M5.Lcd.setTextColor(YELLOW);
25+
M5.Lcd.setTextFont(2);
26+
M5.Lcd.setTextSize(3);
27+
M5.Lcd.setCursor(20, 0);
28+
M5.Lcd.println("Finger example");
29+
Serial.printf("Finger example\n");
30+
M5.Lcd.setTextColor(WHITE);
31+
M5.Lcd.fillRect(0,50,400,300,BLACK);
32+
M5.Lcd.setCursor(0, 50);
33+
M5.Lcd.setTextSize(2);
34+
userNum = FP_M.fpm_getUserNum();
35+
M5.Lcd.print("userNum:");
36+
M5.Lcd.println(userNum);
4637
}
4738

39+
//ButtonA: Add user
40+
//ButtonB: Matching
41+
//ButtonC: Delete All User
4842
void loop(){
49-
M5.update();
50-
uint8_t res1;
51-
//ButtonA: Add user. 添加用户
52-
if(M5.BtnA.wasPressed()){
53-
CleanScreen();
54-
M5.Lcd.println("Fingerprint Typing");
55-
56-
res1 = FP_M.fpm_addUser(userNum,1);
57-
if(res1 == ACK_SUCCESS){
58-
M5.Lcd.println("Success");
59-
}
60-
else if(res1 == ACK_FAIL){
61-
M5.Lcd.println("Fail");
62-
}
63-
else if(res1 == ACK_FULL){
64-
M5.Lcd.println("Full");
65-
}
66-
else{
67-
M5.Lcd.println("Timeout");
43+
uint8_t res1;
44+
if(M5.BtnA.wasPressed()){
45+
CleanScreen();
46+
M5.Lcd.println("Fingerprint Typing");
47+
48+
res1 = FP_M.fpm_addUser(userNum,1);
49+
if(res1 == ACK_SUCCESS){
50+
M5.Lcd.println("Success");
51+
}
52+
else if(res1 == ACK_FAIL){
53+
M5.Lcd.println("Fail");
54+
}
55+
else if(res1 == ACK_FULL){
56+
M5.Lcd.println("Full");
57+
}
58+
else{
59+
M5.Lcd.println("Timeout");
60+
}
61+
userNum++;
6862
}
69-
userNum++;
70-
}
71-
//ButtonB: Matching. 匹配指纹
72-
if(M5.BtnB.wasPressed()){
73-
CleanScreen();
74-
M5.Lcd.println("Matching");
7563

76-
res1 = FP_M.fpm_compareFinger();
77-
if(res1 == ACK_SUCCESS){
78-
M5.Lcd.println("Success");
64+
if(M5.BtnB.wasPressed()){
65+
CleanScreen();
66+
M5.Lcd.println("Matching");
67+
68+
res1 = FP_M.fpm_compareFinger();
69+
if(res1 == ACK_SUCCESS){
70+
M5.Lcd.println("Success");
71+
}
72+
if(res1 == ACK_NOUSER){
73+
M5.Lcd.println("No Such User");
74+
}
75+
if(res1 == ACK_TIMEOUT){
76+
M5.Lcd.println("Timeout");
77+
}
7978
}
80-
if(res1 == ACK_NOUSER){
81-
M5.Lcd.println("No Such User");
82-
}
83-
if(res1 == ACK_TIMEOUT){
84-
M5.Lcd.println("Timeout");
85-
}
86-
}
87-
//ButtonC: Delete All User. 删除所有用户
88-
if(M5.BtnC.wasPressed()){
89-
res1 = FP_M.fpm_deleteAllUser();
90-
CleanScreen();
9179

92-
if(res1 == ACK_SUCCESS){
93-
M5.Lcd.println("Delete All User Successful");
94-
}
95-
else{
96-
M5.Lcd.println("Delete All User Failed");
80+
if(M5.BtnC.wasPressed()){
81+
res1 = FP_M.fpm_deleteAllUser();
82+
CleanScreen();
83+
84+
if(res1 == ACK_SUCCESS){
85+
M5.Lcd.println("Delete All User Successful");
86+
}
87+
else{
88+
M5.Lcd.println("Delete All User Failed");
89+
}
9790
}
98-
}
91+
M5.update();
9992
}
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.