Fix FrameCounter Read from EEPROM for Beacon Mode
This commit is contained in:
parent
12bed1f861
commit
a37dba6ae9
|
@ -170,12 +170,16 @@ void setup()
|
|||
// Get the Last Saved (=Highest) Frame Counter
|
||||
uint16_t Frame_Counter_Sv = 0x00000000;
|
||||
uint8_t eeprom_addr = 0x0000;
|
||||
bool value_found = 0;
|
||||
EEPROM.get(eeprom_addr, Frame_Counter_Sv);
|
||||
while (eeprom_addr < 32*sizeof(Frame_Counter_Tx)) {
|
||||
if (Frame_Counter_Sv != 0x0000)
|
||||
value_found = 1;
|
||||
if (Frame_Counter_Sv > Frame_Counter_Tx) {
|
||||
Frame_Counter_Tx = Frame_Counter_Sv;
|
||||
} else {
|
||||
break;
|
||||
if (value_found)
|
||||
break;
|
||||
}
|
||||
eeprom_addr += sizeof(Frame_Counter_Tx);
|
||||
EEPROM.get(eeprom_addr, Frame_Counter_Sv);
|
||||
|
|
Loading…
Reference in New Issue