From 85a09fef79f12483aedc2576c01ad38a57b085f5 Mon Sep 17 00:00:00 2001 From: Will Bradley Date: Wed, 29 Aug 2012 21:59:59 -0700 Subject: [PATCH 1/2] Moved around lines of code to make it more logical. Incremented version. --- Open_Access_Control_Ethernet.ino | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Open_Access_Control_Ethernet.ino b/Open_Access_Control_Ethernet.ino index 981a6fd..05523c3 100644 --- a/Open_Access_Control_Ethernet.ino +++ b/Open_Access_Control_Ethernet.ino @@ -1,7 +1,7 @@ /* * Open Source RFID Access Controller - Ethernet Branch * - * 8/8/2012 v0.01 (branch based on upstream 4/3/2011 v1.32) + * 8/29/2012 v0.02 (branch based on upstream 4/3/2011 v1.32) * Will Bradley - will@heatsynclabs.org * * Upstream: @@ -82,27 +82,31 @@ #include // Needed for saving to non-voilatile memory on the Arduino. #include // Allows data to be stored in FLASH instead of RAM - #include // Ethernet stuff #include - #include // DS1307 RTC Clock/Date/Time chip library #include // Wiegand 26 reader format libary #include // Pcint.h implementation, allows for >2 software interupts. -/* Static user List - Implemented as an array for testing and access override - */ +#define PRIVPASSWORD 0x1234 // Console "priveleged mode" password -#define DEBUG 2 // Set to 2 for display of raw tag numbers in log files, 1 for only denied, 0 for never. +// Static user List - Implemented as an array for testing and access override #define adam 0xABCDE // Name and badge number in HEX. We are not using checksums or site ID, just the whole #define bob 0xBCDEF // output string from the reader. #define carl 0xA1B2C3 const long superUserList[] = { adam, bob, carl}; // Super user table (cannot be changed by software) -#define PRIVPASSWORD 0x1234 // Console "priveleged mode" password +// Enter a MAC address and IP address for your controller below. +// The IP address will be dependent on your local network: +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +IPAddress ip(192,168,1,177); + +// Stuff below here doesn't necessarily need to be edited. + +#define DEBUG 2 // Set to 2 for display of raw tag numbers in log files, 1 for only denied, 0 for never. #define DOORDELAY 5000 // How long to open door lock once access is granted. (2500 = 2.5s) #define SENSORTHRESHOLD 100 // Analog sensor change that will trigger an alarm (0..255) @@ -182,12 +186,6 @@ char logKeys[40]={0}; int logData[40]={0}; int logCursor=0; - -// Enter a MAC address and IP address for your controller below. -// The IP address will be dependent on your local network: -byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; -IPAddress ip(192,168,1,177); - // Initialize the Ethernet server library // with the IP address and port you want to use // (port 80 is default for HTTP): From 84b5a8a34162e6bb8b70ee50680d80288388b2c5 Mon Sep 17 00:00:00 2001 From: Will Bradley Date: Wed, 29 Aug 2012 22:56:57 -0700 Subject: [PATCH 2/2] Tried changing to long; not uploading due to size. --- Open_Access_Control_Ethernet.ino | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Open_Access_Control_Ethernet.ino b/Open_Access_Control_Ethernet.ino index 05523c3..ccf29b0 100644 --- a/Open_Access_Control_Ethernet.ino +++ b/Open_Access_Control_Ethernet.ino @@ -182,8 +182,8 @@ unsigned long keypadValue=0; boolean privmodeEnabled = false; // Switch for enabling "priveleged" commands // Log buffer -char logKeys[40]={0}; -int logData[40]={0}; +char logKeys[10]={0}; +long logData[10]={0}; int logCursor=0; // Initialize the Ethernet server library @@ -205,13 +205,13 @@ PCATTACH pcattach; // Software interrupt library const prog_uchar httpheaderok[] PROGMEM = {"HTTP/1.1 200 OK\r\nCache-Control: no-store\r\nContent-Type: text/html\r\n\r\n"}; const prog_uchar title[] PROGMEM = {"

OAC

"}; -const prog_uchar help[] PROGMEM = {"
Numbers must be padded.\n\n?e=0000 - enable privileged (enter 0 to logout)\n?s000 - show user\n?m000&p000&t00000000 - modify user(0-200) permission(0-255) tag(00000000-ffffffff)\n?a - list all users\n?r000 - remove user\n?o1 ?o2 - open door 1/2\n?u ?u=1 ?u=2 - unlock all/1/2\n?l - lock all\n?1 - disarm\n?2 - arm\n?3 - train\n?9 - status\n?z - show log\n?y - clear log
"}; //\n?d=00&w=0&m=00&y=00&h=00&i=00&s=00 - set day-dayofweek-month-year-hour-min-sec +const prog_uchar help[] PROGMEM = {"
Numbers must be padded.\n\n?e=0000 - login (0s to logout)\n?s000 - show user\n?m000&p000&t00000000 - modify user(0-200) perm(0-255) tag(0-f)\n?a - list all users\n?r000 - remove user\n?o1 ?o2 - open door 1/2\n?u ?u=1 ?u=2 - unlock all/1/2\n?l - lock all\n?1 - disarm\n?2 - arm\n?3 - train\n?9 - status\n?z - log\n?y - clear log
"}; //\n?d=00&w=0&m=00&y=00&h=00&i=00&s=00 - set day-dayofweek-month-year-hour-min-sec const prog_uchar noauth[] PROGMEM = {"Not logged in."}; -const prog_uchar unlockboth[] PROGMEM = {"Unlocked all doors."}; +const prog_uchar unlockboth[] PROGMEM = {"Unlocked all."}; const prog_uchar unlock1[] PROGMEM = {"Unlocked door 1."}; const prog_uchar unlock2[] PROGMEM = {"Unlocked door 2."}; -const prog_uchar open1[] PROGMEM = {"Opened door 1 for a few seconds."}; -const prog_uchar open2[] PROGMEM = {"Opened door 2 for a few seconds."}; +const prog_uchar open1[] PROGMEM = {"Temp opened door 1."}; +const prog_uchar open2[] PROGMEM = {"Temp opened door 2."}; const prog_uchar lockboth[] PROGMEM = {"Locked all doors."}; void setup(){ // Runs once at Arduino boot-up @@ -1566,7 +1566,7 @@ void printStatus(EthernetClient client) { } -void addToLog(char type, int data) { +void addToLog(char type, long data) { logKeys[logCursor] = type; logData[logCursor] = data;