aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Communication/Connection.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2020-01-13 18:02:20 +0200
committerShlomo Hecht <shlomo@twine-s.com>2020-01-13 18:02:20 +0200
commit18a3cf5d3cdec6142ee41f5beff5f63e6c68285c (patch)
tree4ae27f913abfd02cb6779f3b0388d1ee719e3ee7 /Software/Embedded_SW/Embedded/Communication/Connection.c
parentc3c4c18e1c6e834b734243f968fca0555e901753 (diff)
downloadTango-18a3cf5d3cdec6142ee41f5beff5f63e6c68285c.tar.gz
Tango-18a3cf5d3cdec6142ee41f5beff5f63e6c68285c.zip
Version 1.4.6.3 fix power down reports, enable feeder as speed master, prepare keepalive testing for reconnection
Diffstat (limited to 'Software/Embedded_SW/Embedded/Communication/Connection.c')
-rw-r--r--Software/Embedded_SW/Embedded/Communication/Connection.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/Software/Embedded_SW/Embedded/Communication/Connection.c b/Software/Embedded_SW/Embedded/Communication/Connection.c
index 9f355fa59..473aa05ee 100644
--- a/Software/Embedded_SW/Embedded/Communication/Connection.c
+++ b/Software/Embedded_SW/Embedded/Communication/Connection.c
@@ -133,8 +133,9 @@ void DisconnectionRequest(MessageContainer* requestContainer)
}
int KeepAliveOneSecondCounter = 0;
-#define KEEPALIVE_COMMUNICATION_ABORT_LIMIT 30
+#define KEEPALIVE_COMMUNICATION_ABORT_LIMIT 10
bool KeepAliveActive = false;
+bool keepalivetest = false;
void KeepAliveRequestFunc(MessageContainer* requestContainer)
{
MessageContainer responseContainer;
@@ -142,7 +143,8 @@ void KeepAliveRequestFunc(MessageContainer* requestContainer)
//KeepAliveRequest* request = keep_alive_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data);
KeepAliveResponse response = KEEP_ALIVE_RESPONSE__INIT;
- KeepAliveOneSecondCounter = 0;
+ if (keepalivetest == false)
+ KeepAliveOneSecondCounter = 0;
KeepAliveActive = true;
responseContainer = createContainer(MESSAGE_TYPE__KeepAliveResponse, requestContainer->token, true, &response, &keep_alive_response__pack, &keep_alive_response__get_packed_size);
//-------------------------------------------------------------------------------------------
@@ -156,21 +158,28 @@ void KeepAliveOneSecondCall(void)
{
if (KeepAliveActive == false)
return;
+ if (FileUploadGetState()==false)
+ return;
+
KeepAliveOneSecondCounter++;
+ if (KeepAliveOneSecondCounter > (KEEPALIVE_COMMUNICATION_ABORT_LIMIT/2))
+ {
+ Report("keepalive danger",__FILE__,__LINE__,KeepAliveOneSecondCounter,RpWarning,msec_millisecondCounter, 0);
+ }
if (KeepAliveOneSecondCounter > KEEPALIVE_COMMUNICATION_ABORT_LIMIT)
{
Report("keepalive ",__FILE__,__LINE__,KeepAliveOneSecondCounter,RpWarning,msec_millisecondCounter, 0);
//LOG_ERROR(KeepAliveOneSecondCounter, "Communication keepalive failed");
KeepAliveOneSecondCounter = 0;
KeepAliveActive = false;
- ReportStopReporting();
+ //ReportStopReporting();
DiagnosticsStop();
JobStopReporting();
- AlarmHandlingStop();
+ //AlarmHandlingStop();
//CommunicationMailboxFlush();
-
- USBCDCD_init();
- //USBCDCD_Reinit();
+ keepalivetest = false;
+ //USBCDCD_init();
+ USBCDCD_Reinit();
//UART_ResetBuffers();
}
}