From 1f1080370a2416d0ef6f762e273cad51758340db Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Mon, 18 Feb 2019 15:03:18 +0200 Subject: Version 1.3.7.3 INIT SEQUENCE - starts heating!. safe control remove in callbacks, watchdog is disabled during init sequence procedures, for now --- .../Embedded/Modules/Control/MillisecTask.c | 5 ++- .../Embedded_SW/Embedded/Modules/Control/control.c | 36 ++++++++++++++++++++++ .../Embedded_SW/Embedded/Modules/Control/control.h | 4 +++ 3 files changed, 44 insertions(+), 1 deletion(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Control') diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index 4f78d2134..e0462eb6c 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -458,9 +458,12 @@ uint32_t MillisecLowLoop(uint32_t tick) { MillisecReadFromTempSensor(Sensor_i, NULL); } - if (watchdogCriticalAlarm == false) + if (GeneralHwReady == true) { + if (watchdogCriticalAlarm == false) + { Control_WD(ENABLE,5); //activate heaters/dispenser watchdog, 0.5 seconds + } } } diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index b7521d796..93c989ab5 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -282,6 +282,42 @@ uint32_t AddControlCallback( ControlCBFunction Callback, CTRL_TIMING_ENUM CtrlF return deviceId; } +int SafeRemoveHighControlCallback(uint32_t deviceId , ControlCBFunction Callback) +{ + if (RemoveControlCallback(deviceId, Callback )!=OK) + { + Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlDevice_i(),RpWarning,(int)deviceId,0); + if (RemoveControlCallback(GetControlDevice_i(),Callback)==OK) + { + Report("Remove control callback fixed",__FILE__,__LINE__,(int)GetControlDevice_i(),RpWarning,(int)deviceId,0); + } + else + { + Report("Remove control callback failed",__FILE__,__LINE__,(int)GetControlDevice_i(),RpWarning,(int)deviceId,0); + return ERROR; + } + } + return OK; +} + +int SafeRemoveControlCallback(uint32_t deviceId , ControlCBFunction Callback) +{ + if (RemoveControlCallback(deviceId, Callback )!=OK) + { + Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)deviceId,0); + if (RemoveControlCallback(GetControlLowDevice_i(),Callback)==OK) + { + Report("Remove control callback fixed",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)deviceId,0); + } + else + { + Report("Remove control callback failed",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)deviceId,0); + return ERROR; + } + } + return OK; +} + int RemoveControlCallback(uint32_t deviceId , ControlCBFunction Callback) { if (deviceId == 0xFF) diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.h b/Software/Embedded_SW/Embedded/Modules/Control/control.h index 0bcaecb03..8d7e219ac 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.h +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.h @@ -39,6 +39,10 @@ void ControlStop(void); void ControlStart(void); uint32_t AddControlCallback( ControlCBFunction Callback, CTRL_TIMING_ENUM CtrlFrequency, DataReadCBFunction DriverfPtr, uint16_t IfIndex, uint32_t Parameter1, uint32_t Parameter2 ); int RemoveControlCallback(uint32_t deviceId, ControlCBFunction Callback ); +//The safe remove command can be used ONLY when called from the control callback itself +int SafeRemoveControlCallback(uint32_t deviceId , ControlCBFunction Callback); +int SafeRemoveHighControlCallback(uint32_t deviceId , ControlCBFunction Callback); + uint32_t TemplateDataReadCBFunction (uint32_t deviceId, uint32_t Parameter1); uint32_t GetControlDevice_i(void); uint32_t GetControlLowDevice_i(void); -- cgit v1.3.1 From 3fcd0dbc6650749421f0390a60154c52254682e6 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 19 Feb 2019 10:35:55 +0200 Subject: PNR file updated in embedded. --- .../Embedded/Common/report/reportInit.c | 2 -- .../PMR/Debugging/DebugLogCategory.pb-c.c | 4 +-- .../PMR/Debugging/DebugLogCategory.pb-c.h | 2 +- .../FirmwareUpgrade/VersionFileDestination.pb-c.c | 18 ++++++++--- .../FirmwareUpgrade/VersionFileDestination.pb-c.h | 6 +++- .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 4 ++- .../Embedded/Modules/Control/MillisecTask.c | 1 - .../Embedded_SW/Embedded/Modules/Control/control.c | 1 - .../Embedded/Modules/Thread/ThreadLoad.c | 5 ++- .../Embedded/StateMachines/Printing/JobSTM.c | 37 +++++++++------------- 10 files changed, 43 insertions(+), 37 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Control') diff --git a/Software/Embedded_SW/Embedded/Common/report/reportInit.c b/Software/Embedded_SW/Embedded/Common/report/reportInit.c index 982b53443..feb13504a 100644 --- a/Software/Embedded_SW/Embedded/Common/report/reportInit.c +++ b/Software/Embedded_SW/Embedded/Common/report/reportInit.c @@ -77,8 +77,6 @@ int ReportResponseFunc(char *message, /* The formatted message response.category = DEBUG_LOG_CATEGORY__Critical; break; case RpPrivate: - response.category = DEBUG_LOG_CATEGORY__Debug; - break; default: response.category = DEBUG_LOG_CATEGORY__Info; break; diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Debugging/DebugLogCategory.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Debugging/DebugLogCategory.pb-c.c index ebb901ba8..b651d2acb 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Debugging/DebugLogCategory.pb-c.c +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Debugging/DebugLogCategory.pb-c.c @@ -13,7 +13,7 @@ static const ProtobufCEnumValue debug_log_category__enum_values_by_number[5] = { "Warning", "DEBUG_LOG_CATEGORY__Warning", 1 }, { "Error", "DEBUG_LOG_CATEGORY__Error", 2 }, { "Critical", "DEBUG_LOG_CATEGORY__Critical", 3 }, - { "Debug", "DEBUG_LOG_CATEGORY__Debug", 4 }, + { "Safety", "DEBUG_LOG_CATEGORY__Safety", 4 }, }; static const ProtobufCIntRange debug_log_category__value_ranges[] = { {0, 0},{0, 5} @@ -21,9 +21,9 @@ static const ProtobufCIntRange debug_log_category__value_ranges[] = { static const ProtobufCEnumValueIndex debug_log_category__enum_values_by_name[5] = { { "Critical", 3 }, - { "Debug", 4 }, { "Error", 2 }, { "Info", 0 }, + { "Safety", 4 }, { "Warning", 1 }, }; const ProtobufCEnumDescriptor debug_log_category__descriptor = diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Debugging/DebugLogCategory.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Debugging/DebugLogCategory.pb-c.h index d97b42d33..1fda3ab01 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/Debugging/DebugLogCategory.pb-c.h +++ b/Software/Embedded_SW/Embedded/Communication/PMR/Debugging/DebugLogCategory.pb-c.h @@ -24,7 +24,7 @@ typedef enum _DebugLogCategory { DEBUG_LOG_CATEGORY__Warning = 1, DEBUG_LOG_CATEGORY__Error = 2, DEBUG_LOG_CATEGORY__Critical = 3, - DEBUG_LOG_CATEGORY__Debug = 4 + DEBUG_LOG_CATEGORY__Safety = 4 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(DEBUG_LOG_CATEGORY) } DebugLogCategory; diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/FirmwareUpgrade/VersionFileDestination.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/FirmwareUpgrade/VersionFileDestination.pb-c.c index 3e45ece3e..daa5f09e2 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/FirmwareUpgrade/VersionFileDestination.pb-c.c +++ b/Software/Embedded_SW/Embedded/Communication/PMR/FirmwareUpgrade/VersionFileDestination.pb-c.c @@ -7,22 +7,30 @@ #endif #include "VersionFileDestination.pb-c.h" -static const ProtobufCEnumValue version_file_destination__enum_values_by_number[4] = +static const ProtobufCEnumValue version_file_destination__enum_values_by_number[8] = { { "MCU", "VERSION_FILE_DESTINATION__MCU", 0 }, { "FPGA1", "VERSION_FILE_DESTINATION__FPGA1", 1 }, { "FPGA2", "VERSION_FILE_DESTINATION__FPGA2", 2 }, { "FPGA3", "VERSION_FILE_DESTINATION__FPGA3", 3 }, + { "ConfigParams", "VERSION_FILE_DESTINATION__ConfigParams", 4 }, + { "ProcessParams", "VERSION_FILE_DESTINATION__ProcessParams", 5 }, + { "AlarmParams", "VERSION_FILE_DESTINATION__AlarmParams", 6 }, + { "GeneralHWConfigParams", "VERSION_FILE_DESTINATION__GeneralHWConfigParams", 7 }, }; static const ProtobufCIntRange version_file_destination__value_ranges[] = { -{0, 0},{0, 4} +{0, 0},{0, 8} }; -static const ProtobufCEnumValueIndex version_file_destination__enum_values_by_name[4] = +static const ProtobufCEnumValueIndex version_file_destination__enum_values_by_name[8] = { + { "AlarmParams", 6 }, + { "ConfigParams", 4 }, { "FPGA1", 1 }, { "FPGA2", 2 }, { "FPGA3", 3 }, + { "GeneralHWConfigParams", 7 }, { "MCU", 0 }, + { "ProcessParams", 5 }, }; const ProtobufCEnumDescriptor version_file_destination__descriptor = { @@ -31,9 +39,9 @@ const ProtobufCEnumDescriptor version_file_destination__descriptor = "VersionFileDestination", "VersionFileDestination", "", - 4, + 8, version_file_destination__enum_values_by_number, - 4, + 8, version_file_destination__enum_values_by_name, 1, version_file_destination__value_ranges, diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/FirmwareUpgrade/VersionFileDestination.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/FirmwareUpgrade/VersionFileDestination.pb-c.h index 83686d194..fbada1aee 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/FirmwareUpgrade/VersionFileDestination.pb-c.h +++ b/Software/Embedded_SW/Embedded/Communication/PMR/FirmwareUpgrade/VersionFileDestination.pb-c.h @@ -23,7 +23,11 @@ typedef enum _VersionFileDestination { VERSION_FILE_DESTINATION__MCU = 0, VERSION_FILE_DESTINATION__FPGA1 = 1, VERSION_FILE_DESTINATION__FPGA2 = 2, - VERSION_FILE_DESTINATION__FPGA3 = 3 + VERSION_FILE_DESTINATION__FPGA3 = 3, + VERSION_FILE_DESTINATION__ConfigParams = 4, + VERSION_FILE_DESTINATION__ProcessParams = 5, + VERSION_FILE_DESTINATION__AlarmParams = 6, + VERSION_FILE_DESTINATION__GeneralHWConfigParams = 7 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(VERSION_FILE_DESTINATION) } VersionFileDestination; diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index c9f4ac1ee..de0bd5d1f 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -360,6 +360,8 @@ uint32_t AlarmHandlingConsequentActions(uint32_t AlarmId, DebugLogCategory Sever //raise flag fr next job break; case DEBUG_LOG_CATEGORY__Critical: + case DEBUG_LOG_CATEGORY__Safety: + watchdogCriticalAlarm = true; /* //stop all dispensers @@ -416,7 +418,7 @@ uint32_t AlarmHandlingConsequentActions(uint32_t AlarmId, DebugLogCategory Sever }*/ break; - case DEBUG_LOG_CATEGORY__Debug: + case DEBUG_LOG_CATEGORY__Info: default: //do nothing diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index e0462eb6c..e8a60a8c4 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -44,7 +44,6 @@ Task_Handle Millisecond_Task_Handle; /******************** Definitions ********************************************/ -#define INVALID_MSG_ID 0xFFFF /******************** STRUCTURES AND ENUMs ********************************************/ typedef struct MillisecMotorData diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c index 93c989ab5..e4abc5e3c 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c @@ -56,7 +56,6 @@ #include "control.h" #include "MillisecTask.h" /******************** Definitions ********************************************/ -#define INVALID_MSG_ID 0xFFFF #define MAX_TANGO_CONTROL_DEVICES 100 /******************** STRUCTURES AND ENUMs ********************************************/ diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index e89dc4c6d..0bc2d04de 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -211,7 +211,10 @@ if (CallbackCounter == 0) { LoadStages++; - //ThreadLoadStateMachine(LoadStages); + if (LoadStages != THREAD_LOAD_INITIAL_TENSION) //on this satge we should wait for user call + { + //ThreadLoadStateMachine(LoadStages); + } } } else diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index cffe77000..08233ce9a 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -65,27 +65,27 @@ #include "Modules/control/control.h" -#define INVALID_MSG_ID 0xFFFF +#define MAX_TICKET_SIZE 10000 Mailbox_Handle JobmsgQ = NULL; -//static Clock_Handle JobClock; -//static Clock_Params jobclkParams; - JobEndReasonEnum JobEndReason = JOB_OK; ErrorCode JobError_to_ErrorCode[JOB_ERRORS_MAX+1] = {ERROR_CODE__NONE,ERROR_CODE__JOB_UNSPECIFIED_ERROR,ERROR_CODE__JOB_THREAD_BREAK,ERROR_CODE__JOB_WINDER_DANCER_FAIL, ERROR_CODE__JOB_POOLER_DANCER_FAIL,ERROR_CODE__JOB_FEEDER_DANCER_FAIL,ERROR_CODE__JOB_OUT_OF_DYE,ERROR_CODE__JOB_OTHER_ALARM, ERROR_CODE__JOB_TEMPERATURE_ALARM,ERROR_CODE__JOB_LS_ALARM,ERROR_CODE__JOB_PRESSURE_ALARM,ERROR_CODE__JOB_CURRENT_ALARM, ERROR_CODE__JOB_MOTOR_ALARM,ERROR_CODE__JOB_OTHER_ALARM}; -#define MAX_TICKET_SIZE 10000 -//char CurrentJobBuffer[MAX_TICKET_SIZE]; -JobTicket *CurrentJob = NULL;//(JobTicket *)CurrentJobBuffer; +JobTicket *CurrentJob = NULL; JobRequest *CurrentRequest = NULL; -//char PreviousJobBuffer[MAX_TICKET_SIZE]; -//JobTicket *PreviousJob = (JobTicket *)PreviousJobBuffer; - +double previousJobLength; +uint32_t StubControlId = 0xFF; +double StubLengthCounter = 0,StubLength = 0,StubSpeed=0; +JobTicket Ticket; +JobSegment *TSegment; +JobSpool *Tspool; +bool CopyConfigured[MAX_SYSTEM_MODULES]; +char ErrorMsg[100]; ModuleStateEnum PrepareWaiting[MAX_SYSTEM_MODULES] = {ModuleIdle,ModuleIdle,ModuleIdle,ModuleIdle,ModuleIdle}; @@ -342,16 +342,7 @@ void JobAbortFunc(MessageContainer* requestContainer) } -double previousJobLength; -char ErrorMsg[100]; -uint32_t StubControlId = 0xFF; -double StubLengthCounter = 0,StubLength = 0,StubSpeed=0; -//#include "PMR/Diagnostics/ThreadJoggingResponse.pb-c.h" -//#include "PMR/Diagnostics/ThreadAbortJoggingRequest.pb-c.h" -JobTicket Ticket; -JobSegment *TSegment; -JobSpool *Tspool; -bool CopyConfigured[MAX_SYSTEM_MODULES]; +//******************************************************************************************************************** uint32_t ThreadJoggingFunc(int speed) { ProcessParameters ProcessParametersCopy; @@ -621,7 +612,8 @@ void JobRequestFunc(MessageContainer* requestContainer) JobAlarmReason = AlarmHandlingPrepareJob(CurrentJob); if (JobAlarmReason ==OK) { - if (Ticket->processparameters) +#warning Process parameters in job request are not handled. push separately for now + /*if (Ticket->processparameters) { if (HandleProcessParameters(Ticket->processparameters)!= OK) { @@ -629,7 +621,8 @@ void JobRequestFunc(MessageContainer* requestContainer) error = ERROR_CODE__INVALID_PARAMETER; usnprintf(ErrorMsg, 100, "Hardware Parameters Not Set"); } - } + }*/ + REPORT_MSG(0,"Process parameters in job request are not handled. push separately for now"); if (Ticket->spool) { if (InternalWindingConfigMessage(Ticket->spool)!= OK) -- cgit v1.3.1