Skip to content

Commit

Permalink
Merge branch 'dev' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
omersiar committed Jan 28, 2019
2 parents c2a6229 + 5e8d533 commit 9469e10
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 48 deletions.
18 changes: 9 additions & 9 deletions CHANGELOG.md
@@ -1,19 +1,14 @@
# Change Log
All notable changes to this project will be documented in this file.

## [Unreleased]
#### Fixed
- [webui] Version typo
- [webui] Refresh web headers

#### Changed
- [firmware] lock MFRC522 library to version 1.4.1

## [1.0.0-rc1] 2019-01-09
## [1.0.2] 2019-01-28

### BREAKING CHANGES (These changes will break your data on device, please make sure made a backup, also you can not use your old settings on this release but only can restore user data)

#### Added
- [firmware] Open/Close Button support @donatmarko
- [firmware] Logging Open/Close Button @donatmarko
- [firmware] the VERSION string is now defined at the beginning of main.cpp @Pako2
- [firmware] #218 Added latching relay support @donatmarko
- [firmware] #189 Flash layout changed to 2MB Firmware / 2MB SPIFFS Data @Pako2
- [firmware] Support for RDM6300 RFID readers (125kHz, UART) #163 @arduino12 / concurrently by @Pako2
Expand All @@ -27,6 +22,9 @@ All notable changes to this project will be documented in this file.
- [webui] Expired access attempts logged as "Expired"

#### Fixed
- [firmware] UART Monitor speed @donatmarko
- [firmware] avoid double Serial.begin @Pako2
- [firmware] removing redundant terminating null character @Pako2
- [firmware] fix the loadconfiguration loop @Pako2
- [firmware] not able to connect MQTT server #157 @fivosg
- [firmware] a MQTT message typo #157 @wamboin23
Expand All @@ -38,11 +36,13 @@ All notable changes to this project will be documented in this file.
- [firmware] the boot loop when ssid is empty on configuration file (actually more a workaround than a fix) #154

#### Changed
- [firmware] unify output format debug print of PICC @Pako2
- [firmware] Improve onWsEvent() function @Pako2
- [build] Change release type to a zip file (was tar.gz before)
- [webui] scrollbar on desktop screens (now hidden)
- [webui] sidebar colors (i hope you like it, standart bootstrap color)
- [webui] sanity check for firmware update file #152
- [firmware] lock MFRC522 library to version 1.4.1

## [0.8.1] 2018-09-01
#### Added
Expand Down
22 changes: 9 additions & 13 deletions README.md
@@ -1,6 +1,6 @@
# ESP RFID - Access Control with ESP8266, RC522 PN532 Wiegand RDM6300

