This commit is contained in:
Matthew Frost 2023-12-27 13:13:13 +01:00
parent ef7e49ca18
commit 398b6fc512

View file

@ -624,14 +624,25 @@ void setup() {
}
#endif
/**
* @brief The main loop function that runs repeatedly in the program.
*
* This function is responsible for processing the card reader data and performing necessary actions based on the received data.
* It checks for new data availability, validates the data, and performs actions accordingly.
* If valid card data is received, it extracts the facility ID and card ID, and prints them to the Serial or WebSerial (if enabled).
* It then calls the appropriate functions based on the defined macros to handle the card data.
* If no valid card data is received within the specified time, it resets the card data and bit count.
*
* @note This function assumes the availability of certain macros like TINANCE2_BACKEND, LOCAL_ACL, SERIAL_ACL, SERIAL_DEBUG, and WEB_SERIAL_DEBUG.
*
* @note This function assumes the availability of certain variables like newDataAvailable, lastDataTime, displayDelay, cardData, bitCount, and maxReaderWaitTime.
*
* @note This function assumes the availability of certain functions like updateDoorStatus, checkSerialCommand, tinance2authrequest, and localAcl.
*/
void loop() {
#ifdef TINANCE2_BACKEND
updateDoorStatus();
#endif
#ifdef TINANCE2_BACKEND
updateDoorStatus();
#endif
#ifdef LOCAL_ACL
#ifdef SERIAL_ACL
@ -639,7 +650,6 @@ void loop() {
#endif
#endif
if (newDataAvailable) {
newDataAvailable = false;
lastDataTime = millis(); // Reset the time of last received data