basic bit checksum: TODO actual checksum
This commit is contained in:
parent
e0f090fdf6
commit
3745816585
1 changed files with 44 additions and 8 deletions
52
src/main.cpp
52
src/main.cpp
|
@ -550,13 +550,13 @@ void loop() {
|
|||
lastDataTime = millis(); // Reset the time of last received data
|
||||
}
|
||||
|
||||
if (millis() - lastDataTime >= displayDelay && cardData != 0) {
|
||||
|
||||
if (millis() - lastDataTime >= displayDelay && cardData != 0 && (bitCount == 26 || bitCount == 34 || bitCount == 37)) {
|
||||
|
||||
uint64_t facilityID = (cardData >> 17) & 0xFFFF;
|
||||
uint64_t cardID = (cardData >> 1) & 0xFFFF;
|
||||
|
||||
#ifdef SERIAL_DEBUG
|
||||
Serial.println("--- Reader Input Processed ---");
|
||||
Serial.print("Facility ID (Decimal): ");
|
||||
Serial.println(facilityID);
|
||||
Serial.print("Facility ID (Binary): ");
|
||||
|
@ -599,11 +599,6 @@ void loop() {
|
|||
WebSerial.print("Full Card (Tinance2): ");
|
||||
WebSerial.println(fullCardID);
|
||||
#endif
|
||||
cardData = 0; // Reset the card data
|
||||
lastDataTime = millis(); // Reset the time of last received data
|
||||
bitCount = 0; // Reset the bit count
|
||||
|
||||
|
||||
|
||||
#ifdef TINANCE2_BACKEND
|
||||
tinance2authrequest(String(fullCardID), String(cardID));
|
||||
|
@ -615,8 +610,49 @@ void loop() {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
cardData = 0; // Reset the card data
|
||||
lastDataTime = millis(); // Reset the time of last received data
|
||||
bitCount = 0; // Reset the bit count
|
||||
|
||||
}
|
||||
else if (millis() - lastDataTime >= maxReaderWaitTime) {
|
||||
else if (millis() - lastDataTime >= maxReaderWaitTime && cardData != 0) {
|
||||
uint64_t facilityID = (cardData >> 17) & 0xFFFF;
|
||||
uint64_t cardID = (cardData >> 1) & 0xFFFF;
|
||||
|
||||
#ifdef SERIAL_DEBUG
|
||||
Serial.println("--- Reader Input Error ---");
|
||||
Serial.print("Facility ID (Decimal): ");
|
||||
Serial.println(facilityID);
|
||||
Serial.print("Facility ID (Binary): ");
|
||||
Serial.println(facilityID, BIN);
|
||||
|
||||
Serial.print("Card ID (Decimal): ");
|
||||
Serial.println(cardID);
|
||||
Serial.print("Card ID (Binary): ");
|
||||
Serial.println(cardID, BIN);
|
||||
|
||||
Serial.print("Card Data (Binary): ");
|
||||
Serial.println(cardData, BIN);
|
||||
Serial.print("Total Bits Received: ");
|
||||
Serial.println(bitCount);
|
||||
#endif
|
||||
#ifdef WEB_SERIAL_DEBUG
|
||||
WebSerial.print("Facility ID (Decimal): ");
|
||||
WebSerial.println(facilityID);
|
||||
WebSerial.print("Facility ID (Binary): ");
|
||||
WebSerial.println(facilityID, BIN);
|
||||
|
||||
WebSerial.print("Card ID (Decimal): ");
|
||||
WebSerial.println(cardID);
|
||||
WebSerial.print("Card ID (Binary): ");
|
||||
WebSerial.println(cardID, BIN);
|
||||
|
||||
WebSerial.print("Card Data (Binary): ");
|
||||
WebSerial.println(cardData, BIN);
|
||||
WebSerial.print("Total Bits Received: ");
|
||||
WebSerial.println(bitCount);
|
||||
#endif
|
||||
|
||||
cardData = 0; // Reset the card data
|
||||
lastDataTime = millis(); // Reset the time of last received data
|
||||
bitCount = 0; // Reset the bit count
|
||||
|
|
Loading…
Reference in a new issue