From 55dffe48de95cb51b3a1a30e2ffc4336ec3bb2b2 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Sun, 8 Nov 2020 10:27:23 +0200 Subject: attempt thread logging support, some logs in IDS. --- .../Embedded/Modules/Thread/ThreadLoad.c | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c') diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 63072e4d8..1d310cf01 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -49,6 +49,7 @@ #include "PMR/ThreadLoading/TryThreadLoadingResponse.pb-c.h" #include "PMR/ThreadLoading/StopThreadLoadingRequest.pb-c.h" #include "PMR/ThreadLoading/StopThreadLoadingResponse.pb-c.h" +#include "PMR/ThreadLoading/AttemptThreadJoggingResponse.pb-c.h" //#include //#include @@ -1597,3 +1598,48 @@ uint32_t StopThreadLoadingFunc(MessageContainer* requestContainer) return OK; } +uint8_t attemptJogCounter = 0; +#define ATTEMPT_JOG_TIMEOUT 18 +char AttemptJoggingToken[36+1] = {0}; + +uint32_t AttemptThreadJoggingCallback(uint32_t index, uint32_t ReadValue) +{ + AttemptThreadJoggingResponse response = ATTEMPT_THREAD_JOGGING_RESPONSE__INIT; + MessageContainer responseContainer; + + attemptJogCounter++; + Report("AttemptThreadJoggingCallback",__FILE__,attemptJogCounter,JobEndReason,RpWarning,(int)JobIsActive(),0); + if (attemptJogCountertoken,36); + Report("AttemptThreadJoggingFunc",__FILE__,__LINE__,0xFF,RpWarning,(int)ATTEMPT_JOG_TIMEOUT,0); + LoadingControlId = AddControlCallback("Load jog",AttemptThreadJoggingCallback, eOneSecond,TemplateDataReadCBFunction,0,0,0); + ThreadJoggingFunc(30); + return OK; +} + -- cgit v1.3.1 From 3f48ba5fcac73aeb6510a7f7bb2e1d482585aeff Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Sun, 8 Nov 2020 14:35:29 +0200 Subject: check and fix attmptthreadjogging handling --- .../Embedded/Modules/Stubs_Handler/Progress.c | 2 +- .../Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c') diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c index e694810d7..c6cfbb1d1 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c @@ -1249,7 +1249,7 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) if(request->amount == 0xB24) //Set loading arm cycles { REPORT_MSG(request->delay,"AttemptThreadJoggingFunc"); - AttemptThreadJoggingFunc(1); + AttemptThreadJoggingFunc(NULL); response.progress = 0xb24; response.has_progress = true; } diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 1d310cf01..cdb726b5e 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -1621,22 +1621,26 @@ uint32_t AttemptThreadJoggingCallback(uint32_t index, uint32_t ReadValue) responseContainer.has_error = true; responseContainer.error = getJobError_to_ErrorCode(JobEndReason); } - SafeRemoveControlCallback(LoadingControlId, Thread_Load_Jog_ThreadStop ); + SafeRemoveControlCallback(LoadingControlId, AttemptThreadJoggingCallback ); LoadingControlId = 0xFF; - responseContainer = createContainer(MESSAGE_TYPE__AttemptThreadJoggingResponse, AttemptJoggingToken, true, &response, &attempt_thread_jogging_response__pack, &attempt_thread_jogging_response__get_packed_size); - responseContainer.continuous = false; - uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); - size_t container_size = message_container__pack(&responseContainer, container_buffer); - my_free(responseContainer.data.data); - SendChars((char*)container_buffer, container_size); + if (AttemptJoggingToken[0]) + { + responseContainer = createContainer(MESSAGE_TYPE__AttemptThreadJoggingResponse, AttemptJoggingToken, true, &response, &attempt_thread_jogging_response__pack, &attempt_thread_jogging_response__get_packed_size); + responseContainer.continuous = false; + uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); + size_t container_size = message_container__pack(&responseContainer, container_buffer); + my_free(responseContainer.data.data); + SendChars((char*)container_buffer, container_size); + } return OK; } uint32_t AttemptThreadJoggingFunc(MessageContainer* requestContainer) { attemptJogCounter = 0; - ustrncpy (AttemptJoggingToken, requestContainer->token,36); + if(requestContainer) + ustrncpy (AttemptJoggingToken, requestContainer->token,36); Report("AttemptThreadJoggingFunc",__FILE__,__LINE__,0xFF,RpWarning,(int)ATTEMPT_JOG_TIMEOUT,0); LoadingControlId = AddControlCallback("Load jog",AttemptThreadJoggingCallback, eOneSecond,TemplateDataReadCBFunction,0,0,0); ThreadJoggingFunc(30); -- cgit v1.3.1