[![Chat at https://gitter.im/esp-rfid/Lobby](https://badges.gitter.im/esp-rfid.svg)](https://gitter.im/esp-rfid/Lobby) [![Build Status](https://travis-ci.org/esprfid/esp-rfid.svg?branch=stable)](https://travis-ci.org/esprfid/esp-rfid) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d475052a09bd4865bc2654f524614cba)](https://www.codacy.com/app/omersiar/esp-rfid?utm_source=github.com&utm_medium=referral&utm_content=esprfid/esp-rfid&utm_campaign=Badge_Grade) [![Bountysource](https://api.bountysource.com/badge/team?team_id=242217)](https://salt.bountysource.com/checkout/amount?team=esp-rfid)
[![Chat at https://gitter.im/esp-rfid/Lobby](https://badges.gitter.im/esp-rfid.svg)](https://gitter.im/esp-rfid/Lobby) [![Build Status](https://travis-ci.org/esprfid/esp-rfid.svg?branch=stable)](https://travis-ci.org/esprfid/esp-rfid) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d475052a09bd4865bc2654f524614cba)](https://www.codacy.com/app/omersiar/esp-rfid?utm_source=github.com&utm_medium=referral&utm_content=esprfid/esp-rfid&utm_campaign=Badge_Grade) [![BCH compliance](https://bettercodehub.com/edge/badge/esprfid/esp-rfid?branch=stable)](https://bettercodehub.com/) [![Bountysource](https://api.bountysource.com/badge/team?team_id=242217)](https://salt.bountysource.com/checkout/amount?team=esp-rfid)

Access Control system using a cheap MFRC522, PN532 RFID, RDM6300 readers or Wiegand RFID readers and Espressif's ESP8266 Microcontroller.

Expand Down Expand Up @@ -111,18 +111,14 @@ Get more information here: https://stackoverflow.com/questions/3102819/disable-s

The following table shows the typical pin layout used for connecting readers hardware to ESP:

| Signal | PN532 | MFRC522 | RDM6300 | WeMos D1 mini | NodeMcu | Generic |
|-----------|:-----:|:-------:|:-------:|:-------------:|:-------:|:-----------:|
| RST/Reset | RST | RST | N/C | N/C [1] | N/C [1] | N/C [1] |
| SPI SS | SS | SDA [3] | N/C | D8 [2] | D8 [2] | GPIO-15 [2] |
| SPI MOSI | MOSI | MOSI | N/C | D7 | D7 | GPIO-13 |
| SPI MISO | MISO | MISO | N/C | D6 | D6 | GPIO-12 |
| SPI SCK | SCK | SCK | N/C | D5 | D5 | GPIO-14 |
| SPI SCK | SCK | SCK | TX | D4 | D4 | GPIO-02 |

1. Not Connected. Hard-reset no longer needed.
2. Configurable via settings page.
3. The SDA pin might be labeled SS on some/older MFRC522 boards.
| ESP8266 | NodeMcu/WeMos | Wiegand | PN532 | MFRC522 | RDM6300 |
|--------:|:-------------:|:-------:|:-----:|:-------:|:-------:|
| GPIO-15 | D8 | | SS | SDA/SS | |
| GPIO-13 | D7 | D0 | MOSI | MOSI | |
| GPIO-12 | D6 | D1 | MISO | MISO | |
| GPIO-14 | D5 | | SCK | SCK | TX |
| GPIO-04 | D2 | | | | |
| GPIO-05 | D1 | | | | |

For Wiegand based readers, you can configure D0 and D1 pins via settings page. By default, D0 is GPIO-4 and D1 is GPIO-5

Expand Down
7 changes: 4 additions & 3 deletions platformio.ini
Expand Up @@ -13,6 +13,7 @@ lib_deps =
https://github.com/miguelbalboa/rfid#ea7ee3f3daafd46d0c5b8438ba41147c384a1f0d
https://github.com/monkeyboard/Wiegand-Protocol-Library-for-Arduino.git
Time
Bounce2

; boards which GPIO0 and RESET controlled using two NPN transistors as nodemcu devkit (includes wemos d1 mini)
[env:generic]
Expand All @@ -26,7 +27,7 @@ extra_scripts = scripts/GENdeploy.py
build_flags = -Wl,-Teagle.flash.4m2m.ld
src_build_flags = !echo "-DBUILD_TAG="$TRAVIS_TAG
upload_speed = 921600
monitor_speed = 115200
monitor_speed = 9600

; official ESP-RFID board (V2)
[env:relayboard]
Expand All @@ -40,7 +41,7 @@ build_flags = -Wl,-Teagle.flash.4m2m.ld
src_build_flags = !echo "-DBUILD_TAG="$TRAVIS_TAG
extra_scripts = scripts/OBdeploy.py
upload_speed = 921600
monitor_speed = 115200
monitor_speed = 9600

; generic firmware for debugging purposes
[env:debug]
Expand All @@ -54,4 +55,4 @@ build_flags = -Wl,-Teagle.flash.4m2m.ld
src_build_flags = !echo "-DBUILD_TAG="$TRAVIS_TAG
extra_scripts = scripts/DBGdeploy.py
upload_speed = 921600
monitor_speed = 115200
monitor_speed = 9600
13 changes: 13 additions & 0 deletions src/config.esp
Expand Up @@ -42,6 +42,17 @@ bool ICACHE_FLASH_ATTR loadConfiguration()
digitalWrite(wifipin, LEDoff);
}
}

if (hardware.containsKey("buttonpin"))
{
buttonPin = hardware["buttonpin"];
if (buttonPin != 255)
{
button = Bounce();
button.attach(buttonPin, INPUT_PULLUP);
button.interval(30);
}
}
#ifdef OFFICIALBOARD
setupWiegandReader(5, 4);
#endif
Expand All @@ -68,7 +79,9 @@ bool ICACHE_FLASH_ATTR loadConfiguration()
rfidss = hardware["sspin"];
setupPN532Reader(rfidss);
}
#ifndef DEBUG
if (readerType>2) Serial.begin(9600);
#endif
#endif
autoRestartIntervalSeconds = general["restart"];
wifiTimeout = network["offtime"];
Expand Down
19 changes: 17 additions & 2 deletions src/main.cpp
Expand Up @@ -22,6 +22,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#define VERSION "1.0.2"

#include "Arduino.h"
#include <ESP8266WiFi.h>
Expand All @@ -35,6 +36,7 @@ SOFTWARE.
#include <Ticker.h>
#include "Ntp.h"
#include <AsyncMqttClient.h>
#include <Bounce2.h>

//#define DEBUG

Expand Down Expand Up @@ -85,6 +87,7 @@ NtpClient NTP;
AsyncMqttClient mqttClient;
Ticker mqttReconnectTimer;
WiFiEventHandler wifiDisconnectHandler, wifiConnectHandler;
Bounce button;

AsyncWebServer server(80);
AsyncWebSocket ws("/ws");
Expand All @@ -94,6 +97,7 @@ bool wifiFlag = false;
bool configMode = false;
int wmode;
uint8_t wifipin = 255;
uint8_t buttonPin = 255;
#define LEDoff HIGH
#define LEDon LOW

Expand Down Expand Up @@ -160,7 +164,8 @@ void ICACHE_FLASH_ATTR setup()
Serial.begin(9600);
Serial.println();

Serial.println(F("[ INFO ] ESP RFID v0.9"));
Serial.print(F("[ INFO ] ESP RFID v"));
Serial.println(VERSION);

uint32_t realSize = ESP.getFlashChipRealSize();
uint32_t ideSize = ESP.getFlashChipSize();
Expand Down Expand Up @@ -223,6 +228,16 @@ void ICACHE_RAM_ATTR loop()
uptime = NTP.getUptimeSec();
previousLoopMillis = currentMillis;

button.update();
if (button.fell())
{
#ifdef DEBUG
Serial.println("Button has been pressed");
#endif
writeLatest("", "(used open/close button)", 1);
activateRelay = true;
}

if (wifipin != 255 && configMode && !wmode)
{
if (!wifiFlag)
Expand Down Expand Up @@ -268,7 +283,7 @@ void ICACHE_RAM_ATTR loop()
#endif
digitalWrite(relayPin, !relayType);
}
activateRelay = false;
activateRelay = false;
}
}
else if (lockType == 0) // momentary relay mode
Expand Down
2 changes: 1 addition & 1 deletion src/rfid.esp
Expand Up @@ -91,7 +91,7 @@ void ICACHE_FLASH_ATTR rfidloop()
cooldown = millis() + 2000;
#ifdef DEBUG
Serial.print(F("[ INFO ] PICC's UID: "));
Serial.println(uid);
Serial.print(uid);
#endif
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/rfid125kHz.cpp
Expand Up @@ -88,7 +88,7 @@ String RFID_Reader::GetHexID()
uint8_t b[5];
memcpy(b, &new_ID, 5);
char buf[11];
sprintf(buf,"%02x%02x%02x%02x%02x%c",b[4],b[3],b[2],b[1],b[0],'\0');
sprintf(buf,"%02x%02x%02x%02x%02x",b[4],b[3],b[2],b[1],b[0]);
lasttagtype = tagtype;
data_available = false;
return String(buf);
Expand Down

0 comments on commit 9469e10

Please sign in to comment.