mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-23 09:06:02 +00:00
start msg sequence numbers with a random number each boot
This commit is contained in:
parent
31eb2f5337
commit
5a4fab2506
@ -5,7 +5,6 @@
|
||||
Minimum items needed to make sure hardware is good.
|
||||
|
||||
- add a hard fault handler
|
||||
- at boot we are starting our message IDs at 1, rather we should start them at a random number. also, seed random based on timer. this could be the cause of our first message not seen bug.
|
||||
- use "variants" to get all gpio bindings
|
||||
- plug in correct variants for the real board
|
||||
- Use the PMU driver on real hardware
|
||||
@ -57,6 +56,7 @@ Needed to be fully functional at least at the same level of the ESP32 boards. At
|
||||
- currently using soft device SD140, is that ideal?
|
||||
- turn on the watchdog timer, require servicing from key application threads
|
||||
- install a hardfault handler for null ptrs (if one isn't already installed)
|
||||
- nrf52setup should call randomSeed(tbd)
|
||||
|
||||
## Things to do 'someday'
|
||||
|
||||
@ -97,6 +97,7 @@ Nice ideas worth considering someday...
|
||||
- DONE track rxbad, rxgood, txgood
|
||||
- DONE neg 7 error code from receive
|
||||
- DONE remove unused sx1262 lib from github
|
||||
- at boot we are starting our message IDs at 1, rather we should start them at a random number. also, seed random based on timer. this could be the cause of our first message not seen bug.
|
||||
|
||||
```
|
||||
|
||||
|
@ -164,6 +164,8 @@ void axp192Init()
|
||||
|
||||
void esp32Setup()
|
||||
{
|
||||
randomSeed(esp_random()); // ESP docs say this is fairly random
|
||||
|
||||
#ifdef AXP192_SLAVE_ADDRESS
|
||||
axp192Init();
|
||||
#endif
|
||||
|
@ -61,8 +61,14 @@ static Periodic sendOwnerPeriod(sendOwnerCb);
|
||||
// FIXME, move this someplace better
|
||||
PacketId generatePacketId()
|
||||
{
|
||||
static uint32_t i __attribute__((
|
||||
section(".noinit"))); // We try to keep this in noinit so that hopefully it keeps increasing even across reboots
|
||||
static uint32_t i; // Note: trying to keep this in noinit didn't help for working across reboots
|
||||
static bool didInit = false;
|
||||
|
||||
if (!didInit) {
|
||||
didInit = true;
|
||||
i = random(0, NUM_PACKET_ID +
|
||||
1); // pick a random initial sequence number at boot (to prevent repeated reboots always starting at 0)
|
||||
}
|
||||
|
||||
i++;
|
||||
return (i % NUM_PACKET_ID) + 1; // return number between 1 and 255
|
||||
|
@ -67,4 +67,5 @@ void nrf52Setup()
|
||||
{
|
||||
// Not yet on board
|
||||
// pmu.init();
|
||||
DEBUG_MSG("FIXME, need to call randomSeed on nrf52!\n");
|
||||
}
|
@ -101,7 +101,7 @@ class RadioLibInterface : public RadioInterface
|
||||
void applyModemConfig();
|
||||
|
||||
/** Could we send right now (i.e. either not actively receiving or transmitting)? */
|
||||
virtual bool canSendImmediately();
|
||||
bool canSendImmediately();
|
||||
|
||||
/** are we actively receiving a packet (only called during receiving state) */
|
||||
virtual bool isActivelyReceiving() = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user