Skip to content
Snippets Groups Projects
Commit cde7d6dd authored by Anian Bühler's avatar Anian Bühler
Browse files

fixed interval error

parent a1de1259
Branches
No related tags found
1 merge request!5Dev
This commit is part of merge request !5. Comments created here will be created in the context of that merge request.
......@@ -43,10 +43,10 @@ bool DidacticPSNet::handleNetwork(){
handleData();
}
}
_waitingTime = millis()+ random(CSMA_MIN_DELAY_MS, CSMA_MAX_DELAY_MS);
_waitingTimeCSMA = millis()+ random(CSMA_MIN_DELAY_MS, CSMA_MAX_DELAY_MS);
}
//else if(_dataToSend){
if(_dataToSend && _waitingTime <= millis()){
if(_dataToSend && _waitingTimeSend <= millis() && _waitingTimeCSMA <= millis()){
//send data to network
//TODO: test added CSMA_CHECKDELAY + 2nd checkData()
delayMicroseconds(CSMA_CHECK_DELAY_US);
......@@ -57,7 +57,7 @@ bool DidacticPSNet::handleNetwork(){
else{
_dataToSend = false;
//_waitingTime = millis()+ random(CSMA_MID_DELAY_MS, CSMA_MAX_DELAY_MS);
_waitingTime = millis()+ _intervalTime;//random(CSMA_MID_DELAY_MS, CSMA_MAX_DELAY_MS);
_waitingTimeSend = millis() + _intervalTime;//random(CSMA_MID_DELAY_MS, CSMA_MAX_DELAY_MS);
}
}
}
......
......@@ -110,7 +110,8 @@ class DidacticPSNet
char _sendBufferMessage[MAX_LEN_TOPICS + MAX_LEN_PAYLOAD + LEN_OVERHEAD +1];
bool _dataToSend = false; // int Data to send for queue?
unsigned long _waitingTime = 0L;
unsigned long _waitingTimeSend = 0L;
unsigned long _waitingTimeCSMA = 0L;
unsigned long _intervalTime = 0L;
int _currentTopicLength = 0;
int _currentPayloadLength = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment