diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-07-26 16:34:16 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-07-26 16:34:16 +0300 |
| commit | 5accee4df85cc47b5700ad32090451ded2a121fa (patch) | |
| tree | 11dc6229de126d5c9fc8135bfeacd88151e6ed77 /Software/Embedded_SW | |
| parent | 4ff8fc0265f11be7b73548e36c7ee3d1debfb8e4 (diff) | |
| download | Tango-5accee4df85cc47b5700ad32090451ded2a121fa.tar.gz Tango-5accee4df85cc47b5700ad32090451ded2a121fa.zip | |
warning removed. diagnostics stops when the commtx mailbox is full.
Diffstat (limited to 'Software/Embedded_SW')
18 files changed, 56 insertions, 29 deletions
diff --git a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c index aa50b4db8..b6841ef7e 100644 --- a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c +++ b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c @@ -122,7 +122,7 @@ void communicationTask(UArg arg0, UArg arg1) } -uint32_t CommunicationTaskSendMessage(char* buffer,size_t length) +bool CommunicationTaskSendMessage(char* buffer,size_t length) { CommTxMessageStruc Message; CommTxMsgCounter++; @@ -131,9 +131,9 @@ uint32_t CommunicationTaskSendMessage(char* buffer,size_t length) Message.msgSize = length; Message.Buff = buffer; if (CommunicationTxMsgQ != NULL) - /*retcode =*/ Mailbox_post(CommunicationTxMsgQ , &Message, BIOS_NO_WAIT); + return Mailbox_post(CommunicationTxMsgQ , &Message, BIOS_NO_WAIT); - return OK; + return false; } int32_t SetCommunicationPath(bool UARTorUSB) { diff --git a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.h b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.h index 5746eb825..50309c899 100644 --- a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.h +++ b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.h @@ -21,7 +21,7 @@ extern uint32_t CommunicationTaskInit(void); extern uint32_t CommunicationTaskMessageReceived(uint16_t msgSize); -extern uint32_t CommunicationTaskSendMessage(char* buffer,size_t length); +extern bool CommunicationTaskSendMessage(char* buffer,size_t length); #define isUART true #define isUSB false diff --git a/Software/Embedded_SW/Embedded/Communication/Connection.c b/Software/Embedded_SW/Embedded/Communication/Connection.c index ed7aa9dfc..320dc56d1 100644 --- a/Software/Embedded_SW/Embedded/Communication/Connection.c +++ b/Software/Embedded_SW/Embedded/Communication/Connection.c @@ -18,8 +18,11 @@ #include "Common/SW_Info/SW_Info.h" #include "Common/report/report.h" #include <utils/ustdlib.h> + #include "StateMachines/Printing/PrintingSTM.h" -#include "drivers/Uart_Comm/Uart.h" + +#include "Modules/heaters/heaters_ex.h" +#include "modules/AlarmHandling/Diagnostics.h" void ConnectionRequest(MessageContainer* requestContainer) diff --git a/Software/Embedded_SW/Embedded/Communication/Container.c b/Software/Embedded_SW/Embedded/Communication/Container.c index 60e972968..5cecd48f0 100644 --- a/Software/Embedded_SW/Embedded/Communication/Container.c +++ b/Software/Embedded_SW/Embedded/Communication/Container.c @@ -32,12 +32,13 @@ #include "Modules/General/GeneralHardware.h" #include "Modules/heaters/heaters_ex.h" #include "Modules/AlarmHandling/AlarmHandling.h" -//#include "Drivers/USB_Communication/USBCDCD.h" +#include "modules/AlarmHandling/Diagnostics.h" +#include "Modules/General/process.h" +#include "Modules/Thread/Thread_ex.h" + #include "Communication/CommunicationTask.h" #include "StateMachines/Printing/PrintingSTM.h" -#include "Modules/General/process.h" -#include "Modules/Thread/Thread_ex.h" #include "Common/report/report.h" #include "Connection.h" @@ -274,7 +275,7 @@ void receive_callback(char* buffer, size_t length) message_container__free_unpacked(requestContainer, NULL); } -uint32_t SendChars(char* buffer,size_t length) +bool SendChars(char* buffer,size_t length) { return CommunicationTaskSendMessage(buffer, length); } diff --git a/Software/Embedded_SW/Embedded/Communication/Container.h b/Software/Embedded_SW/Embedded/Communication/Container.h index 8e9aaacf9..212814160 100644 --- a/Software/Embedded_SW/Embedded/Communication/Container.h +++ b/Software/Embedded_SW/Embedded/Communication/Container.h @@ -7,6 +7,6 @@ MessageContainer createContainer(MessageType type, char* token, protobuf_c_boolean completed, void* response, size_t (*packPtr)(void*, uint8_t*), size_t (*sizePtr)(void*)); void receive_callback(char* buffer, size_t length); -uint32_t SendChars(char* buffer,size_t length); +bool SendChars(char* buffer,size_t length); #endif //CONTAINER_H diff --git a/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c b/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c index c36850b85..7ccba0545 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c +++ b/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c @@ -37,7 +37,6 @@ uint32_t HeaterActive = 0; static GPIOIntPortMap portMap[MAX_HEATERS_NUM] = { -#warning temporarily moving SSR2 before SSR1 due to hardware changes {DRYER_SSR2_CTRL, false}, // HARDWARE_PID_CONTROL_TYPE__DryerHeater1000w {DRYER_SSR1_CTRL, false}, // HARDWARE_PID_CONTROL_TYPE__DryerHeater1000w //{DRYER_SSR2_CTRL, false},// HARDWARE_PID_CONTROL_TYPE__DryerHeater200w1 diff --git a/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.h b/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.h index b1fb14f08..687d24679 100644 --- a/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.h +++ b/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.h @@ -77,7 +77,7 @@ void USBCDC_close(void); void USBCDCD_hwiHandler(UArg arg0); -uint32_t SendChars(char* buffer,size_t length); +//bool SendChars(char* buffer,size_t length); #ifdef __cplusplus } #endif diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 53cca5284..9337676e4 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -29,7 +29,7 @@ #include <PMR/Diagnostics/EventType.pb-c.h> #include "PMR/debugging/DebugLogCategory.pb-c.h" - +#include "StateMachines/Printing/PrintingSTM.h" Task_Handle AlarmHandling_Task_Handle; @@ -126,10 +126,12 @@ uint32_t AlarmHandlingConsequentActions(EventType EventId, DebugLogCategory Seve //raise flag fr next job break; case DEBUG_LOG_CATEGORY__Error: - AbortJob(NULL,event_type__descriptor.name[EventId]); + JobEndReason = JOB_OTHER_ALARM; + EndState(NULL,event_type__descriptor.name[EventId]); //Stop Job break; case DEBUG_LOG_CATEGORY__Critical: + JobEndReason = JOB_OTHER_ALARM; EndState(NULL,event_type__descriptor.name[EventId]); //stop job //turn machine off diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/Diagnostics.c index e67fe68bb..63624b596 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/Diagnostics.c @@ -37,6 +37,9 @@ char DiagnosticsToken[36+1] = {0}; bool DiagnosticsActive = false; void SendDiagnostics(void); +uint32_t DiagnosticsStart(void); +uint32_t DiagnosticsStop(void); + uint32_t Diagnostics_ControlTrigger(uint32_t IfIndex, uint32_t ReadValue); @@ -251,9 +254,11 @@ void SendDiagnostics(void) free(responseContainer.data.data); DiagnosticsReset(); - SendChars(container_buffer, container_size); - + if (SendChars(container_buffer, container_size) == false) //comm tx mailbox full + { + DiagnosticsStop(); + } } uint32_t DiagnosticsControlId = 0xff; bool DiagnosticRequestAccepted = false; @@ -261,7 +266,7 @@ uint32_t DiagnosticsEmptyCBFunction(uint32_t IfIndex, uint32_t ReadValue) { return OK; } -uint32_t DiagnosticsStart() +uint32_t DiagnosticsStart(void) { if ( DiagnosticsActive == false) @@ -274,7 +279,7 @@ uint32_t DiagnosticsStart() } return OK; } -uint32_t DiagnosticsStop() +uint32_t DiagnosticsStop(void) { if ( DiagnosticsActive == true) { @@ -293,7 +298,6 @@ uint32_t StartDiagnosticsRequestFunc(MessageContainer* requestContainer) // ReportInitParams InitParams; //ControlStart(); DiagnosticRequestAccepted = true; -#warning test only - shoud be started and stopped with job execution DiagnosticsStart(); StartDiagnosticsRequest* request = start_diagnostics_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/Diagnostics.h b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/Diagnostics.h index d25b8f7fe..97820f8a8 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/Diagnostics.h +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/Diagnostics.h @@ -11,8 +11,8 @@ uint32_t StartDiagnosticsRequestFunc(MessageContainer* requestContainer); uint32_t StopDiagnosticsRequestFunc(MessageContainer* requestContainer); -uint32_t DiagnosticsStart(); -uint32_t DiagnosticsStop(); +uint32_t DiagnosticsStart(void); +uint32_t DiagnosticsStop(void); void DiagnosticsReset(void); void DiagnosticCollection(void); diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index cc87f6611..757db6116 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -11,6 +11,8 @@ #include "ids/ids.h" #include "control/control.h" #include "heaters/heaters_ex.h" +#include "StateMachines/Printing/PrintingSTM.h" + #include "PMR/common/MessageContainer.pb-c.h" #include "PMR/Hardware/UploadHardWareConfigurationRequest.pb-c.h" #include "PMR/Hardware/UploadHardWareConfigurationResponse.pb-c.h" @@ -125,8 +127,6 @@ void HWSystemResetRequest(MessageContainer* requestContainer) responseContainer = createContainer(MESSAGE_TYPE__SystemResetResponse, requestContainer->token, true, &response, &system_reset_response__pack, &system_reset_response__get_packed_size); - Write_status_response(status); - //free(request); system_reset_request__free_unpacked(request,NULL); //------------------------------------------------------------------------------------------- diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h index 6fd9fd8d8..b19cd61be 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h @@ -12,6 +12,8 @@ void HeatingTestPollRequest(MessageContainer* requestContainer); bool HeaterCheckReady(void); +void HeatingStopReporting(void); + bool HeaterGetOverTemperatureState(uint8_t HeaterId); uint32_t HeatersEnd(void); diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 7cd70067d..a145ac1f9 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -45,7 +45,6 @@ typedef struct HeatersControlMessage{ HeaterCommand HeaterCmd[MAX_HEATERS_NUM]; uint32_t ControlIdtoHeaterId [MAX_HEATERS_NUM] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; uint32_t DryerHeaterMaxTempControl = 0xFF; -#warning the PT100 id for the dryer control is number2 - dryer internal ambient sensor. uint32_t HeaterId2PT100Id[MAX_HEATERS_NUM] = {TEMP_SENSE_ANALOG_DRYER_TEMP1,TEMP_SENSE_ANALOG_DRYER_TEMP1,TEMP_SENSE_ANALOG_DRYER_TEMP3,TEMP_SENSE_ANALOG_DYEINGH_TEMP1,TEMP_SENSE_ANALOG_DYEINGH_TEMP2,TEMP_SENSE_ANALOG_DYEINGH_TEMP3,TEMP_SENSE_ANALOG_DYEINGH_TEMP4,TEMP_SENSE_ANALOG_DYEINGH_TEMP5,TEMP_SENSE_ANALOG_MIXCHIP_TEMP,TEMP_SENSE_ANALOG_MIXCHIP_TEMP}; uint32_t DryerInternalPT100Id = TEMP_SENSE_ANALOG_DRYER_TEMP2; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index c8d2e6362..0680e97a4 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -10,6 +10,7 @@ #include "drivers/Motors/Motor.h" #include "StateMachines/Printing/PrintingSTM.h" #include "Modules/Control/Control.h" +#include "Modules/Control/MillisecTask.h" #include "modules/General/process.h" diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index d19b447d9..b6c1fea57 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -360,6 +360,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) if (ReadBreakSensor()==ERROR) { //LOG_ERROR(index, "ReadBreakSensor Error"); + JobEndReason = JOB_DANCER_FAIL; //SendJobProgress(0.0,0,false, "ReadBreakSensor Error"); EndState(CurrentJob,"ReadBreakSensor Error" ); } @@ -371,6 +372,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) { usnprintf(Message, 60, "Dancer %d limit %d value %d Zero %d",DancerId,DancerStopActivityLimit[index],avreageSampleValue,DancersCfg[DancerId].zeropoint); JobAbortedByUser = true; + JobEndReason = JOB_THREAD_BREAK; EndState(CurrentJob,Message ); } NormalizedError = avreageSampleValue*NormalizedErrorCoEfficient[index]; diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index e0ca07930..e8fbe277e 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -45,6 +45,7 @@ #include "./printingSTM.h" #include "modules/thread/thread_ex.h" #include "modules/ids/ids_ex.h" +#include "Modules/heaters/heaters_ex.h" #define INVALID_MSG_ID 0xFFFF @@ -54,6 +55,7 @@ Mailbox_Handle JobmsgQ = NULL; //static Clock_Handle JobClock; //static Clock_Params jobclkParams; +JobEndReasonEnum JobEndReason = JOB_OK; #define MAX_TICKET_SIZE 10000 @@ -407,7 +409,7 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes // Report(logmsg,__FILE__,__LINE__,msdid,RpWarning,SegmentId, done); if (JobToken[0] == 0) - return OK; + return; JobResponse response = JOB_RESPONSE__INIT; @@ -429,6 +431,11 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes { responseContainer = createContainer(MESSAGE_TYPE__JobResponse, JobToken, true, &response, &job_response__pack, &job_response__get_packed_size); container_buffer = malloc(message_container__get_packed_size(&responseContainer)); + if (JobEndReason != JOB_OK) + { + responseContainer.has_error = true; + responseContainer.error = ERROR_CODE__GENERAL_ERROR; + } } else { @@ -498,6 +505,7 @@ Void jobTask(UArg arg0, UArg arg1) switch (Message.messageId) { case JobRequestMsg: + JobEndReason = JOB_OK; /*ValidateState (CurrentJob); break; case ValidationResultsOk:*/ diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c index 70932b145..72be73f61 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c @@ -404,12 +404,11 @@ uint32_t EndState(void *JobDetails, char *Message) } //ROM_IntMasterEnable(); JobMessageStruc JobMessage; - bool retcode = false; JobMessage.messageId = PrintingResultsOk; JobMessage.msglen = MAX_MSG_LEN; if (JobmsgQ != NULL) - retcode = Mailbox_post(JobmsgQ , &JobMessage, BIOS_NO_WAIT); + Mailbox_post(JobmsgQ , &JobMessage, BIOS_NO_WAIT); return OK; } diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h index a3af9c42b..be3edf4c1 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h @@ -78,6 +78,15 @@ typedef enum ModuleDone, ModuleFail } ModuleStateEnum; +typedef enum +{ + JOB_OK, + JOB_THREAD_BREAK, + JOB_DANCER_FAIL, + JOB_OUT_OF_DYE, + JOB_OTHER_ALARM +}JobEndReasonEnum; +extern JobEndReasonEnum JobEndReason; #define MAX_JOB_NAME_LEN 40 #define MAX_SEGMENT_NUM 30 @@ -136,8 +145,6 @@ void AbortJob(char *Msg); void SendJobProgress(double ProcessedLength,int SegmentId, bool done, char *Message); -uint32_t PrintingHWConfiguration(void *Configuration); - uint32_t PrepareReady(int ModuleId, ModuleStateEnum result); uint32_t PreSegmentReady(int ModuleId, ModuleStateEnum result); uint32_t SegmentReady(int ModuleId, ModuleStateEnum result); |
