aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Communication/Connection.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-10-31 15:09:11 +0200
committerShlomo Hecht <shlomo@twine-s.com>2018-10-31 15:09:11 +0200
commite94f4ad6873324ac69f9e0d4abaef816a7696a2b (patch)
tree0c584e4ced29d7f32c8136466e62a3e37f71a1ba /Software/Embedded_SW/Embedded/Communication/Connection.c
parent4973c8ff53c8758852f707af5cc7f4a6a82151e0 (diff)
downloadTango-e94f4ad6873324ac69f9e0d4abaef816a7696a2b.tar.gz
Tango-e94f4ad6873324ac69f9e0d4abaef816a7696a2b.zip
usb reconnected after ka failure. filesystem draft
Diffstat (limited to 'Software/Embedded_SW/Embedded/Communication/Connection.c')
-rw-r--r--Software/Embedded_SW/Embedded/Communication/Connection.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/Software/Embedded_SW/Embedded/Communication/Connection.c b/Software/Embedded_SW/Embedded/Communication/Connection.c
index 6faa315de..7fe5c58a5 100644
--- a/Software/Embedded_SW/Embedded/Communication/Connection.c
+++ b/Software/Embedded_SW/Embedded/Communication/Connection.c
@@ -100,7 +100,6 @@ void DisconnectionRequest(MessageContainer* requestContainer)
responseContainer = createContainer(MESSAGE_TYPE__DisconnectResponse, requestContainer->token, true, &response, &disconnect_response__pack, &disconnect_response__get_packed_size);
ReportStopReporting();
DiagnosticsStop();
- HeatingStopReporting();
JobStopReporting();
AlarmHandlingStop();
//UART_ResetBuffers();
@@ -112,10 +111,13 @@ void DisconnectionRequest(MessageContainer* requestContainer)
//free(container_buffer);
//free(requestContainer);
disconnect_request__free_unpacked(request,NULL);
+ CommunicationMailboxFlush();
+ USBCDCD_Reinit();
+
}
int KeepAliveOneSecondCounter = 0;
#define KEEPALIVE_COMMUNICATION_ABORT_LIMIT 30
-
+bool KeepAliveActive = false;
void KeepAliveRequestFunc(MessageContainer* requestContainer)
{
MessageContainer responseContainer;
@@ -124,17 +126,8 @@ void KeepAliveRequestFunc(MessageContainer* requestContainer)
KeepAliveResponse response = KEEP_ALIVE_RESPONSE__INIT;
KeepAliveOneSecondCounter = 0;
+ KeepAliveActive = true;
responseContainer = createContainer(MESSAGE_TYPE__KeepAliveResponse, requestContainer->token, true, &response, &keep_alive_response__pack, &keep_alive_response__get_packed_size);
- /*
-
- ReportStopReporting();
- DiagnosticsStop();
- HeatingStopReporting();
- JobStopReporting();
- AlarmHandlingStop();
- //UART_ResetBuffers();
-
- */
//-------------------------------------------------------------------------------------------
uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer));
size_t container_size = message_container__pack(&responseContainer, container_buffer);
@@ -146,17 +139,20 @@ void KeepAliveRequestFunc(MessageContainer* requestContainer)
}
void KeepAliveOneSecondCall(void)
{
+ if (KeepAliveActive == false)
+ return;
KeepAliveOneSecondCounter++;
if (KeepAliveOneSecondCounter > KEEPALIVE_COMMUNICATION_ABORT_LIMIT)
{
LOG_ERROR(KeepAliveOneSecondCounter, "Communication keepalive failed");
KeepAliveOneSecondCounter = 0;
- /* ReportStopReporting();
+ KeepAliveActive = false;
+ ReportStopReporting();
DiagnosticsStop();
- HeatingStopReporting();
JobStopReporting();
AlarmHandlingStop();
- */
+ CommunicationMailboxFlush();
+ USBCDCD_Reinit();
//UART_ResetBuffers();
}
}