better handling of application reset in emulation

This commit is contained in:
Georg
2016-10-24 12:54:42 +02:00
parent 4c7b09962b
commit 28db2471eb
3 changed files with 6 additions and 4 deletions
+6 -1
View File
@@ -1,5 +1,6 @@
#include "AntennaLevel.h"
#include "LEDHook.h"
#include "Application/Application.h"
#define FIELD_MIN_RSSI 500
@@ -8,7 +9,11 @@ void AntennaLevelTick(void)
uint16_t rssi = AntennaLevelGet();
if (rssi < FIELD_MIN_RSSI)
{
LEDHook(LED_FIELD_DETECTED, LED_OFF);
else
if (ActiveConfiguration.UidSize != 0) // this implies that we are emulating right now
ApplicationReset(); // reset the application just like a real card gets reset when there is no field
} else {
LEDHook(LED_FIELD_DETECTED, LED_ON);
}
}
@@ -73,7 +73,6 @@ void MifareUltralightAppInit(void)
void MifareUltralightAppReset(void)
{
State = STATE_IDLE;
FromHalt = false;
}
void MifareUltralightAppTask(void)
@@ -433,8 +433,6 @@ void ISO14443ACodecTask(void) {
/* We have to generate the parity bits ourself */
ParityBufferPtr = 0;
}
} else {
ApplicationReset();
}
if (AnswerBitCount != ISO14443A_APP_NO_RESPONSE) {