Hi guys
I got some code here (in c), basically, I got an send() function, it will return true if the data is send successfully. In this send() function, it deals with CSMA/CA and CSMA/CD stuff. So I need to add some random delay between an fail send() and the next retry.
So my question is how can I estimate what is the best range for getRandomNumber(min, max), to get the minimum collision.
Let's say I have 100 wireless devices, there is about 1 packet data need to be send per second. The wireless devices are in a mesh network.
Thanks guys
I got some code here (in c), basically, I got an send() function, it will return true if the data is send successfully. In this send() function, it deals with CSMA/CA and CSMA/CD stuff. So I need to add some random delay between an fail send() and the next retry.
Code:
uint8_t random = 0;
uint8_t counter = 0;
while(send() == false)
{
random = getRandomNumber(min, max); // generate an random number
delay_ms(random); // random delay
counter++;
if (counter > max_retry) break; // if fail too many times, exit
}
Let's say I have 100 wireless devices, there is about 1 packet data need to be send per second. The wireless devices are in a mesh network.
Thanks guys