Skip to content

Commit

Permalink
OneWire.cpp: correctly initialize RFIDlist on 1st powerup
Browse files Browse the repository at this point in the history
  • Loading branch information
mstegen committed Oct 27, 2024
1 parent 9fa36a4 commit da34a9c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion SmartEVSE-3/src/OneWire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,19 @@ void ReadRFIDlist(void) {
uint8_t initialized = 0;
unsigned char RFIDold[600]; // old RFID buffer

if (preferences.begin("RFIDlist", true) ) { // read only
if (preferences.begin("RFIDlist", false) ) { // read/write
initialized = preferences.getUChar("RFIDinit", 0);
switch (initialized) {
case 1: // we were initialized to old 120 bytes mode
preferences.getBytes("RFID", RFIDold, 120); // read 120 bytes from storage
//we are now going to convert from RFIDold 120bytes to RFIDlist 700bytes
expandUIDArray(RFIDold, RFIDlist, 120);
preferences.remove("RFID");
preferences.end();
WriteRFIDlist();
break;
case 0:
preferences.end();
DeleteAllRFID(); // when unitialized, delete all cardIDs
setItemValue(MENU_RFIDREADER, 0); // RFID Reader Disabled
break;
Expand Down

0 comments on commit da34a9c

Please sign in to comment.