improved key scan further:added reboot possibility by input of # times pin length
This commit is contained in:
parent
637c85e885
commit
1d35684c53
@ -82,10 +82,14 @@ bool Keypad::getKeys() {
|
||||
// Private : Hardware scan
|
||||
void Keypad::scanKeys() {
|
||||
// Re-intialize the row pins. Allows sharing these pins with other hardware.
|
||||
for (byte r=0; r<sizeKpd.rows; r++) {
|
||||
pin_mode(rowPins[r],OUTPUT);
|
||||
pin_write(rowPins[r],HIGH);
|
||||
}
|
||||
delayMicroseconds(3); // Let pins settle.
|
||||
for (byte r=0; r<sizeKpd.rows; r++) {
|
||||
pin_mode(rowPins[r],INPUT_PULLUP);
|
||||
}
|
||||
delayMicroseconds(1); // Let pins settle.
|
||||
// bitMap stores ALL the keys that are being pressed.
|
||||
for (byte c=0; c<sizeKpd.columns; c++) {
|
||||
pin_mode(columnPins[c],OUTPUT);
|
||||
|
||||
@ -40,7 +40,7 @@ Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
|
||||
|
||||
enum class Mode { scan, enroll, wificonfig, maintenance, cooldown };
|
||||
|
||||
const char* VersionInfo = "0.5";
|
||||
const char* VersionInfo = "0.6";
|
||||
|
||||
// ===================================================================================================================
|
||||
// Caution: below are not the credentials for connecting to your home network, they are for the Access Point mode!!!
|
||||
@ -807,15 +807,25 @@ void keyboardPoller(void){
|
||||
pinOK= false;
|
||||
}
|
||||
}
|
||||
pinpos = 0;
|
||||
if(pinOK){
|
||||
Serial.println("OPEN!!");
|
||||
Match match;
|
||||
match.matchName = "KEYPAD";
|
||||
openDoor(match);
|
||||
}else{
|
||||
Serial.println("WRONG");
|
||||
pinOK = true;
|
||||
PinStr = "#############";
|
||||
for(uint8_t i=0;i<pinpos;i++){
|
||||
uint8_t coosenPinDigit = PinStr.charAt(i);
|
||||
if(pin[i] != coosenPinDigit){
|
||||
pinOK= false;
|
||||
}
|
||||
}
|
||||
if(pinOK){
|
||||
ESP.restart();
|
||||
}
|
||||
}
|
||||
pinpos = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user