aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Communication
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-05-30 17:33:20 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-05-30 17:33:20 +0300
commitb525fbcad1ac8c7126caa82ec8458ffbb6284384 (patch)
tree61abe4c1610fc2e0b6af8e5f926d5624692df2fe /Software/Embedded_SW/Embedded/Communication
parent405096b3d489f4ea7b50b1d5db7d32241251b8d7 (diff)
downloadTango-b525fbcad1ac8c7126caa82ec8458ffbb6284384.tar.gz
Tango-b525fbcad1ac8c7126caa82ec8458ffbb6284384.zip
Version 1.4.0.4: Improved memory handling, handles SW crash after a job failure
Diffstat (limited to 'Software/Embedded_SW/Embedded/Communication')
-rw-r--r--Software/Embedded_SW/Embedded/Communication/CommunicationTask.c11
-rw-r--r--Software/Embedded_SW/Embedded/Communication/Container.c42
2 files changed, 36 insertions, 17 deletions
diff --git a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c
index 23f193b25..27780a9e3 100644
--- a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c
+++ b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c
@@ -201,7 +201,12 @@ int32_t SetCommunicationPath(bool UARTorUSB)
CommType = UARTorUSB;
return OK;
}
+/*#define MAX_CONT_LOG 199
+uint16_t cSendSize[MAX_CONT_LOG+1] = {0};
+uint32_t cSendTime[MAX_CONT_LOG+1] = {0};
+uint16_t cSendindex = 0;
+*/
/******************************************************************************
* ======== communicationTask ========
* Task for this function is created statically. See the project's .cfg file.
@@ -230,6 +235,12 @@ void communicationTxTask(UArg arg0, UArg arg1)
else if (CommType == isUART)
Uart_Tx(CommTxMessage.Buff, CommTxMessage.msgSize);
}
+/* cSendSize[cSendindex] = CommTxMessage.msgSize;
+ cSendTime[cSendindex] = msec_millisecondCounter;
+
+ if (cSendindex++>=MAX_CONT_LOG)
+ cSendindex = 0;
+*/
if (diagnosticscontainer_buffer == CommTxMessage.Buff)
diagnosticscontainer_buffer = 0;
my_free(CommTxMessage.Buff);
diff --git a/Software/Embedded_SW/Embedded/Communication/Container.c b/Software/Embedded_SW/Embedded/Communication/Container.c
index dd89c7b15..89deb2b0b 100644
--- a/Software/Embedded_SW/Embedded/Communication/Container.c
+++ b/Software/Embedded_SW/Embedded/Communication/Container.c
@@ -48,16 +48,16 @@
#include "Common/report/report.h"
#include "Connection.h"
-#define MAX_CONT_LOG 100
+#define MAX_CONT_LOG 199
-uint16_t TxmsgId[MAX_CONT_LOG+1] = {0};
+/*uint16_t TxmsgId[MAX_CONT_LOG+1] = {0};
uint16_t TxLength[MAX_CONT_LOG+1] = {0};
uint32_t TxAddr[MAX_CONT_LOG+1] = {0};
uint16_t Txindex = 0;
uint32_t msgId[MAX_CONT_LOG+1] = {0};
uint32_t Length[MAX_CONT_LOG+1] = {0};
uint32_t DataLength[MAX_CONT_LOG+1] = {0};
-byte index = 0;
+byte RxIndex = 0;*/
MessageContainer createContainer(MessageType type, char* token, protobuf_c_boolean completed, void* response, size_t (*packPtr)(void*, uint8_t*), size_t (*sizePtr)(void*))
@@ -79,7 +79,7 @@ MessageContainer createContainer(MessageType type, char* token, protobuf_c_boole
container.data.data = response_buffer;
container.data.len = response_size;
- if (SuspendLargeMessages == true)
+ /*if (SuspendLargeMessages == true)
{
// Report("EndJobMessage",__FILE__,__LINE__,(int)type,RpWarning,(int)response_size,0);
TxmsgId[Txindex] = type;
@@ -87,7 +87,7 @@ MessageContainer createContainer(MessageType type, char* token, protobuf_c_boole
TxAddr[Txindex] = msec_millisecondCounter;
if (Txindex++>=MAX_CONT_LOG)
Txindex = 0;
- }
+ }*/
//free(response);
return container;
@@ -131,18 +131,17 @@ void receive_callback(char* buffer, size_t length)
MessageContainer* requestContainer = message_container__unpack(NULL, length, (uint8_t*)buffer);
if (requestContainer == NULL)
return;
- // HeatingTestSendResonse(0, false,true,true, /*OriginalMotorSpd_2PPS[index]*/length,requestContainer->type,0,0, "Container");
if (requestContainer->type != MESSAGE_TYPE__KeepAliveRequest) //user action resets the idle counter
{
resetIdleCounter();
REPORT_MSG(requestContainer->type,"Message received");
}
KeepAliveOneSecondCounter = 0;
- msgId[index] = requestContainer->type;
- Length[index] = length;
- DataLength[index] = msec_millisecondCounter;
- if (index++>=MAX_CONT_LOG)
- index = 0;
+ /*msgId[RxIndex] = requestContainer->type;
+ Length[RxIndex] = length;
+ DataLength[RxIndex] = msec_millisecondCounter;
+ if (RxIndex++>=MAX_CONT_LOG)
+ RxIndex = 0;*/
switch(requestContainer->type)
{
case MESSAGE_TYPE__CalculateRequest:
@@ -433,13 +432,19 @@ void receive_callback(char* buffer, size_t length)
message_container__free_unpacked(requestContainer, NULL);
}
-bool SendResult,KeepSendResult = true;
+/*bool SendResult,KeepSendResult = true;
uint16_t SendmsgId[MAX_CONT_LOG+1] = {0};
uint16_t SendSize[MAX_CONT_LOG+1] = {0};
uint32_t SendTime[MAX_CONT_LOG+1] = {0};
-uint16_t Sendindex = 0;
+bool Sendresult[MAX_CONT_LOG+1] = {0};
+uint16_t Sendindex = 0;*/
bool SendChars(char* buffer,size_t length)
{
+/* SendmsgId[Sendindex] = 0xFFFF;
+ SendSize[Sendindex] = length;
+ SendTime[Sendindex] = msec_millisecondCounter;
+ if (Sendindex++>=MAX_CONT_LOG)
+ Sendindex = 0;*/
SendResult = CommunicationTaskSendMessage(buffer, length);
if (SendResult == false)
KeepSendResult = false;
@@ -447,12 +452,15 @@ bool SendChars(char* buffer,size_t length)
}
bool SendCharsWithType(char* buffer,size_t length,MessageType type)
{
- SendmsgId[Sendindex] = type;
- SendSize[Sendindex] = length;
- SendTime[Sendindex] = msec_millisecondCounter;
+// SendmsgId[Sendindex] = type;
+// SendSize[Sendindex] = length;
+// SendTime[Sendindex] = msec_millisecondCounter;
+
+ SendResult = CommunicationTaskSendMessage(buffer, length);
+
+// Sendresult[Sendindex] = SendResult;
if (Sendindex++>=MAX_CONT_LOG)
Sendindex = 0;
- SendResult = CommunicationTaskSendMessage(buffer, length);
if (SendResult == false)
KeepSendResult = false;
return SendResult;