mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 19:26:37 +00:00
Fix future compile error
This commit is contained in:
parent
8402f49d0e
commit
d88d42341d
@ -1276,6 +1276,7 @@ MFRC522::StatusCode MFRC522::PCD_MIFARE_Transceive( byte *sendData, ///< Pointe
|
||||
*
|
||||
* @return const __FlashStringHelper *
|
||||
*/
|
||||
/*
|
||||
const __FlashStringHelper *MFRC522::GetStatusCodeName(MFRC522::StatusCode code ///< One of the StatusCode enums.
|
||||
) {
|
||||
switch (code) {
|
||||
@ -1291,6 +1292,22 @@ const __FlashStringHelper *MFRC522::GetStatusCodeName(MFRC522::StatusCode code /
|
||||
default: return F("Unknown error");
|
||||
}
|
||||
} // End GetStatusCodeName()
|
||||
*/
|
||||
String MFRC522::GetStatusCodeName(MFRC522::StatusCode code ///< One of the StatusCode enums.
|
||||
) {
|
||||
switch (code) {
|
||||
case STATUS_OK: return F("Success.");
|
||||
case STATUS_ERROR: return F("Error in communication.");
|
||||
case STATUS_COLLISION: return F("Collision detected.");
|
||||
case STATUS_TIMEOUT: return F("Timeout in communication.");
|
||||
case STATUS_NO_ROOM: return F("A buffer is not big enough.");
|
||||
case STATUS_INTERNAL_ERROR: return F("Internal error in the code. Should not happen.");
|
||||
case STATUS_INVALID: return F("Invalid argument.");
|
||||
case STATUS_CRC_WRONG: return F("The CRC_A does not match.");
|
||||
case STATUS_MIFARE_NACK: return F("A MIFARE PICC responded with NAK.");
|
||||
default: return F("Unknown error");
|
||||
}
|
||||
} // End GetStatusCodeName()
|
||||
|
||||
/**
|
||||
* Translates the SAK (Select Acknowledge) to a PICC type.
|
||||
@ -1324,6 +1341,7 @@ MFRC522::PICC_Type MFRC522::PICC_GetType(byte sak ///< The SAK byte returned fr
|
||||
*
|
||||
* @return const __FlashStringHelper *
|
||||
*/
|
||||
/*
|
||||
const __FlashStringHelper *MFRC522::PICC_GetTypeName(PICC_Type piccType ///< One of the PICC_Type enums.
|
||||
) {
|
||||
switch (piccType) {
|
||||
@ -1341,6 +1359,24 @@ const __FlashStringHelper *MFRC522::PICC_GetTypeName(PICC_Type piccType ///< One
|
||||
default: return F("Unknown type");
|
||||
}
|
||||
} // End PICC_GetTypeName()
|
||||
*/
|
||||
String MFRC522::PICC_GetTypeName(PICC_Type piccType ///< One of the PICC_Type enums.
|
||||
) {
|
||||
switch (piccType) {
|
||||
case PICC_TYPE_ISO_14443_4: return F("PICC compliant with ISO/IEC 14443-4");
|
||||
case PICC_TYPE_ISO_18092: return F("PICC compliant with ISO/IEC 18092 (NFC)");
|
||||
case PICC_TYPE_MIFARE_MINI: return F("MIFARE Mini, 320 bytes");
|
||||
case PICC_TYPE_MIFARE_1K: return F("MIFARE 1KB");
|
||||
case PICC_TYPE_MIFARE_4K: return F("MIFARE 4KB");
|
||||
case PICC_TYPE_MIFARE_UL: return F("MIFARE Ultralight or Ultralight C");
|
||||
case PICC_TYPE_MIFARE_PLUS: return F("MIFARE Plus");
|
||||
case PICC_TYPE_MIFARE_DESFIRE: return F("MIFARE DESFire");
|
||||
case PICC_TYPE_TNP3XXX: return F("MIFARE TNP3XXX");
|
||||
case PICC_TYPE_NOT_COMPLETE: return F("SAK indicates UID is not complete.");
|
||||
case PICC_TYPE_UNKNOWN:
|
||||
default: return F("Unknown type");
|
||||
}
|
||||
} // End PICC_GetTypeName()
|
||||
|
||||
/**
|
||||
* Dumps debug info about the connected PCD to Serial.
|
||||
@ -1558,7 +1594,7 @@ void MFRC522::PICC_DumpMifareClassicSectorToSerial(Uid *uid, ///< Pointer to U
|
||||
status = PCD_Authenticate(PICC_CMD_MF_AUTH_KEY_A, firstBlock, key, uid);
|
||||
if (status != STATUS_OK) {
|
||||
Serial.print(F("PCD_Authenticate() failed: "));
|
||||
Serial.println(GetStatusCodeName(status));
|
||||
Serial.println(GetStatusCodeName(status).c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1567,7 +1603,7 @@ void MFRC522::PICC_DumpMifareClassicSectorToSerial(Uid *uid, ///< Pointer to U
|
||||
status = MIFARE_Read(blockAddr, buffer, &byteCount);
|
||||
if (status != STATUS_OK) {
|
||||
Serial.print(F("MIFARE_Read() failed: "));
|
||||
Serial.println(GetStatusCodeName(status));
|
||||
Serial.println(GetStatusCodeName(status).c_str());
|
||||
continue;
|
||||
}
|
||||
// Dump data
|
||||
@ -1647,7 +1683,7 @@ void MFRC522::PICC_DumpMifareUltralightToSerial() {
|
||||
status = MIFARE_Read(page, buffer, &byteCount);
|
||||
if (status != STATUS_OK) {
|
||||
Serial.print(F("MIFARE_Read() failed: "));
|
||||
Serial.println(GetStatusCodeName(status));
|
||||
Serial.println(GetStatusCodeName(status).c_str());
|
||||
break;
|
||||
}
|
||||
// Dump data
|
||||
@ -1723,7 +1759,7 @@ bool MFRC522::MIFARE_OpenUidBackdoor(bool logErrors) {
|
||||
if(logErrors) {
|
||||
Serial.println(F("Card did not respond to 0x40 after HALT command. Are you sure it is a UID changeable one?"));
|
||||
Serial.print(F("Error name: "));
|
||||
Serial.println(GetStatusCodeName(status));
|
||||
Serial.println(GetStatusCodeName(status).c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1745,7 +1781,7 @@ bool MFRC522::MIFARE_OpenUidBackdoor(bool logErrors) {
|
||||
if(logErrors) {
|
||||
Serial.println(F("Error in communication at command 0x43, after successfully executing 0x40"));
|
||||
Serial.print(F("Error name: "));
|
||||
Serial.println(GetStatusCodeName(status));
|
||||
Serial.println(GetStatusCodeName(status).c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1805,7 +1841,7 @@ bool MFRC522::MIFARE_SetUid(byte *newUid, byte uidSize, bool logErrors) {
|
||||
// We tried, time to give up
|
||||
if (logErrors) {
|
||||
Serial.println(F("Failed to authenticate to card for reading, could not set UID: "));
|
||||
Serial.println(GetStatusCodeName(status));
|
||||
Serial.println(GetStatusCodeName(status).c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1813,7 +1849,7 @@ bool MFRC522::MIFARE_SetUid(byte *newUid, byte uidSize, bool logErrors) {
|
||||
else {
|
||||
if (logErrors) {
|
||||
Serial.print(F("PCD_Authenticate() failed: "));
|
||||
Serial.println(GetStatusCodeName(status));
|
||||
Serial.println(GetStatusCodeName(status).c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1826,7 +1862,7 @@ bool MFRC522::MIFARE_SetUid(byte *newUid, byte uidSize, bool logErrors) {
|
||||
if (status != STATUS_OK) {
|
||||
if (logErrors) {
|
||||
Serial.print(F("MIFARE_Read() failed: "));
|
||||
Serial.println(GetStatusCodeName(status));
|
||||
Serial.println(GetStatusCodeName(status).c_str());
|
||||
Serial.println(F("Are you sure your KEY A for sector 0 is 0xFFFFFFFFFFFF?"));
|
||||
}
|
||||
return false;
|
||||
@ -1858,7 +1894,7 @@ bool MFRC522::MIFARE_SetUid(byte *newUid, byte uidSize, bool logErrors) {
|
||||
if (status != STATUS_OK) {
|
||||
if (logErrors) {
|
||||
Serial.print(F("MIFARE_Write() failed: "));
|
||||
Serial.println(GetStatusCodeName(status));
|
||||
Serial.println(GetStatusCodeName(status).c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1884,7 +1920,7 @@ bool MFRC522::MIFARE_UnbrickUidSector(bool logErrors) {
|
||||
if (status != STATUS_OK) {
|
||||
if (logErrors) {
|
||||
Serial.print(F("MIFARE_Write() failed: "));
|
||||
Serial.println(GetStatusCodeName(status));
|
||||
Serial.println(GetStatusCodeName(status).c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -336,11 +336,13 @@ public:
|
||||
StatusCode PCD_MIFARE_Transceive(byte *sendData, byte sendLen, bool acceptTimeout = false);
|
||||
// old function used too much memory, now name moved to flash; if you need char, copy from flash to memory
|
||||
//const char *GetStatusCodeName(byte code);
|
||||
static const __FlashStringHelper *GetStatusCodeName(StatusCode code);
|
||||
// static const __FlashStringHelper *GetStatusCodeName(StatusCode code);
|
||||
String GetStatusCodeName(StatusCode code);
|
||||
static PICC_Type PICC_GetType(byte sak);
|
||||
// old function used too much memory, now name moved to flash; if you need char, copy from flash to memory
|
||||
//const char *PICC_GetTypeName(byte type);
|
||||
static const __FlashStringHelper *PICC_GetTypeName(PICC_Type type);
|
||||
// static const __FlashStringHelper *PICC_GetTypeName(PICC_Type type);
|
||||
String PICC_GetTypeName(PICC_Type type);
|
||||
|
||||
// Support functions for debuging
|
||||
void PCD_DumpVersionToSerial();
|
||||
|
@ -86,7 +86,7 @@ void RC522ScanForTag(void) {
|
||||
}
|
||||
#endif // USE_RC522_DATA_FUNCTION
|
||||
#ifdef USE_RC522_TYPE_INFORMATION
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_TYPE "\":\"%s\""), Mfrc522->PICC_GetTypeName(picc_type));
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_TYPE "\":\"%s\""), Mfrc522->PICC_GetTypeName(picc_type).c_str());
|
||||
#endif // USE_RC522_TYPE_INFORMATION
|
||||
ResponseJsonEndEnd();
|
||||
MqttPublishTeleSensor();
|
||||
|
Loading…
x
Reference in New Issue
Block a user