-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LoRaWAN: fcntUp wraps after 50 transmissions #950
Comments
I have a suspicion, I will investigate. Good find! |
Got it. The If it bothers you personally, the fix is to change lines 818/819 to uint8_t fcntBuffStart = mod->hal->getPersistentAddr(RADIOLIB_EEPROM_LORAWAN_FCNT_UP_ID);
uint8_t fcntBuffEnd = mod->hal->getPersistentAddr(RADIOLIB_EEPROM_LORAWAN_FCNT_UP_ID + 1);
uint8_t buffSize = fcntBuffEnd - fcntBuffStart;
#if RADIOLIB_STATIC_ONLY
uint8_t fcntBuff[RADIOLIB_STATIC_ARRAY_SIZE];
#else
uint8_t* fcntBuff = new uint8_t[buffSize];
#endif
mod->hal->readPersistentStorage(mod->hal->getPersistentAddr(RADIOLIB_EEPROM_LORAWAN_FCNT_UP_ID), fcntBuff, buffSize); And modify the two occurrences of simply '30' in the lines 859 & 864 to |
@StevenCellist thank you so much for your quick investigation! I'll apply your fix locally, looking forward to your PR :) |
Welcome and thank you for digging this out + providing the easy code for me to run. I suspect this also solves behaviour that I thought I dreamt of where some packets went missing, but it may also help in solving #949 which will come clear soon. @jgromes while debugging this, I noticed that |
@StevenCellist good catch - no, that is not intentional. I guess I never really used god mode to acces private members from |
Bug description
The
fcntUp
wraps around after 50 transmissions, resulting in no more messages being received by the network server.Reproduction
The bug can be reproduced as follows in god mode without sending 50 uplinks:
The output is as follows and shows the wrap around after 50 iterations:
Log output
Expected behavior
The
fcntUp
should not wrap before the uint32 is full.Additional info
The text was updated successfully, but these errors were encountered: