From 54bbfadd8f76d0ee9a4457ff8a54a802b41a30cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anian=20B=C3=BChler?= <anian.buehler@reutlingen-university.de> Date: Mon, 7 Feb 2022 13:23:09 +0100 Subject: [PATCH] fixed second CSMA-delay --- src/didacticNet.cpp | 4 +++- src/didacticNet.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/didacticNet.cpp b/src/didacticNet.cpp index 54dacbc..67fc6c5 100644 --- a/src/didacticNet.cpp +++ b/src/didacticNet.cpp @@ -49,7 +49,9 @@ bool didacticPSNet::handleNetwork(){ else if(_dataToSend){ //send data to network //TODO: test added CSMA_CHECKDELAY + 2nd checkData() - delayMicroseconds(CSMA_CHECK_DELAY_US); + unsigned long delayStartTime = micros(); + while(micros() < delayStartTime + CSMA_CHECK_DELAY_US); + //delayMicroseconds(CSMA_CHECK_DELAY_US); //removed: blocking SoftSerial-interrupts if(!checkData()){ if(!sendData()){ return false; diff --git a/src/didacticNet.h b/src/didacticNet.h index 6d4642e..d705777 100644 --- a/src/didacticNet.h +++ b/src/didacticNet.h @@ -31,7 +31,7 @@ #define CSMA_MID_DELAY_MS 20 #define CSMA_MAX_DELAY_MS 30 -#define MAX_NR_TOPICS_CLIENT 5 +#define MAX_NR_TOPICS_CLIENT 10 #define MAX_NR_TOPICS_BROKER 20 #define MAX_LEN_TOPICS 10 #define MAX_LEN_DATA 20 -- GitLab