diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-01-03 18:07:30 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-01-03 18:07:30 +0200 |
| commit | 97ae338e0413613ee5a0d135f8226ee42ba4aa06 (patch) | |
| tree | 949c46b0ccf12b61df0ad2350b2cebeb16200684 /Software/Embedded_SW/Embedded/Modules | |
| parent | 4a872407f8599f632eff9a951af20014412194aa (diff) | |
| parent | 5cc8834aace78d60bada2802ac8817561292af66 (diff) | |
| download | Tango-97ae338e0413613ee5a0d135f8226ee42ba4aa06.tar.gz Tango-97ae338e0413613ee5a0d135f8226ee42ba4aa06.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules')
4 files changed, 49 insertions, 51 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 8d5955636..1ead15683 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -830,7 +830,7 @@ uint32_t StopEventsNotificationRequestFunc(MessageContainer* requestContainer) StopEventsNotificationResponse response = STOP_EVENTS_NOTIFICATION_RESPONSE__INIT; - AlarmHandlingStop(); + //AlarmHandlingStop(); EventsNotificationRequestAccepted = false; diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index 64b6ac4e0..1ab3a21e9 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -541,6 +541,13 @@ uint32_t MillisecLowLoop(uint32_t tick) FPGA_GetAllDispensersValveBusyOCD(); DrawerFansStatus = Read_Fans_Tacho(); KeepAliveOneSecondCall(); + for (Motor_i = 0;Motor_i < NUM_OF_MOTORS;Motor_i++) + { + if (Motor_i == HARDWARE_MOTOR_TYPE__MOTO_SCREW) + continue; // + if (isMotorConfigured(Motor_i)) + MotorGetStatusFromFPGA(Motor_i); + } } if (OneMinute_Tick) { diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index a985c7570..472d53b81 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -82,8 +82,8 @@ int DCTimeSliceAllocation[MAX_HEATERS_NUM] = {0}; bool TimerActivated = false; Mailbox_Handle HeatersControlMsgQ = NULL; -bool InitialHeating = true; -bool DCInitialHeating[MAX_HEATERS_NUM] = {true}; +//bool InitialHeating = true; +//bool DCInitialHeating[MAX_HEATERS_NUM] = {true}; bool HeaterReady[MAX_HEATERS_NUM] = {true}; uint32_t HeaterPreviousRead[MAX_HEATERS_NUM] = {0,0,0,0,0,0,0,0,0,0}; //A/C Heaters Cycle time in milliseconds - one for all heaters @@ -113,7 +113,7 @@ void HeatersControlInit(void) for (i = 0; i < MAX_HEATERS_NUM; i++) { - DCInitialHeating[i] = true; + //DCInitialHeating[i] = true; HeaterReady[i] = true; HeaterCmd[i].targettemperatue = 0; HeaterCmd[i].command = HEATER_OFF; @@ -155,8 +155,8 @@ uint32_t LoadHeaterSetPoint(HeaterType HeaterType) void LoadHeaterState(HeaterType HeaterType,HeaterState *HeaterState) { int HeaterId = HeaterType; - //double temp = TemperatureSensorRead(HeaterId2PT100Id[HeaterId]); - double temp = HeaterPreviousRead[HeaterId];//TemperatureSensorRead(HeaterId2PT100Id[HeaterId]); + double temp = TemperatureSensorRead(HeaterId2PT100Id[HeaterId]); + //double temp = HeaterPreviousRead[HeaterId];//TemperatureSensorRead(HeaterId2PT100Id[HeaterId]); @@ -171,13 +171,13 @@ void LoadHeaterState(HeaterType HeaterType,HeaterState *HeaterState) HeaterState->has_isactive = true; HeaterState->isactive = GetHeaterState(HeaterId); HeaterState->has_isrampingup = true; - HeaterState->isrampingup = DCInitialHeating[HeaterId]; + HeaterState->isrampingup = 1-HeaterReady[HeaterId]; HeaterState->has_isinsetpoint = true; HeaterState->isinsetpoint = HeaterReady[HeaterId]; if (HeaterId == HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature) { HeaterState->setpoint = HeaterControl[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain].outputproportionalpowerlimit; - HeaterState->isrampingup = InitialHeating; + //HeaterState->isrampingup = InitialHeating; } return; } @@ -336,7 +336,7 @@ uint32_t HeaterCommandRequestMessage(int HeaterId, bool OnOff, int Temperature) */ uint32_t PrepareHeater(int HeaterId, uint32_t SetTemperatue) { - CTRL_TIMING_ENUM Frequency = eHundredMillisecond; + CTRL_TIMING_ENUM Frequency = eOneSecond; if(HeaterId >= MAX_HEATERS_NUM) { LOG_ERROR (HeaterId,"HeaterId too high"); @@ -376,7 +376,7 @@ uint32_t PrepareHeater(int HeaterId, uint32_t SetTemperatue) if (ControlIdtoHeaterId [HeaterId] == 0xFF) ControlIdtoHeaterId [HeaterId] = AddControlCallback( DCHeaterControlCBFunction, Frequency/*eOneSecond/*eHundredMillisecond*/,TemperatureSensorRead,(IfTypeHeaters*0x100+HeaterId),HeaterId2PT100Id[HeaterId],0); HeaterPIDConfig[HeaterId].m_params.dt *=10; - DCInitialHeating[HeaterId] = true; + //DCInitialHeating[HeaterId] = true; HeaterReady[HeaterId] = false; HeaterPreviousRead[HeaterId] = TemperatureSensorRead(HeaterId2PT100Id[HeaterId]); } @@ -394,7 +394,7 @@ uint32_t PrepareHeater(int HeaterId, uint32_t SetTemperatue) MainDryerHeaterMaxTempControl = AddControlCallback( HeaterMaxTempCBFunction, eHundredMillisecond,TemperatureSensorRead,(IfTypeHeaters*0x100+HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain),HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain],0); if (SecondDryerHeaterMaxTempControl == 0xFF) SecondDryerHeaterMaxTempControl = AddControlCallback( HeaterMaxTempCBFunction, eHundredMillisecond,TemperatureSensorRead,(IfTypeHeaters*0x100+HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary),HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary],0); - InitialHeating = true; + //InitialHeating = true; HeaterReady[HeaterId] = false; if (BlowerCfg.enabled == true) { @@ -504,7 +504,7 @@ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue) if (HeaterMaxTempFlag[index] == true) { ActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); - if (InitialHeating) + if (HeaterReady[HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature]==false) { ActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); } @@ -547,7 +547,7 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) HeaterPreviousRead[index] = readValue; // check if the read value is within the proportional band - if (InitialHeating) + if (HeaterReady[index]==false) { if (readValue > ((HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100)) { @@ -563,19 +563,14 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) return OK; } + if ((readValue > (HeaterCmd[index].targettemperatue * 995/1000))&&(readValue < (HeaterCmd[index].targettemperatue * 1005/1000)))//read value within 0.5 percent from target { - InitialHeating = false; +////////////////// + //InitialHeating = false; DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary, 0); HeatersControlStart(); - //HeaterReady[index] = true; - //HeaterPrepareReady(); - } - } - if (HeaterReady[index]==false) - { - if ((readValue > (HeaterCmd[index].targettemperatue * 995/1000))&&(readValue < (HeaterCmd[index].targettemperatue * 1005/1000)))//read value within 0.5 percent from target - { +//////////////////////// HeaterReady[index] = true; HeaterPrepareReady(); if (BlowerCfg.enabled == true) @@ -586,6 +581,7 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) } } + return OK; } if(HeaterPIDConfig[index].m_isEnabled && (HeaterPIDConfig[index].m_SetParam != 0)) { @@ -637,6 +633,7 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) //int Counter[HARDWARE_PID_CONTROL_TYPE__MixerHeater] = {0,0,0,0,0,0,0}; //char logmsg[HARDWARE_PID_CONTROL_TYPE__MixerHeater][254]; char heatstr[100]; +//float temp_calculatedError=0,temp_preError = 0, temp_integral = 0; uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) { @@ -667,7 +664,7 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) } HeaterPreviousRead[index] = readValue; // check if the read value is within the proportional band - if (DCInitialHeating[index]==true) + if (HeaterReady[index]==false) { //int temp = ((HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100); if (readValue > ((HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100)) @@ -685,20 +682,14 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) return OK; } - { - DCInitialHeating[index] = false; - HeatersControlStart(); - //HeaterReady[index] = true; - //HeaterPrepareReady(); - } - } - if (HeaterReady[index]==false) - { if ((readValue > (HeaterCmd[index].targettemperatue * 998/1000))&&(readValue < (HeaterCmd[index].targettemperatue * 1002/1000)))//read value within 0.5 percent from target { + //DCInitialHeating[index] = false; + HeatersControlStart(); HeaterReady[index] = true; HeaterPrepareReady(); } + return OK; } if(HeaterPIDConfig[index].m_isEnabled && (HeaterPIDConfig[index].m_SetParam != 0)) @@ -726,8 +717,14 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) } else { - HeaterPIDConfig[index].m_calculatedError = AdvancedPIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam, + //temp_preError = HeaterPIDConfig[index].m_preError; temp_integral = HeaterPIDConfig[index].m_integral; + //temp_calculatedError = AdvancedPIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam, + // &HeaterPIDConfig[index].m_params, &temp_preError, &temp_integral); + HeaterPIDConfig[index].m_calculatedError = PIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam, &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral); + //len = usnprintf(heatstr, 100, "ACD Id, Temp , Integral, Output,AdvIntegral, AdvOutput{ %d, %d ,%d, %d,%d, %d} ",index,(int)HeaterPIDConfig[index].m_mesuredParam , + // (int)HeaterPIDConfig[index].m_integral,(int)HeaterPIDConfig[index].m_calculatedError,(int)temp_integral,(int)temp_calculatedError); + //Report(heatstr,__FILE__,__LINE__,index,RpWarning,index, readValue); } // error[index][Counter[index]] = HeaterPIDConfig[index].m_preError; // integral[index][Counter[index]] = HeaterPIDConfig[index].m_integral; @@ -736,11 +733,6 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) // Counter[index] = 0; // Report(logmsg[index],__FILE__,__LINE__,index,RpWarning,index, Counter[index]); // #warning PID is now only proportional (above) - if (index == HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ2) - { - // len = usnprintf(heatstr, 254, "PID id, Temp, Integral, Output { %d, %d ,%d, %d}",index,(int)HeaterPIDConfig[index].m_mesuredParam ,(int)HeaterPIDConfig[index].m_integral,(int)HeaterPIDConfig[index].m_calculatedError); - // Report(heatstr,__FILE__,__LINE__,index,RpWarning,HeaterPIDConfig[index].m_calculatedError,0); - } HeaterRecalculateHeaterParams(index, (int)(HeaterPIDConfig[index].m_calculatedError/100)); } @@ -801,7 +793,7 @@ uint32_t HeatersControlLoop(uint32_t tick) { first = false; } - if (InitialHeating == false) + if (HeaterReady[HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature] == true) { if (TimeSliceAllocation[SliceCounter] == HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain) { @@ -835,7 +827,7 @@ uint32_t HeatersControlLoop(uint32_t tick) } for ( DcHeaterId = HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ1; DcHeaterId<= HARDWARE_PID_CONTROL_TYPE__MixerHeater;DcHeaterId++) { - if (DCInitialHeating[DcHeaterId] == true) + if (HeaterReady[DcHeaterId] == false) continue; if (DCTimeSliceAllocation[DcHeaterId] > 0) //heater active { diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index fed1311bd..3b9311b77 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -26,29 +26,28 @@ #include <inc/hw_memmap.h> -bool Winder_ScrewHoming = false; - #define MAX_WINDER_SPEED_CALCULATION 200 + uint32_t Winder_ScrewAtOffsetCallback(uint32_t deviceID, uint32_t BusyFlag); uint32_t Winder_PrepareStage2(uint32_t deviceID, uint32_t ReadValue); +void ScrewTimerInterruptInit(void); +void ScrewsStopControlTimer (void); +void ScrewsStartControlTimer (void); -bool ScrewCurrentDirection = false; //holds current screw direction +bool Winder_ScrewHoming = false; +bool ScrewCurrentDirection = false; //holds current screw direction uint32_t ScrewDirectionChangeCounter = 1; //holds the current number of runs of the screw - will be used to build the cone uint32_t CalculationDirectionChangeCounter = 1; //holds the current number of runs of the screw - will be used to build the cone uint16_t WinderMotorSpeed[MAX_WINDER_SPEED_CALCULATION]; uint16_t WinderMotorSpeedCounter = 0; -bool WinderMotorSpeedRollOver = false; -double ScrewSpeed = 0; -double ScrewRunningTime = 0; +bool WinderMotorSpeedRollOver = false; +double ScrewSpeed = 0; +double ScrewRunningTime = 0; uint32_t ScrewNumberOfSteps = 0; //holds the current number of steps for the next screw run - will be used to build the cone -bool SCREW_TimerActivated = false; -//ScrewSpeed +bool SCREW_TimerActivated = false; uint32_t ScrewControlId = 0xFF; InternalWinderConfigStruc InternalWinderCfg = {0}; -void ScrewTimerInterruptInit(void); -void ScrewsStopControlTimer (void); -void ScrewsStartControlTimer (void); uint32_t Winder_Init(void) { |
