From a42f2ebe0053a912ac8c14fd05831b8fae8e0506 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 14 Feb 2019 11:02:28 +0200 Subject: version 1.3.7.1: cancel cone presence checks, load dancer middle point from file, tech board support for drier head, --- Software/Embedded_SW/Embedded/Modules/Control/control.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Control') diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.h b/Software/Embedded_SW/Embedded/Modules/Control/control.h index d50868064..0bcaecb03 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/control.h +++ b/Software/Embedded_SW/Embedded/Modules/Control/control.h @@ -40,8 +40,8 @@ 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 ); uint32_t TemplateDataReadCBFunction (uint32_t deviceId, uint32_t Parameter1); -uint32_t GetControlDevice_i(void); -uint32_t GetControlLowDevice_i(void); +uint32_t GetControlDevice_i(void); +uint32_t GetControlLowDevice_i(void); extern Task_Handle Control_Task_Handle; extern uint32_t millisecondCounter; -- cgit v1.3.1 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/Common/SWUpdate/FirmwareUpgrade.c | 8 ++-- .../Embedded_SW/Embedded/Common/SW_Info/SW_Info.c | 2 +- .../Embedded/Common/report/reportInit.c | 2 +- .../Drivers/I2C_Communication/DAC/Blower.c | 19 ++------ .../Embedded/Drivers/Motors/MotorActions.c | 28 ++++++------ .../Embedded_SW/Embedded/Drivers/Valves/Valve.c | 16 +------ Software/Embedded_SW/Embedded/Main.c | 4 +- .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 2 +- .../Embedded/Modules/Control/MillisecTask.c | 5 +- .../Embedded_SW/Embedded/Modules/Control/control.c | 36 +++++++++++++++ .../Embedded_SW/Embedded/Modules/Control/control.h | 4 ++ .../Embedded/Modules/General/GeneralHardware.c | 30 +++++++++--- .../Embedded/Modules/General/GeneralHardware.h | 1 + .../Embedded_SW/Embedded/Modules/General/process.c | 50 +++++++++++++++++++- .../Embedded_SW/Embedded/Modules/General/process.h | 1 + .../Embedded/Modules/IDS/IDS_dispenser.c | 53 +++------------------- .../Embedded_SW/Embedded/Modules/IDS/IDS_maint.c | 15 +----- .../Embedded/Modules/Thread/ThreadLoad.c | 6 ++- .../Embedded/Modules/Thread/Thread_init.c | 2 +- .../StateMachines/Initialization/InitSequence.c | 12 ++--- .../stubs/embeddedparametersbuild.cs | 38 +++++++--------- 21 files changed, 185 insertions(+), 149 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Control') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c index e029bf2ce..6378420fa 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c @@ -28,7 +28,7 @@ uint32_t ActivateVersionRequestFunc(MessageContainer* requestContainer) { void* buffer = NULL; uint32_t Bytes = 0; - char SWINFOPath[100]; + char SWUpgradePath[100]; char FullPath[50]; FRESULT Fresult = FR_OK; int File_i; @@ -43,10 +43,10 @@ uint32_t ActivateVersionRequestFunc(MessageContainer* requestContainer) FPGA_ID FileDestinationToFPGAId[VERSION_FILE_DESTINATION__FPGA3+1] = {MAX_FPGA,FPGA1,FPGA2,FPGA3}; - strcpy (SWINFOPath,request->path); - strcat(SWINFOPath,"/file1.pck"); + strcpy (SWUpgradePath,request->path); + strcat(SWUpgradePath,"/package.cfg"); - Fresult = FileRead(SWINFOPath, &Bytes, &buffer); + Fresult = FileRead(SWUpgradePath, &Bytes, &buffer); if (Fresult == FR_OK) { VersionPackage = version_package_descriptor__unpack(NULL,Bytes,buffer); diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c index c0b0493fc..67e678790 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c @@ -20,7 +20,7 @@ typedef struct } TangoVersion_t; -TangoVersion_t _gTangoVersion = {1,3,7,1}; +TangoVersion_t _gTangoVersion = {1,3,7,3}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d diff --git a/Software/Embedded_SW/Embedded/Common/report/reportInit.c b/Software/Embedded_SW/Embedded/Common/report/reportInit.c index d5fe116a7..982b53443 100644 --- a/Software/Embedded_SW/Embedded/Common/report/reportInit.c +++ b/Software/Embedded_SW/Embedded/Common/report/reportInit.c @@ -138,7 +138,7 @@ uint32_t ReportInitMessage(MessageContainer* requestContainer) */ uint32_t RESC = SysCtlResetCauseGet (); LOG_ERROR(RESC,"Reset Reason Register"); - SysCtlResetCauseClear(RESC); + /*SysCtlResetCauseClear(RESC);*/ return status; } uint32_t StopReportInitMessage(MessageContainer* requestContainer) diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c index eced74d16..5534a710c 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c @@ -160,6 +160,7 @@ uint32_t Turn_the_Blower_Off() return status; } +/* uint32_t mInitial_mV, mTarget_mV; uint32_t mInterval = eOneSecond*20; uint32_t BlowerControlId = 0xFF; @@ -170,22 +171,11 @@ uint32_t Gradual_Increase_Blower_Callback(uint32_t DispenserId, uint32_t ReadVal { Control_Voltage_To_Blower(mTarget_mV); Report("Finished Increasing blower",__FILE__,__LINE__,(int)mTarget_mV,RpWarning,(int)millisecondCounter,0); - if (RemoveControlCallback(BlowerControlId, Gradual_Increase_Blower_Callback )==OK) - { - Report("Remove control callback",__FILE__,__LINE__,(int)1,RpWarning,(int)BlowerControlId,0); + + if (SafeRemoveControlCallback(BlowerControlId, Gradual_Increase_Blower_Callback )==OK) BlowerControlId = 0xFF; - } else - { - Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)BlowerControlId,0); - if (RemoveControlCallback(GetControlLowDevice_i(),Gradual_Increase_Blower_Callback)==OK) - { - Report("Remove control callback fixed",__FILE__,__LINE__,(int)1,RpWarning,(int)BlowerControlId,0); - BlowerControlId = 0xFF; - } - else - Report("Remove control callback failed",__FILE__,__LINE__,(int)1,RpWarning,(int)BlowerControlId,0); - } + Report("Remove control callback failed",__FILE__,__LINE__,(int)1,RpWarning,(int)BlowerControlId,0); return OK; } mInitial_mV = mInitial_mV+100; @@ -226,6 +216,7 @@ uint32_t Cancel_Gradual_Increase_Blower(uint32_t Initial_mV) } return OK; } +*/ diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c index 9e8b7c0b1..fcbd9ff6e 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c @@ -198,7 +198,7 @@ uint32_t MotorVerifiedCallBackFunction(uint32_t IfIndex, uint32_t ArmPosition) / { //stop this control loop REPORT_MSG(MotorPosition,"MotorVerifiedCallBackFunction stopped"); - RemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); + SafeRemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); MotorControlCallback[MotorId] = 0; MotorControlId[MotorId] = 0xFF; MotorStop(MotorId,Hard_Hiz ); @@ -264,8 +264,7 @@ uint32_t MotorMoveCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TODO if (BusyFlag == NOTBUSY) { //stop this control loop - //RemoveControlCallback(MotorControlId[MotorId], MotorMoveCallBackFunction ); - RemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); + SafeRemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); MotorControlCallback[MotorId] = 0; MotorControlId[MotorId] = 0xFF; //possibly: start regular control (speed etc) @@ -292,8 +291,7 @@ uint32_t MotorSetSpeedCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TO if (BusyFlag == 1) { //stop this control loop - //RemoveControlCallback(MotorControlId[MotorId], MotorSetSpeedCallBackFunction ); - RemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); + SafeRemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); MotorControlCallback[MotorId] = 0; MotorControlId[MotorId] = 0xFF; //possibly: start regular control (speed etc) @@ -306,7 +304,6 @@ uint32_t MotorSetSpeedCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TO } return OK; } - uint32_t MotorMoveToLimitSwitchCallBackFunction(uint32_t IfIndex, uint32_t LimitSwitch) //TODO { TimerMotors_t MotorId; @@ -324,11 +321,17 @@ uint32_t MotorMoveToLimitSwitchCallBackFunction(uint32_t IfIndex, uint32_t Limit if ((LimitSwitch == LIMIT) ||((MotorTimeout[MotorId]>=MotorTimeLimit[MotorId])&&(MotorTimeLimit[MotorId]>0))) { //stop this control loop - //RemoveControlCallback(MotorControlId[MotorId], MotorMoveToLimitSwitchCallBackFunction ); - RemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); + SafeRemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); MotorControlCallback[MotorId] = 0; MotorControlId[MotorId] = 0xFF; - MotorStop(MotorId,Hard_Hiz); //TODO in run time limit switch just reverse direction + if (MotorId == HARDWARE_MOTOR_TYPE__MOTO_RDANCER) + { + MotorStop(MotorId,Soft_Stop); //TODO in run time limit switch just reverse direction + } + else + { + MotorStop(MotorId,Hard_Hiz); //TODO in run time limit switch just reverse direction + } //possibly: start regular control (speed etc) //uint32_t ControlId = AddControlCallback(ControlCBFunction Callback, eOneMillisecond, (IfTypeMotors*0x100+MotorId), deviceId, Parameter ); @@ -349,7 +352,6 @@ uint32_t MotorMovetoLimitSwitch (TimerMotors_t MotorId,bool direction, uint32_t if (MotorControlId[MotorId] != 0xFF) { - //RemoveControlCallback(MotorControlId[MotorId], MotorMoveToLimitSwitchCallBackFunction ); RemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); MotorControlCallback[MotorId] = 0; MotorControlId[MotorId] = 0xFF; @@ -393,8 +395,7 @@ uint32_t MotorMoveToBreakSensorCallBackFunction(uint32_t IfIndex, uint32_t Limit if (mBreakSensorCounter > BreakSensordebouncetimemilli) { //stop this control loop - //RemoveControlCallback(MotorControlId[MotorId], MotorMoveToBreakSensorCallBackFunction ); - RemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); + SafeRemoveHighControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); MotorControlCallback[MotorId] = 0; MotorControlId[MotorId] = 0xFF; MotorStop(MotorId,Hard_Hiz); //TODO in run time limit switch just reverse direction @@ -415,7 +416,6 @@ uint32_t MotorMovetoBreakSensor (TimerMotors_t MotorId,bool direction, uint32_t //assert (callback); if (MotorControlId[MotorId] != 0xFF) { - //RemoveControlCallback(MotorControlId[MotorId], MotorMoveToBreakSensorCallBackFunction ); RemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); MotorControlCallback[MotorId] = 0; MotorControlId[MotorId] = 0xFF; @@ -466,7 +466,7 @@ uint32_t MotorMoveToDancerPositionCallBackFunction(uint32_t IfIndex, uint32_t Re //stop this control loop DancerValueDirection = false; DancerId = 0xFF; - RemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); + SafeRemoveControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); MotorControlCallback[MotorId] = 0; MotorControlId[MotorId] = 0xFF; MotorStop(MotorId,Hard_Hiz); //TODO in run time limit switch just reverse direction diff --git a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c index 3cf9de832..162e4f990 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c +++ b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c @@ -340,22 +340,10 @@ uint32_t Valve3WayCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) { EnableDisableDispenserValve((Valves_t)ValveId, DISABLE); //stop this control loop - if (RemoveControlCallback(Valve3WayControlId[ValveId], Valve3WayCallBackFunction )==OK) - { - //Report("Remove control callback",__FILE__,__LINE__,(int)ValveId,RpWarning,(int)Valve3WayControlId[ValveId],0); + if (SafeRemoveControlCallback(Valve3WayControlId[ValveId], Valve3WayCallBackFunction )==OK) Valve3WayControlId[ValveId] = 0xFF; - } else - { - Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)Valve3WayControlId[ValveId],0); - if (RemoveControlCallback(GetControlLowDevice_i(),Valve3WayCallBackFunction)==OK) - { - Report("Remove control callback fixed",__FILE__,__LINE__,(int)ValveId,RpWarning,(int)Valve3WayControlId[ValveId],0); - Valve3WayControlId[ValveId] = 0xFF; - } - else - Report("Remove control callback failed",__FILE__,__LINE__,(int)ValveId,RpWarning,(int)Valve3WayControlId[ValveId],0); - } + Report("Remove control callback failed",__FILE__,__LINE__,(int)ValveId,RpWarning,(int)Valve3WayControlId[ValveId],0); //call the module callback if (Valve3WayModuleCallback[ValveId]) diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index ff291867f..90fd245c0 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -221,7 +221,9 @@ int main(void) IDLE_TASK_package_init(); - HWControlId = AddControlCallback( MainHWInitCallBackFunction, 6* eOneSecond/*eHundredMillisecond*/, MainDummyFunction,0,0, 0 ); +// HWControlId = AddControlCallback( MainHWInitCallBackFunction, 2* eOneSecond/*eHundredMillisecond*/, MainDummyFunction,0,0, 0 ); + + Start_InitSequence(); BIOS_start(); diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 4486c70ed..c9f4ac1ee 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -272,7 +272,7 @@ const AlarmHandlingItemStruc AlarmItem[MAX_SYSTEM_ALARMS]={ {eOneSecond,DoNotPollAlarm,0,0,0,0,DEBUG_LOG_CATEGORY__Warning,0xFF,0,EVENT_TYPE__WINDER_CONE_DOES_NOT_EXIST,"No cone in winder"} }; -char AlarmStorePath[50] = "0://SWInfo//AlarmPrm.msg"; +char AlarmStorePath[50] = "0://SysInfo//AlarmPrm.msg"; bool DispenserInUse[MAX_SYSTEM_DISPENSERS] = {false,false,false,false,false,false,false,false}; bool EventsNotificationRequestAccepted = false; 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); diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index 3fd6805cf..711fcdc33 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -42,10 +42,13 @@ uint32_t EmbeddedParametersInit(void); uint32_t EmbeddedParametersWrite(void * buffer, uint16_t size); uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest); +bool GeneralHwReady = false; + HardwareBlower BlowerCfg; -char *SW_INFO_DIR = "0://SWInfo"; +char *SW_INFO_DIR = "0://SysInfo"; +char *OLD_SW_INFO_DIR = "0://SWInfo"; -char HwConfigPath[50] = "0://SWInfo//GenHwCfg.msg"; +char HwConfigPath[50] = "0://SysInfo//GenHwCfg.cfg"; uint32_t HWConfigurationInit(void) { FRESULT Fresult = FR_OK; @@ -54,10 +57,24 @@ uint32_t HWConfigurationInit(void) uint32_t Bytes = 0,i,j,k=0; uint32_t status = OK; + Control_WD(ENABLE,250); Fresult = f_mkdir(SW_INFO_DIR); if ((Fresult == FR_OK)||(Fresult == FR_EXIST)) { +/*************************************************************************/ + Fresult = f_mkdir(OLD_SW_INFO_DIR); + + Fresult = f_rename ("//SWINFO//GENHWCFG.MSG", "//SYSINFO//GENHWCFG.CFG"); + Fresult |= f_rename ("//SWINFO//ALARMPRM.MSG", "//SYSINFO//ALARMPRM.CFG"); + Fresult |= f_rename ("//SWINFO//EMBPARAM.MSG", "//SYSINFO//EMBPARAM.CFG"); + Fresult |= f_rename ("//SWINFO//PROCESSP.MSG", "//SYSINFO//PROCESSP.CFG"); + Fresult |= f_rename ("//SWINFO//DISPSTOR.MSG", "/SYSINFO//DISPSTOR.CFG"); + Fresult |= f_rename ("//SWINFO//DANCCFG.MSG", "//SYSINFO//DANCCFG.CFG"); + Fresult |= f_rename ("//SWINFO//LOADARM.MSG", "//SYSINFO//LOADARM.CFG"); + + /*************************************************************************/ FileHandle = my_malloc(sizeof(FIL)); + Fresult = FileOpen(HwConfigPath, &Bytes, FileHandle); if (Fresult == FR_OK) { @@ -89,7 +106,7 @@ uint32_t HWConfigurationInit(void) return Fresult; } -char EmbeddedParametersPath[50] = "0://SWInfo//EmbParam.msg"; +char EmbeddedParametersPath[50] = "0://SysInfo//EmbParam.cfg"; ConfigurationParameters EmbeddedParameters; void LoadConfigurationParameters(ConfigurationParameters *Params) { @@ -169,7 +186,7 @@ uint32_t GenHWControlId; uint32_t GenHWInitCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) { int Dispenser_i; - /*Safe*/RemoveControlCallback(GenHWControlId, GenHWInitCallBackFunction ); + SafeRemoveControlCallback(GenHWControlId, GenHWInitCallBackFunction ); for (Dispenser_i = 0;Dispenser_i < MAX_SYSTEM_DISPENSERS;Dispenser_i++) { Read_MidTank_Pressure_Sensor(Dispenser_i); @@ -270,7 +287,7 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest) BlowerCfg.enabled = false; } //from now on starting blower on INIT, so that the chiller does not freeze - if (BlowerCfg.enabled == true) + /*if (BlowerCfg.enabled == true) { Turn_the_Blower_On();//Turn on with the Default_Voltage if (BlowerCfg.heatingvoltage) @@ -278,7 +295,7 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest) else Control_Voltage_To_Blower(BlowerCfg.voltage-500); - } + }*/ /* for (Dispenser_i = 0;Dispenser_i < MAX_SYSTEM_DISPENSERS;Dispenser_i++) @@ -291,6 +308,7 @@ uint32_t HWConfiguration(UploadHardwareConfigurationRequest* UploadRequest) ControlStart(); AlarmHandlingStart(); //ThreadInitialTestStub(request); + GeneralHwReady = true; return OK; } diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.h b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.h index 99934500c..9aa5201dc 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.h +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.h @@ -14,5 +14,6 @@ extern void HWSystemResetRequest(MessageContainer* requestContainer); uint32_t HWConfigurationInit(void); extern HardwareBlower BlowerCfg; +extern bool GeneralHwReady; #endif diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.c b/Software/Embedded_SW/Embedded/Modules/General/process.c index 6eef03bb4..a64558f55 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.c +++ b/Software/Embedded_SW/Embedded/Modules/General/process.c @@ -18,6 +18,9 @@ #include "drivers/Valves/Valve.h" #include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h" #include "modules/ids/ids_ex.h" +#include "third_party/fatfs/src/ffconf.h" +#include "Common/SWUpdate/FileSystem.h" + double dyeingspeed = 0; @@ -32,12 +35,13 @@ int32_t tableindex = 0; #define MAX_ALLOWED_TEMPERATURE 280 +char ProcessParamsConfigPath[50] = "0://SysInfo//ProcessP.cfg"; + ProcessParameters ProcessParametersKeep; uint32_t HandleProcessParameters(ProcessParameters* ProcessParams) { uint32_t status = 0; - int Disp_i; if (ProcessParams->dryerzone1temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; if (ProcessParams->dryerzone2temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; @@ -156,7 +160,8 @@ void ProcessRequestFunc(MessageContainer* requestContainer) UploadProcessParametersRequest* request = upload_process_parameters_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); ProcessParameters* ProcessParams = request->processparameters; - + if ((ProcessParams->dryerzone1temp > 0.1)&&(ProcessParams->headzone2temp > 0.1)&&(ProcessParams->headzone3temp > 0.1)&&(ProcessParams->headzone4temp > 0.1))//NOT turning off heaters + FileWrite(requestContainer->data.data, requestContainer->data.len,ProcessParamsConfigPath); UploadProcessParametersResponse response = UPLOAD_PROCESS_PARAMETERS_RESPONSE__INIT; @@ -179,3 +184,44 @@ void ProcessRequestFunc(MessageContainer* requestContainer) upload_process_parameters_request__free_unpacked(request,NULL); } +uint32_t ProcessParamsInit(void) +{ + FRESULT Fresult = FR_OK; + FIL *FileHandle = 0; //the system supports a single active file + uint8_t* buffer = NULL; + uint32_t Bytes = 0,i,j,k=0; + uint32_t status = OK; + + Fresult = f_mkdir(SW_INFO_DIR); + if ((Fresult == FR_OK)||(Fresult == FR_EXIST)) + { + FileHandle = my_malloc(sizeof(FIL)); + Fresult = FileOpen(ProcessParamsConfigPath, &Bytes, FileHandle); + if (Fresult == FR_OK) + { + buffer = my_malloc (Bytes); + if (buffer) + { + for (i=0;i<=(Bytes/100);i++) + { + Fresult = f_read(FileHandle,&buffer[i*100],100,&j ); + k+=j; + } + if (k!=Bytes) + LOG_ERROR(k,"File read error"); + } +// UploadProcessParametersRequest* request = upload_process_parameters_request__unpack(NULL, Bytes, buffer); +// ProcessParameters* ProcessParams = request->processparameters; + ProcessParameters* ProcessParams = process_parameters__unpack(NULL, Bytes, buffer); + if (Fresult ==OK) + { + Fresult = HandleProcessParameters(ProcessParams); + //memcpy (&ProcessParametersKeep,ProcessParams,sizeof(ProcessParameters)); + process_parameters__free_unpacked(ProcessParams,NULL); + } + free (buffer); + } + f_close(FileHandle); + } + return Fresult; +} diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.h b/Software/Embedded_SW/Embedded/Modules/General/process.h index 12f1f8461..c67bd49b3 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.h +++ b/Software/Embedded_SW/Embedded/Modules/General/process.h @@ -23,6 +23,7 @@ extern ProcessParameters ProcessParametersKeep; extern void ProcessRequestFunc(MessageContainer* requestContainer); extern uint32_t HandleProcessParameters(ProcessParameters* ProcessParams); +uint32_t ProcessParamsInit(void); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c index 5f733762c..ede6b0674 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c @@ -63,23 +63,10 @@ uint32_t IDS_Dispenser_Build_Pressure_Callback(uint32_t DispenserId, uint32_t Re if ((GetDispenserPressure(DispenserId)>=DispenserPreparePressure)||(DispenserPrepareTime[DispenserId]>=DispenserPrepareTimeout)) { - if (RemoveControlCallback(DispenserControlId[DispenserId], IDS_Dispenser_Build_Pressure_Callback )==OK) - { - Report("Remove control callback",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0); + if (SafeRemoveControlCallback(DispenserControlId[DispenserId], IDS_Dispenser_Build_Pressure_Callback )==OK) DispenserControlId[DispenserId] = 0xFF; - } else - { - Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)DispenserControlId[DispenserId],0); - if (RemoveControlCallback(GetControlLowDevice_i(),IDS_Dispenser_Build_Pressure_Callback)==OK) - { - Report("Remove control callback fixed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0); - DispenserControlId[DispenserId] = 0xFF; - } - else - Report("Remove control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0); - } - + Report("Remove control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0); TimerMotors_t HW_Motor_Id = DispenserIdToMotorId[DispenserId]; MotorStop(HW_Motor_Id,Hard_Hiz); CurrentDispenserSpeed[DispenserId] = 0; @@ -120,24 +107,10 @@ uint32_t IDS_Dispenser_Build_Pressure_Callback(uint32_t DispenserId, uint32_t Re uint32_t IDS_Dispenser_StopMotorCallback(uint32_t DispenserId, uint32_t ReadValue) { Report("IDS_Dispenser_Close_Valve_And_Stop_Motor callback",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)msec_millisecondCounter,0); - if (RemoveControlCallback(DispenserControlId[DispenserId], IDS_Dispenser_StopMotorCallback )==OK) - { - Report("Remove control callback",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0); + if (SafeRemoveControlCallback(DispenserControlId[DispenserId], IDS_Dispenser_StopMotorCallback )==OK) DispenserControlId[DispenserId] = 0xFF; - } else - { - Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)DispenserControlId[DispenserId],0); - if (RemoveControlCallback(GetControlLowDevice_i(),IDS_Dispenser_StopMotorCallback)==OK) - { - Report("Remove control callback fixed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0); - DispenserControlId[DispenserId] = 0xFF; - } - else - { - Report("Remove control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0); - } - } + Report("Remove control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0); TimerMotors_t HW_Motor_Id = DispenserIdToMotorId[DispenserId]; MotorStop(HW_Motor_Id,Hard_Hiz); @@ -173,22 +146,10 @@ uint32_t IDS_Dispenser_OpenValveCallback(uint32_t DispenserId, uint32_t ReadValu { Report("IDS_Dispenser_Start_Motor_and_Open_Valve Callback",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)msec_millisecondCounter,0); - if (RemoveControlCallback(DispenserControlId[DispenserId], IDS_Dispenser_OpenValveCallback )==OK) - { - Report("Remove control callback",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0); + if (SafeRemoveControlCallback(DispenserControlId[DispenserId], IDS_Dispenser_OpenValveCallback )==OK) DispenserControlId[DispenserId] = 0xFF; - } else - { - Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)DispenserControlId[DispenserId],0); - if (RemoveControlCallback(GetControlLowDevice_i(),IDS_Dispenser_OpenValveCallback)==OK) - { - Report("Remove control callback fixed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0); - DispenserControlId[DispenserId] = 0xFF; - } - else - Report("Remove control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0); - } + Report("Remove control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserControlId[DispenserId],0); Report("Control3WayValvesWithCallback called ",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)0,0); Control3WayValvesWithCallback (DispenserId, OpenValve, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer @@ -222,7 +183,7 @@ uint32_t IDS_Dispenser_Start_Motor_and_Open_Valve(int DispenserId, int MotorSpee DispenserRunningData IDS_Dispenser_Data[MAX_SYSTEM_DISPENSERS]; DispenserData IDSDispenserData; DispenserRunningData **dispenserdata; -char DispenserStorePath[50] = "0://SWInfo//DispStor.msg"; +char DispenserStorePath[50] = "0://SysInfo//DispStor.cfg"; void IDS_Dispenser_Content_Init (void) { diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c index 0262db6ff..8028a60ee 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c @@ -85,21 +85,10 @@ uint32_t IDS_HomeDispenserBackMoveCallback(uint32_t deviceID, uint32_t ReadValue MotorSetMicroStep(deviceID, MotorsCfg[deviceID].microstep); HomingActive[DispenserId]= false; Report("End backlash",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); - if (RemoveControlCallback(DispenserHomingControlId[DispenserId], IDS_HomeDispenserBackMoveCallback )==OK) - { + if (SafeRemoveControlCallback(DispenserHomingControlId[DispenserId], IDS_HomeDispenserBackMoveCallback )==OK) DispenserHomingControlId[DispenserId] = 0xFF; - } else - { - Report("Fixing Remove control ",__FILE__,__LINE__,(int)GetControlLowDevice_i(),RpWarning,(int)DispenserHomingControlId[DispenserId],0); - if (RemoveControlCallback(GetControlLowDevice_i(),IDS_HomeDispenserBackMoveCallback)==OK) - { - Report("Remove control callback fixed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserHomingControlId[DispenserId],0); - DispenserHomingControlId[DispenserId] = 0xFF; - } - else - Report("Remove control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserHomingControlId[DispenserId],0); - } + Report("Remove control callback failed",__FILE__,__LINE__,(int)DispenserId,RpWarning,(int)DispenserHomingControlId[DispenserId],0); DispenserHomingTime[DispenserId]=0; } else diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index a116bbd66..87478d9cb 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -69,7 +69,7 @@ uint32_t LoadArmBackLash; }LoadArmInfoStruc; LoadArmInfoStruc LoadArmInfo; - char LoadArmPath[50] = "0://SWInfo//LoadArm.msg"; + char LoadArmPath[50] = "0://SysInfo//LoadArm.cfg"; //RUN MOTOR TO SWITCH WITH TIMEOUT //RUN MOTOR TO BREAK SENSOR @@ -341,12 +341,14 @@ { REPORT_MSG(LoadStages, "Thread Load State Machine step"); LoadArmInfo.LoadArmRounds = 20; + uint32_t numberOfSteps = 0; //Start Feeder Pid, Rotate Loading Arm Counter Thread Direction X Circles According To Rml. Feeder Speed Is 40 OriginalMotorSpd_2PPS[FEEDER_MOTOR] = 1000; + numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround*LoadArmInfo.LoadArmRounds*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius; ControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+FEEDER_MOTOR),FEEDER_DANCER,FEEDER_MOTOR); CallbackCounter++; MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize, - MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround*LoadArmInfo.LoadArmRounds, Thread_Load_HomingCallback, 100000); + numberOfSteps, Thread_Load_HomingCallback, 100000); //Keep Notation How Many Rotations In The Dryer //LoadArmInfo.LoadArmBackLash = 0; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index b414611ff..14a74ffbe 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -106,7 +106,7 @@ uint32_t MotorPidRequestMessage(HardwarePidControl* request) DancerStopActivityLimit[Motor_i] = temp/(2*PI*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].armlength); return OK; } -char DancerConfigPath[50] = "0://SWInfo//DancCfg.msg"; +char DancerConfigPath[50] = "0://SysInfo//DancCfg.cfg"; uint32_t StoreDancerConfigMessage() { diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c index 9add5438d..3849eef01 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c @@ -31,7 +31,7 @@ INIT_SEQUENCE_RESET_REASON, INIT_SEQUENCE_BUILT_IN_TEST, INIT_SEQUENCE_INITIAL_BLOWER_ACTIVATION, - INIT_SEQUENCE_DISPENSER_PRESSURE_BIULDUP_TEST, + INIT_SEQUENCE_DISPENSER_PRESSURE_BUILDUP_TEST, INIT_SEQUENCE_THREAD_DETECTION, INIT_SEQUENCE_START_HEATING, INIT_SEQUENCE_MACHINE_READY_TO_DYE, @@ -45,7 +45,7 @@ uint32_t RESET_Cause = 0; void InitSequenceResetReason(void); uint32_t InitSequenceBuiltInTest(void); uint32_t InitSequenceInitialBlowerActivation(void); -uint32_t InitSequenceDispenserPressureBuildupTest(void); +uint32_t InitSequenceDispenserPressureBuildUpTest(void); uint32_t InitSequenceThreadDetection(void); uint32_t InitSequenceStartHeating(void); uint32_t InitSequenceMachineReadyToDye(void); @@ -119,11 +119,11 @@ uint32_t InitSequenceInitialBlowerActivation(void) Turn_the_Blower_On();//Turn on with the Default_Voltage if (BlowerCfg.voltage) Control_Voltage_To_Blower(BlowerCfg.voltage); - HWControlId = AddControlCallback( InitSequenceBlowerCallBackFunction, 5* eOneSecond/*eHundredMillisecond*/, TemplateDataReadCBFunction,0,0, 0 ); + HWControlId = AddControlCallback( InitSequenceBlowerCallBackFunction, 10* eOneSecond/*eHundredMillisecond*/, TemplateDataReadCBFunction,0,0, 0 ); } return OK; } -uint32_t InitSequenceDispenserPressureBuildupTest(void) +uint32_t InitSequenceDispenserPressureBuildUpTest(void) { InitStages++; InitSequenceStateMachine(InitStages); @@ -184,8 +184,8 @@ uint32_t InitSequenceStateMachine( INIT_SEQUENCE_STAGES_ENUM ReadValue) case INIT_SEQUENCE_INITIAL_BLOWER_ACTIVATION: InitSequenceInitialBlowerActivation(); break; - case INIT_SEQUENCE_DISPENSER_PRESSURE_BIULDUP_TEST: - InitSequenceDispenserPressureBuildupTest(); + case INIT_SEQUENCE_DISPENSER_PRESSURE_BUILDUP_TEST: + InitSequenceDispenserPressureBuildUpTest(); break; case INIT_SEQUENCE_THREAD_DETECTION: InitSequenceThreadDetection(); diff --git a/Software/Stubs Collection/stubs/embeddedparametersbuild.cs b/Software/Stubs Collection/stubs/embeddedparametersbuild.cs index a1c7268da..4d3f89c72 100644 --- a/Software/Stubs Collection/stubs/embeddedparametersbuild.cs +++ b/Software/Stubs Collection/stubs/embeddedparametersbuild.cs @@ -17,29 +17,23 @@ public void OnExecute(StubManager stubManager) { -ProcessParameters processParameters = new ProcessParameters(); -processParameters.DyeingSpeed = 40; -processParameters.MinInkUptake = 200; -processParameters.MaxInkUptake = 200; -processParameters.FeederTension = 0; -processParameters.PullerTension = 0; -processParameters.WinderTension = 0; -processParameters.MixerTemp = 80; -processParameters.HeadZone1Temp = 80; -processParameters.HeadZone2Temp = 110; -processParameters.HeadZone3Temp = 135; -processParameters.HeadZone4Temp = 135; -processParameters.HeadZone5Temp = 135; -processParameters.HeadZone6Temp = 140; -processParameters.DryerAirFlow = 0; -processParameters.DryerZone1Temp = 160; -processParameters.DryerZone2Temp = 0; -processParameters.DryerZone3Temp = 0; -processParameters.DryerBufferLength = 30; -processParameters.HeadAirFlow = 0; -processParameters.TableIndex = 0; +ConfigurationParameters configurationParameters = new ConfigurationParameters(); +configurationParameters.BreakSensorLimit = 10; +configurationParameters.DiagnosticCollectionLimit = 2; +configurationParameters.OverHeatCountLimit = 3; +configurationParameters.UnderHeatCountLimit = 3; +configurationParameters.CloseValveTimeout = 250; +configurationParameters.OpenValveTimeout = 250; +configurationParameters.InitialDispenserPressure = 0.1; +configurationParameters.InitialDispenserTimeout = 10000; +configurationParameters.InitialDispenserTimeLag = 100; +configurationParameters.DispenserBuildPressureSpeed = 500; +configurationParameters.DispenserBuildPressureLimit = 1.5; +configurationParameters.DispenserBuildPressureTimeout = 20000; +configurationParameters.DispenserBuildPressureLag = 50; + -File.WriteAllBytes("C:/temp/ProcessP.msg",processParameters.ToBytes()); +File.WriteAllBytes("C:/temp/EmbParam.cfg",configurationParameters.ToBytes()); } \ No newline at end of file -- 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 From 38009a30108ff250ac4884bf85a89014db27b3bd Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Wed, 20 Feb 2019 08:54:25 +0200 Subject: small changes for future work --- .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 3 +- .../Embedded/Modules/Control/MillisecTask.c | 8 ++-- .../Embedded/Modules/Thread/Thread_Winder.c | 3 -- .../Stubs Collection/stubs/alarm handling build.cs | 45 ++++++++++++++++++++++ 4 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 Software/Stubs Collection/stubs/alarm handling build.cs (limited to 'Software/Embedded_SW/Embedded/Modules/Control') diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index de0bd5d1f..f13dda4a0 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -120,7 +120,7 @@ AlarmStatusItem AlarmState[MAX_SYSTEM_ALARMS]; * or static variable whose declaration follows the pragma directive (only if using it without #define for example: #pragma location = MOTOR_MAP_IN_FLASH) * The variables must be declared either __no_init or const! */ -/*FLASH_MAP */ +//FLASH_MAP AlarmHandlingItemStruc FlashAlarmItem[MAX_SYSTEM_ALARMS]; const AlarmHandlingItemStruc AlarmItem[MAX_SYSTEM_ALARMS]={ {eHundredMillisecond,LimitSwitchAlarm,LimitSwitchAlarmEmpty_1,0,false,true,DEBUG_LOG_CATEGORY__Error,0xFF,0,EVENT_TYPE__DISPENSER_1_EMPTY,"Dispenser 1 Empty"}, {eHundredMillisecond,LimitSwitchAlarm,LimitSwitchAlarmEmpty_2,1,false,true,DEBUG_LOG_CATEGORY__Error,0xFF,0,EVENT_TYPE__DISPENSER_2_EMPTY,"Dispenser 2 Empty"}, @@ -301,6 +301,7 @@ void AlarmHandlingInit(void) AlarmState[Alarm_i].DebounceCounter = 0; AlarmState[Alarm_i].EventPtr = NULL; } +// ReadAppAndProgram(ALARM_MAP_IN_FLASH, sizeof(AlarmHandlingItemStruc)*MAX_SYSTEM_ALARMS, AlarmItem); return; } diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index e8a60a8c4..5943c11c5 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -147,15 +147,17 @@ void MillisecStop(void) MillisecRestart = false; ADCAcquireStop(); } - +#define HIGH_TASK_FREQUENCY 120000 void MillisecStart(void) { MillisecRestart = true; - ROM_TimerLoadSet(Millisec_timerBase, TIMER_A,120000/*one millisecond*/); + + ROM_TimerLoadSet(Millisec_timerBase, TIMER_A,HIGH_TASK_FREQUENCY); ROM_TimerEnable(Millisec_timerBase, TIMER_A); ROM_IntEnable(INT_TIMER1A); ROM_TimerIntEnable(Millisec_timerBase, TIMER_TIMA_TIMEOUT); ADCAcquireStart(0,1); + } void OneMilliSecondMillisecInterrupt(UArg arg0) @@ -166,7 +168,7 @@ void OneMilliSecondMillisecInterrupt(UArg arg0) ROM_TimerIntClear(Millisec_timerBase, TIMER_TIMA_TIMEOUT); // Clear the timer interrupt if (MillisecRestart == true) { - ROM_TimerLoadSet(Millisec_timerBase, TIMER_A,120000/*one millisecond*/); + ROM_TimerLoadSet(Millisec_timerBase, TIMER_A,HIGH_TASK_FREQUENCY); } else { diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 9b95ab52c..18aceb767 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -375,15 +375,12 @@ void Winder_ScrewOutLimitSwitchInterrupt(void) uint32_t Screw_timerBase = TIMER3_BASE; //Timer handle -bool Screw_Restart = false; void ScrewTimerInterruptInit(void) { ROM_TimerConfigure(Screw_timerBase, TIMER_CFG_PERIODIC); // 32 bits Timer ROM_TimerEnable(Screw_timerBase, TIMER_A); ROM_IntEnable(INT_TIMER3A); ROM_TimerIntEnable(Screw_timerBase, TIMER_TIMA_TIMEOUT); - Screw_Restart = false; - } void ScrewsStopControlTimer (void) { diff --git a/Software/Stubs Collection/stubs/alarm handling build.cs b/Software/Stubs Collection/stubs/alarm handling build.cs new file mode 100644 index 000000000..a1c7268da --- /dev/null +++ b/Software/Stubs Collection/stubs/alarm handling build.cs @@ -0,0 +1,45 @@ +using System; +using System.Text; +using System.Linq; +using System.Drawing; +using System.Diagnostics; +using System.Windows.Forms; +using System.Threading; +using System.Threading.Tasks; +using System.Collections.Generic; +using Tango.PMR.Stubs; +using Tango.Stubs; +using Google.Protobuf; +using Tango.PMR.EmbeddedParameters; +using System.IO; + +public void OnExecute(StubManager stubManager) +{ + + +ProcessParameters processParameters = new ProcessParameters(); +processParameters.DyeingSpeed = 40; +processParameters.MinInkUptake = 200; +processParameters.MaxInkUptake = 200; +processParameters.FeederTension = 0; +processParameters.PullerTension = 0; +processParameters.WinderTension = 0; +processParameters.MixerTemp = 80; +processParameters.HeadZone1Temp = 80; +processParameters.HeadZone2Temp = 110; +processParameters.HeadZone3Temp = 135; +processParameters.HeadZone4Temp = 135; +processParameters.HeadZone5Temp = 135; +processParameters.HeadZone6Temp = 140; +processParameters.DryerAirFlow = 0; +processParameters.DryerZone1Temp = 160; +processParameters.DryerZone2Temp = 0; +processParameters.DryerZone3Temp = 0; +processParameters.DryerBufferLength = 30; +processParameters.HeadAirFlow = 0; +processParameters.TableIndex = 0; + + +File.WriteAllBytes("C:/temp/ProcessP.msg",processParameters.ToBytes()); + +} \ No newline at end of file -- cgit v1.3.1