clear tones

This commit is contained in:
Matthew Frost 2023-12-27 22:41:33 +01:00
parent 4602b4a35b
commit 7c0ca6615c
3 changed files with 14 additions and 12 deletions

View file

@ -32,7 +32,7 @@
void controlRelay();
void unlockDoor(bool silent);
void lockDoor();
void lockDoor(bool silent);
void toggleDoor();
String stateDoor();

View file

@ -30,7 +30,12 @@ void unlockDoor(bool silent) {
#endif
}
void lockDoor() {
void lockDoor(bool silent) {
#ifdef BUZZER
if (!silent) {
short_beep();
}
#endif
#ifdef RELAY1
#ifdef RELAY1_REVERSED
controlRelay(RELAY1_PIN,false);
@ -58,13 +63,13 @@ void toggleDoor() {
// Toggle the relay based on the current state
#ifdef RELAY1_REVERSED
if (relayState == HIGH) {
lockDoor();
lockDoor(false);
} else {
unlockDoor(false);
}
#else
if (relayState == LOW) {
lockDoor();
lockDoor(false);
} else {
unlockDoor(false);
}

View file

@ -20,7 +20,7 @@ void localAcl(String cardID) {
if (!settings.DoorDisabled()) {
unlockDoor(false);
delay(RELAY_DELAY);
lockDoor();
lockDoor(false);
}
#endif
#ifdef TOGGLE_DOOR
@ -124,7 +124,7 @@ void WiFiStationConnected(WiFiEvent_t event, WiFiEventInfo_t info){
Serial.println("Connected to AP successfully!");
#endif
#ifdef NET_FAIL_SAFE
lockDoor();
lockDoor(true);
#endif
}
@ -281,7 +281,7 @@ void handleData1Interrupt() {
if (!settings.DoorDisabled()) {
unlockDoor(false);
delay(RELAY_DELAY);
lockDoor();
lockDoor(false);
}
#endif
#ifdef TOGGLE_DOOR
@ -341,9 +341,6 @@ void handleData1Interrupt() {
Serial.println("JSON Reader Enabled: " + json["enabled"].as<String>());
#endif
}
}
}
#endif
@ -425,7 +422,7 @@ void setup() {
#ifdef SERIAL_DEBUG
Serial.println("Enabling Relay: Locking Door");
#endif
lockDoor();
lockDoor(true);
#endif
#ifdef RELAY2
@ -630,7 +627,7 @@ void setup() {
#ifdef SERIAL_DEBUG
Serial.println("Enabling Door due to DoorDisabled setting");
#endif
lockDoor();
lockDoor(false);
}
}