diff --git a/mac_receiver.c b/mac_receiver.c
index 63e8e09..ca2d104 100644
--- a/mac_receiver.c
+++ b/mac_receiver.c
@@ -23,6 +23,8 @@ void send_DATA_IND(Adresse source, Adresse destination, uint8_t* dataFramePtr) {
}
strPtr[dataFramePtr[2]] = '\0'; // null-terminate string
queueMsg.anyPtr = strPtr;
+ //retCode = osMemoryPoolFree(memPool, dataFramePtr);
+ //CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
switch (destination.sapi) {
case TIME_SAPI:
diff --git a/mac_sender.c b/mac_sender.c
index ee4a558..7c4fc9f 100644
--- a/mac_sender.c
+++ b/mac_sender.c
@@ -15,7 +15,8 @@ const osMessageQueueAttr_t queue_macData_attr = {
void sendToken() {
struct queueMsg_t queueMsg;
- queueMsg.anyPtr = lastToken;
+ queueMsg.anyPtr = osMemoryPoolAlloc(memPool,osWaitForever);
+ memcpy(queueMsg.anyPtr, lastToken, TOKENSIZE-2);
queueMsg.type = TO_PHY;
osStatus_t retCode = osMessageQueuePut(
queue_phyS_id,
@@ -60,6 +61,7 @@ void MacSender(void *argument) {
//----------------------------------------------------------------------
case TOKEN: {
// Get token and save it
+ //lastToken = osMemoryPoolAlloc(memPool,osWaitForever);
memcpy(lastToken, msg, TOKENSIZE-2);
// update token
@@ -70,7 +72,8 @@ void MacSender(void *argument) {
// send to lcd
queueMsg.type = TOKEN_LIST;
- queueMsg.anyPtr = lastToken;
+ memcpy(queueMsg.anyPtr , lastToken, TOKENSIZE-2);
+ //queueMsg.anyPtr = lastToken;
retCode = osMessageQueuePut(
queue_lcd_id,
&queueMsg,
@@ -91,6 +94,8 @@ void MacSender(void *argument) {
0);
CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
} else {
+ retCode = osMemoryPoolFree(memPool, queueMsg.anyPtr);
+ CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
sendToken();
}
break;
@@ -196,7 +201,8 @@ void MacSender(void *argument) {
}
gTokenInterface.station_list[gTokenInterface.myAddress] = (0x1 << TIME_SAPI) + (gTokenInterface.connected << CHAT_SAPI);
lastToken[gTokenInterface.myAddress+1] = gTokenInterface.station_list[gTokenInterface.myAddress];
-
+ sendToken();
+ /*
queueMsg.type = TO_PHY;
queueMsg.anyPtr = lastToken;
@@ -206,6 +212,7 @@ void MacSender(void *argument) {
osPriorityNormal,
osWaitForever);
CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
+ */
break;
}
diff --git a/main.h b/main.h
index 2cf9529..3c2ba57 100644
--- a/main.h
+++ b/main.h
@@ -16,7 +16,7 @@
//--------------------------------------------------------------------------------
// Constants to change the system behavior
//--------------------------------------------------------------------------------
-#define DEBUG_MODE 1 // mode is physical line (0) or debug (1)
+#define DEBUG_MODE 0 // mode is physical line (0) or debug (1)
#define MYADDRESS 3 // your address choice (table number)
#define MAX_BLOCK_SIZE 100 // size max for a frame
diff --git a/tokenring_project.uvoptx b/tokenring_project.uvoptx
index b18b2c9..d6555e7 100644
--- a/tokenring_project.uvoptx
+++ b/tokenring_project.uvoptx
@@ -159,7 +159,7 @@