Skip to content

Commit 856d970

Browse files
committed
RFID invisible on GUI when disabled
1 parent bb8f921 commit 856d970

File tree

6 files changed

+18
-4
lines changed

6 files changed

+18
-4
lines changed

src/main.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@
4949
#include "tesla_client.h"
5050
#include "event.h"
5151
#include "ocpp.h"
52-
#include "pn532.h"
5352
#include "rfid.h"
5453

54+
#if defined(ENABLE_PN532)
55+
#include "pn532.h"
56+
#endif
57+
5558
#include "LedManagerTask.h"
5659
#include "event_log.h"
5760
#include "evse_man.h"

src/pn532.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Author: Matthias Akstaller
33
*/
44

5+
#if defined(ENABLE_PN532)
6+
57
#if defined(ENABLE_DEBUG) && !defined(ENABLE_DEBUG_NFCREADER)
68
#undef ENABLE_DEBUG
79
#endif
@@ -297,3 +299,5 @@ void PN532::read() {
297299
}
298300

299301
PN532 pn532;
302+
303+
#endif

src/pn532.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Author: Matthias Akstaller
33
*/
44

5+
#if defined(ENABLE_PN532)
6+
57
#ifndef PN532_H
68
#define PN532_H
79

@@ -44,3 +46,4 @@ class PN532 : public RfidReader, public MicroTasks::Task {
4446
extern PN532 pn532;
4547

4648
#endif
49+
#endif

src/rfid.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ unsigned long RfidTask::loop(MicroTasks::WakeReason reason){
111111
updateEvseClaim();
112112

113113
if (!config_rfid_enabled()) {
114-
resetAuthentication();
114+
if (!authenticatedTag.isEmpty()) {
115+
resetAuthentication();
116+
}
115117
return 1000;
116118
}
117119

@@ -153,7 +155,7 @@ String RfidTask::getAuthenticatedTag(){
153155
}
154156

155157
void RfidTask::resetAuthentication(){
156-
authenticatedTag = String('\0');
158+
authenticatedTag.clear();
157159

158160
DynamicJsonDocument data{JSON_OBJECT_SIZE(1) + authenticatedTag.length() + 1};
159161
data["rfid_auth"] = authenticatedTag;

src/web_server.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,9 @@ handleStatus(MongooseHttpServerRequest *request) {
588588

589589
doc["ocpp_connected"] = (int)MongooseOcppSocketClient::ocppConnected();
590590

591+
#if defined(ENABLE_PN532) || defined(ENABLE_RFID)
591592
doc["rfid_failure"] = (int) rfid.communicationFails();
593+
#endif
592594

593595
doc["ohm_hour"] = ohm_hour;
594596

0 commit comments

Comments
 (0)