Option to compile without buzzer support
This commit is contained in:
parent
b44e7c300d
commit
63e261c9be
|
@ -11,6 +11,8 @@
|
|||
#define AFRAPAY_GIT_COMMIT "unknown"
|
||||
#endif
|
||||
|
||||
//#define DISABLE_BUZZER
|
||||
|
||||
/*
|
||||
* We're using an Az-Delivery ESP-32 Kit:
|
||||
* Product: https://web.archive.org/web/20230420182915/https://www.azdelivery.de/en/products/esp32-developmentboard
|
||||
|
|
|
@ -306,6 +306,8 @@ void loop() {
|
|||
break;
|
||||
case STATE_TRANSACT_VERIFY:
|
||||
oled.updateOLED(state, lastStatusText);
|
||||
|
||||
#ifndef DISABLE_BUZZER
|
||||
if (PN532Reader::mode == PN532_MIFARE_ISO14443A) {
|
||||
tone(PIN_BUZZER, NOTE_A5, 25);
|
||||
tone(PIN_BUZZER, NOTE_NONE, 150);
|
||||
|
@ -314,15 +316,20 @@ void loop() {
|
|||
tone(PIN_BUZZER, NOTE_FS7, 100);
|
||||
tone(PIN_BUZZER, NOTE_NONE, 150);
|
||||
}
|
||||
#endif
|
||||
|
||||
lastStatusText = cardTransaction(wifi, http, apiUrl, scannedCardId, String(GetTransactionAmount()), scannedCardReader->getReaderName());
|
||||
if (lastStatusText.startsWith("S:")) {
|
||||
#ifndef DISABLE_BUZZER
|
||||
tone(PIN_BUZZER, NOTE_C7, 650);
|
||||
#endif
|
||||
state = STATE_RESULT_SUCCESS;
|
||||
} else {
|
||||
#ifndef DISABLE_BUZZER
|
||||
tone(PIN_BUZZER, NOTE_CS5, 100);
|
||||
tone(PIN_BUZZER, NOTE_NONE, 25);
|
||||
tone(PIN_BUZZER, NOTE_CS5, 400);
|
||||
#endif
|
||||
state = STATE_RESULT_FAILURE;
|
||||
}
|
||||
lastStatusText = lastStatusText.substring(2);
|
||||
|
@ -376,6 +383,8 @@ void loop() {
|
|||
break;
|
||||
case STATE_LINK_VERIFY:
|
||||
oled.updateOLED(state, lastStatusText);
|
||||
|
||||
#ifndef DISABLE_BUZZER
|
||||
if (PN532Reader::mode == PN532_MIFARE_ISO14443A) {
|
||||
tone(PIN_BUZZER, NOTE_A5, 25);
|
||||
tone(PIN_BUZZER, NOTE_NONE, 150);
|
||||
|
@ -384,17 +393,22 @@ void loop() {
|
|||
tone(PIN_BUZZER, NOTE_FS7, 100);
|
||||
tone(PIN_BUZZER, NOTE_NONE, 150);
|
||||
}
|
||||
#endif
|
||||
|
||||
lastStatusText = cardLink(wifi, http, apiUrl, scannedCardId, scannedCardReader->getReaderName());
|
||||
if (lastStatusText.startsWith("S:")) {
|
||||
#ifndef DISABLE_BUZZER
|
||||
tone(PIN_BUZZER, NOTE_C6, 100);
|
||||
tone(PIN_BUZZER, NOTE_NONE, 10);
|
||||
tone(PIN_BUZZER, NOTE_C6, 100);
|
||||
#endif
|
||||
state = STATE_RESULT_SUCCESS;
|
||||
} else {
|
||||
#ifndef DISABLE_BUZZER
|
||||
tone(PIN_BUZZER, NOTE_CS5, 100);
|
||||
tone(PIN_BUZZER, NOTE_NONE, 25);
|
||||
tone(PIN_BUZZER, NOTE_CS5, 400);
|
||||
#endif
|
||||
state = STATE_RESULT_FAILURE;
|
||||
}
|
||||
lastStatusText = lastStatusText.substring(2);
|
||||
|
@ -419,6 +433,8 @@ void loop() {
|
|||
break;
|
||||
case STATE_BALANCE_VERIFY:
|
||||
oled.updateOLED(state, lastStatusText);
|
||||
|
||||
#ifndef DISABLE_BUZZER
|
||||
if (PN532Reader::mode == PN532_MIFARE_ISO14443A) {
|
||||
tone(PIN_BUZZER, NOTE_A5, 25);
|
||||
tone(PIN_BUZZER, NOTE_NONE, 150);
|
||||
|
@ -427,15 +443,18 @@ void loop() {
|
|||
tone(PIN_BUZZER, NOTE_FS7, 100);
|
||||
tone(PIN_BUZZER, NOTE_NONE, 150);
|
||||
}
|
||||
#endif
|
||||
|
||||
lastStatusText = cardBalance(wifi, http, apiUrl, scannedCardId, scannedCardReader->getReaderName());
|
||||
if (lastStatusText.startsWith("S:")) {
|
||||
lastStatusText = lastStatusText + ":" + cardIdDisplay(scannedCardId);
|
||||
state = STATE_RESULT_DISPLAY;
|
||||
} else {
|
||||
#ifndef DISABLE_BUZZER
|
||||
tone(PIN_BUZZER, NOTE_CS5, 100);
|
||||
tone(PIN_BUZZER, NOTE_NONE, 25);
|
||||
tone(PIN_BUZZER, NOTE_CS5, 400);
|
||||
#endif
|
||||
state = STATE_RESULT_FAILURE;
|
||||
}
|
||||
lastStatusText = lastStatusText.substring(2);
|
||||
|
|
Loading…
Reference in a new issue