Permalink
Browse files

Remove code that buffers tag IDs to ram, add back support for updatin…

…g tags in EEPROM
  • Loading branch information...
1 parent 0ca3389 commit 316778d0984e6e3dbcb7ee5970db076be94416df @cibomahto cibomahto committed Feb 23, 2010
Showing with 0 additions and 27 deletions.
  1. +0 −21 RFIDDB.cpp
  2. +0 −6 RFIDDB.h
View
21 RFIDDB.cpp
@@ -16,14 +16,6 @@ RFIDDB::RFIDDB()
Serial.println(numTags, DEC);
numTags = 0;
}
-#ifndef DONT_BUFFER_TAG_IDS
- if(numTags > 0){
- dataSize = TAG_LENGTH * sizeof(char) * numTags;
- for(int i = 0; i < dataSize; i++){
- tagData[i/TAG_LENGTH][i%TAG_LENGTH] = (char) EEPROM.read(i+1);
- }
- }
-#endif
}
int RFIDDB::getNumTags()
@@ -41,25 +33,19 @@ void RFIDDB::printTags()
Serial.print(i + 1);
Serial.print(": ");
for(int j = 0; j < TAG_LENGTH; j++){
-#ifdef DONT_BUFFER_TAG_IDS
char buffer;
buffer = (char) EEPROM.read(i*TAG_LENGTH+j+1);
Serial.print(buffer, BYTE);
-#else
- Serial.print(tagData[i][j], BYTE);
-#endif
}
Serial.println();
}
}
void RFIDDB::readTags()
{
-#ifndef DONT_BUFFER_TAG_IDS
char inByte;
int done = 0;
numTags = -1;
- dataSize = 0;
int currTag = 0;
int idx = 0;
while(!done){
@@ -71,12 +57,10 @@ void RFIDDB::readTags()
Serial.print("Expecting ");
Serial.print(numTags, DEC);
Serial.println(" tags.");
- dataSize = TAG_LENGTH * sizeof(char) * numTags;
EEPROM.write(0, numTags);
if(numTags == 0) { done = 1; } // no tags to write
} else {
// otherwise, put this byte wherever it goes
- tagData[currTag][idx] = inByte; // RAM
EEPROM.write(currTag * TAG_LENGTH + idx + 1, inByte); // EEPROM
// then, increment counters and/or set that we're done
idx++;
@@ -93,7 +77,6 @@ void RFIDDB::readTags()
}
}
Serial.println("Finished!");
-#endif
}
bool RFIDDB::validTag(char* tag){
@@ -106,16 +89,12 @@ bool RFIDDB::validTag(char* tag){
#endif
ok = true;
for(int j = 0; j < TAG_LENGTH; j++){
-#ifdef DONT_BUFFER_TAG_IDS
char buffer;
buffer = (char) EEPROM.read(i*TAG_LENGTH+j+1);
#if 0
Serial.print(buffer);
#endif
if(tag[j] != buffer) {
-#else
- if(tag[j] != tagData[i][j]){
-#endif
ok = false;
}
}
View
6 RFIDDB.h
@@ -11,8 +11,6 @@
// TODO: Include this directly
//#include <EEPROM.h>
-#define DONT_BUFFER_TAG_IDS
-
#define TAG_LENGTH 10 // Length of a tag, in bytes
#define MAX_TAGS 50 // Maximum number of tags we can hold
@@ -27,10 +25,6 @@ class RFIDDB
private:
int tagSize;
int numTags;
-#ifndef DONT_BUFFER_TAG_IDS
- int dataSize;
- char tagData[MAX_TAGS][TAG_LENGTH];
-#endif
};
#endif

0 comments on commit 316778d

Please sign in to comment.