Skip to content

Commit

Permalink
Add fixes for A/B/C key distinguishing
Browse files Browse the repository at this point in the history
  • Loading branch information
TheHolyRoger committed May 23, 2022
1 parent cc8ad7a commit 182ef61
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions ESP32-MQTT-AlarmKeypad.ino
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static const bool printSerialOutputForDebugging = false; // Only set to true wh

/* ANYTHING CHANGED BELOW THIS COMMENT MAY RESULT IN ISSUES - ALL SETTINGS TO CONFIGURE ARE ABOVE THIS LINE */

static const String versionNum = "v0.04";
static const String versionNum = "v0.05";

/*
Server Index Page
Expand Down Expand Up @@ -410,7 +410,7 @@ void blinkLEDClear() {
}

for (int i=0; i<2; ++i) {
flashColouredLEDWithDelay(LED_SUCCESS_PIN, 200, LED_FAILURE_PIN);
flashColouredLEDWithDelay(LED_SUCCESS_PIN, 50, LED_FAILURE_PIN);
if (i < 1) {
delay(50);
}
Expand Down Expand Up @@ -481,23 +481,23 @@ void check_keypad () {
Serial.println(String(alarmCode));
}

if (key == submit_key) {
if (key == submit_key || keypad.isPressed(submit_key)) {
if (printSerialOutputForDebugging) {
Serial.print("Submitting Arm Alarm Code: ");
Serial.println(String(alarmCode));
}
client.publish((ESPMQTTTopic + "/code_exit").c_str(), String(alarmCode));
strcpy(alarmCode, "");
}
else if (strlen(alarmCode) >= 4 && key == disarm_key) {
else if (strlen(alarmCode) >= 4 && (key == disarm_key || keypad.isPressed(disarm_key))) {
if (printSerialOutputForDebugging) {
Serial.print("Submitting Disarm Alarm Code: ");
Serial.println(String(alarmCode));
}
client.publish((ESPMQTTTopic + "/code_entry").c_str(), String(alarmCode));
strcpy(alarmCode, "");
}
else if (key == clear_key || key == clear_key_alt) {
else if (key == clear_key || key == clear_key_alt || keypad.isPressed(clear_key) || keypad.isPressed(clear_key_alt)) {
strcpy(alarmCode, "");
if (printSerialOutputForDebugging) {
Serial.println("Clearing alarmCode.");
Expand All @@ -507,7 +507,7 @@ void check_keypad () {
else if (strlen(alarmCode) > 6) {
strcpy(alarmCode, "");
}
delay(200);
delay(100);
if (!isIgnoredKey(key) && ledOnKeypress) {
digitalWrite(LED_PIN, ledOFFValue);
digitalWrite(LED_KEYPRESS_PIN, ledOFFValue);
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ https://github.com/TheHolyRoger/ESP32-MQTT-AlarmKeypad

More info & discussion: https://community.home-assistant.io/t/esp32-alarm-keypad/422952/2

v0.04
v0.05


Author:
Expand Down

0 comments on commit 182ef61

Please sign in to comment.