Skip to content

Commit 9f886db

Browse files
committed
syncing rfid.esp with esp-rfid project
1 parent e668277 commit 9f886db

File tree

9 files changed

+601
-101
lines changed

9 files changed

+601
-101
lines changed

bin/deploydebug.bin

36.5 KB
Binary file not shown.

platformio.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ lib_deps =
2222
https://github.com/me-no-dev/ESPAsyncWebServer
2323
https://github.com/marvinroger/async-mqtt-client
2424
https://github.com/miguelbalboa/rfid
25-
https://github.com/pvtex/Wiegand-NG-Multi-Bit-Wiegand-Library-for-Arduino
25+
https://github.com/matjack1/Wiegand-Protocol-Library-for-Arduino
2626
https://github.com/PaulStoffregen/Time
2727
https://github.com/thomasfredericks/Bounce2
2828
https://github.com/tctlrd/Desfire
29+
https://github.com/miguelbalboa/rfid
2930
https://github.com/tctlrd/io2
31+
https://github.com/plerup/espsoftwareserial
3032

3133
[env:debug]
3234
platform = ${common.platform}

src/beeper.esp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ void beeperBeep()
88
if (currentMillis > beeperOffTime && digitalRead(config.beeperpin) == BEEPERon)
99
{
1010
digitalWrite(config.beeperpin, BEEPERoff);
11+
#ifdef DEBUG
12+
Serial.println("Beeper OFF");
13+
#endif
1114
beeperInterval = 0;
1215
}
1316
else if (beeperInterval != 0)
@@ -18,8 +21,14 @@ void beeperBeep()
1821
previousMillis = currentMillis;
1922
if (beeperState == BEEPERon) {
2023
beeperState = BEEPERoff;
24+
#ifdef DEBUG
25+
Serial.println("Beeper OFF");
26+
#endif
2127
} else {
2228
beeperState = BEEPERon;
29+
#ifdef DEBUG
30+
Serial.println("Beeper ON");
31+
#endif
2332
}
2433
digitalWrite(config.beeperpin, beeperState);
2534
}
@@ -33,6 +42,9 @@ void beeperValidAccess()
3342
{
3443
beeperOffTime = currentMillis + 2000;
3544
digitalWrite(config.beeperpin, BEEPERon);
45+
#ifdef DEBUG
46+
Serial.println("Beeper ON");
47+
#endif
3648
}
3749
}
3850

@@ -41,6 +53,9 @@ void beeperAdminAccess()
4153
if (config.beeperpin != 255) {
4254
beeperOffTime = currentMillis + 3000;
4355
digitalWrite(config.beeperpin, BEEPERon);
56+
#ifdef DEBUG
57+
Serial.println("Beeper ON");
58+
#endif
4459
}
4560
}
4661

@@ -51,4 +66,4 @@ void beeperAccessDenied()
5166
beeperOffTime = currentMillis + 1000;
5267
beeperInterval = 200;
5368
}
54-
}
69+
}

src/config.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#define MAX_NUM_RELAYS 4
2-
31
struct Config
42
{
53
bool dhcpEnabledEth = false;

src/magicnumbers.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
// reader types
22

3+
#define READER_MFRC522 0
34
#define READER_WIEGAND 1
5+
#define READER_PN532 2
6+
#define READER_RDM6300 3
7+
#define READER_MFRC522_RDM6300 4
8+
#define READER_WIEGAND_RDM6300 5
9+
#define READER_PN532_RDM6300 6
410

511
// timing constants
612

@@ -18,14 +24,14 @@
1824
#define WIEGANDTYPE_KEYPRESS4 4
1925
#define WIEGANDTYPE_KEYPRESS8 8
2026
#define WIEGANDTYPE_PICC24 24
21-
#define WIEGANDTYPE_PICC26 26
2227
#define WIEGANDTYPE_PICC34 34
23-
#define WIEGANDTYPE_PICC37 37
24-
#define WIEGANDTYPE_PICC44 44
25-
#define WIEGANDTYPE_PICC56 56
26-
#define WIEGANDTYPE_PICC58 58
28+
29+
#define RDM6300_BAUDRATE 9600
30+
#define RDM6300_READ_TIMEOUT 20
2731

2832
// hardware defines
2933

34+
#define MAX_NUM_RELAYS 4
35+
3036
#define LOCKTYPE_MOMENTARY 0
31-
#define LOCKTYPE_CONTINUOUS 1
37+
#define LOCKTYPE_CONTINUOUS 1

src/main.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,26 @@ IO2 io2 = IO2(); // set I2C address of MOD-IO2
4848
#include <Bounce2.h>
4949
#include <Desfire.h>
5050
#include "Secrets.h"
51-
#include <PN532.h>
5251
// #include <esp_task_wdt.h>
5352
#include <Update.h>
5453
#include "magicnumbers.h"
5554
#include "config.h"
5655

57-
#include <WiegandNG.h>
58-
5956
Config config;
57+
58+
#include <MFRC522.h>
59+
#include "PN532.h"
60+
#include <Wiegand.h>
61+
#include "rfid125kHz.h"
62+
#include <SoftwareSerial.h>
63+
6064
File fsUploadFile;
61-
WiegandNG wg;
6265
Desfire desfire;
66+
MFRC522 mfrc522 = MFRC522();
67+
PN532 pn532;
68+
WIEGAND wg;
69+
RFID_Reader RFIDr;
70+
SoftwareSerial *rdm6300SwSerial = NULL;
6371

6472
// relay specific variables
6573
#if MAX_NUM_RELAYS == 4

0 commit comments

Comments
 (0)