From f937e17452d6e89b67a675cd7139d84cbd7b0ee3 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 16 Apr 2019 00:42:26 +0300 Subject: minor changes --- Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 1f7836ea5..0b19d835a 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -111,12 +111,12 @@ uint32_t Winder_Prepare(void) }*/ if (FPGA_Read_limit_Switches(GPI_LS_SCREW_RIGHT)==LIMIT) { - //REPORT_MSG(LIMIT, "Winder_Prepare at limit"); + REPORT_MSG(LIMIT, "Winder_Prepare at limit"); Winder_PrepareStage2(0,0); } else { - //REPORT_MSG(ScrewSpeed, "Winder_Prepare"); + REPORT_MSG(ScrewSpeed, "Winder_Prepare"); Winder_ScrewHoming = true; //REPORT_MSG(MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, "Winder_Prepare move to limit"); status = MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, ScrewSpeed, GPI_LS_SCREW_RIGHT, Winder_PrepareStage2,2000); -- cgit v1.3.1 From f3a7578c8c53e50c95ed62eba4dcab80e4408b12 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Wed, 17 Apr 2019 14:38:45 +0300 Subject: version 1.3.8.51: bug fix in winder; many fixes in heaters --- .../Embedded_SW/Embedded/Common/SW_Info/SW_Info.c | 2 +- Software/Embedded_SW/Embedded/Main.c | 2 +- .../Embedded/Modules/Heaters/Heaters_print.c | 71 ++++++++++++++++------ .../Embedded/Modules/Thread/Thread_Winder.c | 12 ++-- 4 files changed, 62 insertions(+), 25 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') 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 075f0c5d9..07fbf3ddd 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,8,5}; +TangoVersion_t _gTangoVersion = {1,3,8,51}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index 1c368e180..a125ef10c 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -177,7 +177,7 @@ int main(void) #endif #ifdef WATCHDOG - InitWatchdog(ui32SysClock*2); + InitWatchdog(ui32SysClock); #endif CommunicationTaskInit(); diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 93048681d..75ed06b05 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -218,7 +218,7 @@ void LoadHeaterState(HeaterType HeaterType,HeaterState *HeaterState) HeaterState->heatertype = HeaterType; HeaterState->has_setpoint = true; HeaterState->setpoint = HeaterCmd[HeaterId].targettemperatue/100; - // HeaterState->setpoint = DCTimeSliceAllocation[HeaterId]*100/NumberOFSlicesInUse; + //HeaterState->setpoint = DCTimeSliceAllocation[HeaterId]*100/NumberOFSlicesInUse; HeaterState->has_currentvalue = true; HeaterState->currentvalue = temp/100;//MillisecGetTemperatures(HeaterId2PT100Id[HeaterId])/100; HeaterState->has_isactive = true; @@ -227,11 +227,16 @@ void LoadHeaterState(HeaterType HeaterType,HeaterState *HeaterState) HeaterState->isrampingup = 1-HeaterReady[HeaterId]; HeaterState->has_isinsetpoint = true; HeaterState->isinsetpoint = HeaterReady[HeaterId]; - /*if (HeaterId == HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature) + if (HeaterId == HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain) { HeaterState->setpoint = HeaterControl[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain].outputproportionalpowerlimit; //HeaterState->isrampingup = InitialHeating; - }*/ + } + if (HeaterId == HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary) + { + HeaterState->setpoint = HeaterControl[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary].outputproportionalpowerlimit; + //HeaterState->isrampingup = InitialHeating; + } return; } uint32_t HeatersSingleHeaterEnd(HardwarePidControlType HeaterId) @@ -667,10 +672,10 @@ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue) LOG_ERROR (MaxreadValue/100, "Heater Over the max temperature, turned off"); } DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); - HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain] = true; + HeaterMaxTempFlag[index] = true; //HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain,0); DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); - HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary] = true; + //HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary] = true; //HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary,0); return OK; } @@ -842,17 +847,18 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) return OK; } // if (readValue < ((HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100)) - if (readValue < (HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000)) + if (readValue < (/*HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000*/HeaterCmd[index].targettemperatue-1000)) { ActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); ActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); return OK; } - if ((readValue > (HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000))&&(readValue < (HeaterCmd[index].targettemperatue * AcHeatersUpperoperationLimit/1000)))//read value within 0.5 percent from target + if ((readValue > (HeaterCmd[index].targettemperatue-1000)/*(HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000)*/)&&(readValue < (HeaterCmd[index].targettemperatue * AcHeatersUpperoperationLimit/1000)))//read value within 0.5 percent from target { ////////////////// //InitialHeating = false; + Report("AC PID Activating",__FILE__,__LINE__,readValue,RpWarning,(HeaterCmd[index].targettemperatue-1000), 0); DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary, 0); HeatersControlStart(); @@ -891,15 +897,30 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) } else //PID active { - if (HeaterPIDConfig[index].m_params.IntegralErrorMultiplier == 0) + if ((readValue > ((HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100))) { - 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); + //disable PID outside band + HeaterPIDConfig[index].m_calculatedError = 0; + HeaterPIDConfig[index].m_integral = 0; + } + else if ((readValue < ((HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100))) + { + //disable PID outside band + HeaterPIDConfig[index].m_calculatedError = 10000; + HeaterPIDConfig[index].m_integral = 0; } else { - HeaterPIDConfig[index].m_calculatedError = AdvancedPIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam, - &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral); + if (HeaterPIDConfig[index].m_params.IntegralErrorMultiplier == 0) + { + 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); + } + else + { + HeaterPIDConfig[index].m_calculatedError = AdvancedPIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam, + &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral); + } } // len = usnprintf(ACheatstr, 254, "ACD 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(logmsg[index],__FILE__,__LINE__,index,RpWarning,index, Counter[index]); @@ -1015,15 +1036,31 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) { //check only for the proportional band limits HeaterPIDConfig[index].m_mesuredParam = readValue; - if (HeaterPIDConfig[index].m_params.IntegralErrorMultiplier == 0) + if ((readValue > ((HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100))) { - 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); + //disable PID outside band + HeaterPIDConfig[index].m_calculatedError = 0; + HeaterPIDConfig[index].m_integral = 0; + } + else if ((readValue < ((HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100))) + { + //disable PID outside band + HeaterPIDConfig[index].m_calculatedError = 10000; + HeaterPIDConfig[index].m_integral = 0; } else { - HeaterPIDConfig[index].m_calculatedError = AdvancedPIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam, - &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral); + if (HeaterPIDConfig[index].m_params.IntegralErrorMultiplier == 0) + { + 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); + } + else + { + HeaterPIDConfig[index].m_calculatedError = AdvancedPIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam, + &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral); + } + } // error[index][Counter[index]] = HeaterPIDConfig[index].m_preError; // integral[index][Counter[index]] = HeaterPIDConfig[index].m_integral; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 0b19d835a..70f32ce6d 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -111,12 +111,12 @@ uint32_t Winder_Prepare(void) }*/ if (FPGA_Read_limit_Switches(GPI_LS_SCREW_RIGHT)==LIMIT) { - REPORT_MSG(LIMIT, "Winder_Prepare at limit"); + //REPORT_MSG(LIMIT, "Winder_Prepare at limit"); Winder_PrepareStage2(0,0); } else { - REPORT_MSG(ScrewSpeed, "Winder_Prepare"); + //REPORT_MSG(ScrewSpeed, "Winder_Prepare"); Winder_ScrewHoming = true; //REPORT_MSG(MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, "Winder_Prepare move to limit"); status = MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, ScrewSpeed, GPI_LS_SCREW_RIGHT, Winder_PrepareStage2,2000); @@ -322,7 +322,9 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) // * calculate // * 1. calculate speed according to JobTicket->processparameters->dyeingspeed // * calculation input: traverse length in milimeters/pulses, number of rotations per traverse ==> length of traverse per rotation. - screw_horizontal_speed = InternalWinderCfg.segmentoffsetpulses / InternalWinderCfg.NumberOfRotationPerPassage; + ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; + ScrewNumberOfSteps -= 100; + screw_horizontal_speed = ScrewNumberOfSteps / InternalWinderCfg.NumberOfRotationPerPassage; // calculation input#2: number of rotations per second - (basically: speed/winder perimeter. later - according to winder actual speed - calculate according to winder position accumulation in the last second. //RotationsPerSecond = dyeingspeed / (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulleyradius * PI); RotationsPerSecond = OriginalMotorSpd_2PPS[WINDER_MOTOR] / MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; @@ -343,10 +345,8 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) // * 3. calculate cart travel length from winding parameters // * 4. start move of travel length // * 5. register motor nBusy callback. this callback will flip between move(traverse length, hardstop) and goto(0), with handline og the coneshape and adjusting maxspeed - ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; - ScrewNumberOfSteps -= 100; temp = SYS_CLK_FREQ; - temp *= InternalWinderCfg.segmentoffsetpulses; + temp *= ScrewNumberOfSteps; temp /= ScrewSpeed; ScrewRunningTime = temp;//(SYS_CLK_FREQ*InternalWinderCfg.segmentoffsetpulses)/ScrewSpeed; REPORT_MSG(ScrewNumberOfSteps,"Winder pre segment - ScrewNumberOfSteps"); -- cgit v1.3.1 From 0ab9e00c3593340713276a7132eb58410d9b2d3d Mon Sep 17 00:00:00 2001 From: Avi Levkovich Date: Mon, 29 Apr 2019 15:22:24 +0300 Subject: Add brackets to defines with calculation --- Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h | 2 +- Software/Embedded_SW/Embedded/Drivers/SSI_Comm/SSI_Comm.h | 2 +- Software/Embedded_SW/Embedded/Modules/Heaters/Heaters.h | 2 +- Software/Embedded_SW/Embedded/Modules/Thread/Thread.h | 4 ++-- Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h index 3b9eba3d8..894f60c09 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h @@ -20,7 +20,7 @@ #define TimerMotors_t HardwareMotorType -#define NUM_OF_MOTORS HARDWARE_MOTOR_TYPE__MOTO_RLOADING + 1 // TODO After the integration with mulbery change to: +#define NUM_OF_MOTORS (HARDWARE_MOTOR_TYPE__MOTO_RLOADING + 1) // TODO After the integration with mulbery change to: //#define NUM_OF_MOTORS HARDWARE_MOTOR_TYPE__MOTO_SPARE1_1 diff --git a/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/SSI_Comm.h b/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/SSI_Comm.h index 9028de45b..3a1c3ad5b 100644 --- a/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/SSI_Comm.h +++ b/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/SSI_Comm.h @@ -23,7 +23,7 @@ NUM_OF_ROTENC }RotEnc_t;*/ -#define NUM_OF_ROTENC HARDWARE_DANCER_TYPE__RightDancer+1 +#define NUM_OF_ROTENC (HARDWARE_DANCER_TYPE__RightDancer+1) void SSI1_Init(); diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters.h b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters.h index 3c9c59f3e..b25c3e5c7 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters.h +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters.h @@ -5,7 +5,7 @@ #include "PMR/Hardware/HardwarePidControlType.pb-c.h" #include "heaters_ex.h" /******************** DEFINITIONS ********************************************/ -#define MAX_AC_HEATERS HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary+1 +#define MAX_AC_HEATERS (HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary+1) #define MAX_TIMESLICES 200 extern uint32_t OutputProportionalSingleStep; //A/C Heaters step size from one decision point to another - in cpu clocks. 120000 = 1 millisecod diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h index 3e2a6aa40..97f3811c7 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h @@ -41,8 +41,8 @@ typedef struct }MotorControlConfig_t; -#define MAX_THREAD_FEED_MOTORS WINDER_MOTOR+1 -#define MAX_SYSTEM_DANCERS HARDWARE_DANCER_TYPE__RightDancer+1 +#define MAX_THREAD_FEED_MOTORS (WINDER_MOTOR+1) +#define MAX_SYSTEM_DANCERS (HARDWARE_DANCER_TYPE__RightDancer+1) extern TimerMotors_t ThreadMotorIdToMotorId[MAX_THREAD_MOTORS_NUM]; extern HardwareDancerType ThreadMotorIdToDancerId[MAX_THREAD_MOTORS_NUM]; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h index d7ce917c0..91eedeb6b 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h @@ -9,7 +9,7 @@ #define WINDER_DANCER HARDWARE_DANCER_TYPE__LeftDancer #define POOLER_DANCER HARDWARE_DANCER_TYPE__MiddleDancer #define FEEDER_DANCER HARDWARE_DANCER_TYPE__RightDancer -#define NUM_OF_DANCERS HARDWARE_DANCER_TYPE__RightDancer+1 +#define NUM_OF_DANCERS (HARDWARE_DANCER_TYPE__RightDancer+1) //} DANCER_ENUM; typedef enum threadMotorsEnum { -- cgit v1.3.1 From f8cd5085cc7fcd85e694d026dfd656ff54ab91d3 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 2 May 2019 11:18:08 +0300 Subject: job progress and winder logs --- Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 4 ++-- Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | 6 +++--- Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 30ad7d857..f2bae768c 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -755,7 +755,7 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); (int) segmentfirst_speed); //REPORT_MSG(segmentfirst_speed,IdsMessage); Report(IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); - SendJobProgress(0.0, 0, false, IdsMessage); + //SendJobProgress(0.0, 0, false, IdsMessage); } } } @@ -952,7 +952,7 @@ void IDS_StartBrushStop(int n_dispensers, JobDispenser** Dispensers) (int) segmentfirst_speed); //REPORT_MSG(segmentfirst_speed,IdsMessage); Report(IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); - SendJobProgress(0.0, 0, false, IdsMessage); + //SendJobProgress(0.0, 0, false, IdsMessage); } else { diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 70f32ce6d..d65156066 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -242,7 +242,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) if ((CalculationDirectionChangeCounter/2)%InternalWinderCfg.spoolbackingrate == 0) { ScrewNumberOfSteps--; - //REPORT_MSG(ScrewNumberOfSteps, "Head Backing ScrewNumberOfSteps"); + REPORT_MSG(ScrewNumberOfSteps, "Head Backing ScrewNumberOfSteps"); } } @@ -251,7 +251,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) if ((CalculationDirectionChangeCounter/2)%InternalWinderCfg.SpoolBottomBackingRate == 0) { ScrewNumberOfSteps++; - //REPORT_MSG(ScrewNumberOfSteps, "Bottom Backing ScrewNumberOfSteps"); + REPORT_MSG(ScrewNumberOfSteps, "Bottom Backing ScrewNumberOfSteps"); } } if (WinderMotorSpeedRollOver) @@ -288,7 +288,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) //Report(TempScrewStr,__FILE__,__LINE__,0,RpWarning,0, 0); //Report(ScrewStr,__FILE__,__LINE__,ScrewCurrentDirection,RpWarning,CalculationDirectionChangeCounter, 0); //REPORT_MSG(temp , "new winder speed"); -// Report("new winder speed",__FILE__,ScrewNumberOfSteps,temp,RpWarning,ScrewSpeed,0); + Report("new winder speed",__FILE__,ScrewNumberOfSteps,temp,RpWarning,ScrewSpeed,0); } /********************************************************************************/ diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index a4208ad25..c292f7dcd 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -842,8 +842,8 @@ char Endstr[150]; Report(Endstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0); ThreadUpdateProcessLength (0.0,(void *)NULL); - TotalProcessedLength = 0.0; - SetOriginMotorSpeed(0); + //TotalProcessedLength = 0.0; + SetOriginMotorSpeed(0); #ifdef HUNDRED_MICROSECONDS_DANCER_READ MillisecLogClose(); #endif -- cgit v1.3.1 From 25011c65a3081d256a6ae4672f737d51bc3c7464 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 2 May 2019 14:40:11 +0300 Subject: fix job length bug. read screw encoder. better logging in IDS --- .../Embedded_SW/Embedded/Common/SW_Info/SW_Info.c | 2 +- Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c | 2 +- .../Embedded/Drivers/USB_Communication/USBCDCD.c | 4 ++- .../Embedded/Modules/General/GeneralHardware.c | 2 +- .../Embedded/Modules/Heaters/Heaters_print.c | 1 + .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 7 ++--- .../Embedded/Modules/Thread/Thread_Winder.c | 35 +++++++++++++++++----- .../Initialization/PowerOffSequence.c | 2 +- .../Embedded/StateMachines/Printing/JobSTM.c | 1 + .../Embedded/StateMachines/Printing/PrintingSTM.c | 2 +- 10 files changed, 40 insertions(+), 18 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') 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 07175ae50..e4d325e71 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,9,5}; +TangoVersion_t _gTangoVersion = {1,3,9,6}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c index 41a28b4c1..66370491d 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c @@ -443,8 +443,8 @@ typedef union { struct { - uint16_t M; uint16_t L; + uint16_t M; }Word; uint32_t Position; }SCREW_POS; diff --git a/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c b/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c index b3ab21f0a..2476e6ef3 100644 --- a/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c +++ b/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c @@ -482,6 +482,7 @@ uint16_t Usbindex = 0; // \return The return value is event-specific. // //***************************************************************************** +uint32_t USBConn = 0; USBDisc = 0; uint32_t ControlHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue, void *pvMsgData) { @@ -505,6 +506,7 @@ uint32_t ControlHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValu HWREGBITW(&g_ui32Flags, FLAG_USB_CONFIGURED) = 1; SetCommunicationPath(isUSB); + USBConn++; // // Flush our buffers. // @@ -532,7 +534,7 @@ uint32_t ControlHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValu HWREGBITW(&g_ui32Flags, FLAG_USB_CONFIGURED) = 0; //TODO: Notify disconnection! - + USBDisc++; // // Set the command status update flag. // diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index f0ce7397c..b12064915 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -118,7 +118,7 @@ void LoadConfigurationParameters(ConfigurationParameters *Params) EmbeddedParameters.has_breaksensorlimit = true; EmbeddedParameters.breaksensorlimit = 10; EmbeddedParameters.has_diagnosticcollectionlimit = true; - EmbeddedParameters.diagnosticcollectionlimit = 1; + EmbeddedParameters.diagnosticcollectionlimit = 2; EmbeddedParameters.has_overheatcountlimit = true; EmbeddedParameters.overheatcountlimit = 3; EmbeddedParameters.has_underheatcountlimit = true; diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 5e61010dd..3a9ce53d8 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -953,6 +953,7 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) // Report(logmsg[index],__FILE__,__LINE__,index,RpWarning,index, Counter[index]); // #warning PID is now only proportional (above) // Report(ACheatstr,__FILE__,__LINE__,index,RpWarning,readValue, HeaterPIDConfig[index].m_calculatedError); + //Report("AC PID",__FILE__,__LINE__,HeaterPIDConfig[index].m_calculatedError/100,RpWarning,readValue, index); HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain, (int)(HeaterPIDConfig[index].m_calculatedError/100)); } } diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 71aa161dd..668ab9dcd 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -919,8 +919,7 @@ void IDS_StartBrushStop(int n_dispensers, JobDispenser** Dispensers) //(Speed*uStep*PPR)/((2*PI*Dispenser_Radius) segmentfirst_speed = Dispensers[Dispenser_i]->nanolitterpersecond / Dispensers[Dispenser_i]->nanoliterperpulse; - if (Dispensers[Dispenser_i]->dispenserstepdivision - != DISPENSER_STEP_DIVISION__Auto) + if (Dispensers[Dispenser_i]->dispenserstepdivision != DISPENSER_STEP_DIVISION__Auto) { //MotorSetMicroStep(HW_Motor_Id, Dispensers[Dispenser_i]->dispenserstepdivision); segmentfirst_speed /= @@ -948,11 +947,11 @@ void IDS_StartBrushStop(int n_dispensers, JobDispenser** Dispensers) MotorSetSpeed(HW_Motor_Id, segmentfirst_speed); CurrentDispenserSpeed[DispenserId] = segmentfirst_speed; usnprintf(IdsMessage, 80, - "Dispenser %d nl/sec %d nl/pulse %d speed %d", + "Dispenser %d nl/sec %d nl/pulse %d speed %d steps %d/%d", DispenserId, (int) Dispensers[Dispenser_i]->nanolitterpersecond, (int) Dispensers[Dispenser_i]->nanoliterperpulse, - (int) segmentfirst_speed); + (int) segmentfirst_speed,Dispensers[Dispenser_i]->dispenserstepdivision,MotorsCfg[HW_Motor_Id].microstep); //REPORT_MSG(segmentfirst_speed,IdsMessage); Report(IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); //SendJobProgress(0.0, 0, false, IdsMessage); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index d65156066..937ae63b7 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -54,6 +54,9 @@ uint32_t ScrewControlId = 0xFF; InternalWinderConfigStruc InternalWinderCfg = {0}; +uint32_t ScrewLocationLimitSwitch = 0,ScrewLocationStart = 0; +uint32_t ScrewLocationRun[3]; + uint32_t Winder_Init(void) { ScrewTimerInterruptInit(); @@ -109,6 +112,10 @@ uint32_t Winder_Prepare(void) AlarmHandlingSetAlarm(EVENT_TYPE__WINDER_CONE_DOES_NOT_EXIST,true); return ERROR; }*/ + + ScrewLocationRun[0] = 0; + ScrewLocationRun[1] = 0; + if (FPGA_Read_limit_Switches(GPI_LS_SCREW_RIGHT)==LIMIT) { //REPORT_MSG(LIMIT, "Winder_Prepare at limit"); @@ -136,6 +143,11 @@ uint32_t Winder_PrepareStage2(uint32_t deviceID, uint32_t ReadValue) //MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,InternalWinderCfg.segmentoffsetpulses); //REPORT_MSG(numOfSteps, "Winder_PrepareStage2"); + Read_Screw_Encoder(); + ScrewLocationLimitSwitch = Screw_RotEnc.Position; + REPORT_MSG(ScrewLocationLimitSwitch, "Winder_PrepareStage2 Encoder Location"); + + REPORT_MSG(millisecondCounter/*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].maxfrequency*/, "Winder_PrepareStage2"); if (ReadValue != LIMIT) { @@ -157,7 +169,13 @@ uint32_t Winder_ScrewAtOffsetCallback(uint32_t deviceID, uint32_t BusyFlag) //SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_SCREW); //set this point as the spool home //MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,temp_MaxFrequency); + Read_Screw_Encoder(); + ScrewLocationStart = Screw_RotEnc.Position; + + REPORT_MSG(ScrewLocationStart, "Winder_ScrewAtOffsetCallback Encoder Location"); + ScrewCurrentDirection = false; + ScrewLocationRun[ScrewCurrentDirection] = Screw_RotEnc.Position; ScrewSpeed = 0; ScrewControlId = 0xFF; ScrewNumberOfSteps = 0; @@ -230,6 +248,10 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) ScrewCurrentDirection = 1-ScrewCurrentDirection; CalculationDirectionChangeCounter++; + //REPORT_MSG(ScrewLocationRun[1] - ScrewLocationRun[0], "Screw Run NumberOfSteps"); + usnprintf(ScrewStr, 100, "Winder Encoder: 0 0x%x 1 0x%x diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],abs(ScrewLocationRun[1] - ScrewLocationRun[0])); + //usnprintf(ScrewStr, 100, "Winder Encoder: 0 %d 1 %d diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],ScrewLocationRun[1] - ScrewLocationRun[0]); + Report(ScrewStr,__FILE__,__LINE__,ScrewLocationLimitSwitch,RpWarning,ScrewLocationStart, 0); if (ScrewCurrentDirection == 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize) //next time going out { @@ -288,7 +310,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) //Report(TempScrewStr,__FILE__,__LINE__,0,RpWarning,0, 0); //Report(ScrewStr,__FILE__,__LINE__,ScrewCurrentDirection,RpWarning,CalculationDirectionChangeCounter, 0); //REPORT_MSG(temp , "new winder speed"); - Report("new winder speed",__FILE__,ScrewNumberOfSteps,temp,RpWarning,ScrewSpeed,0); + //Report("new winder speed",__FILE__,ScrewNumberOfSteps,temp,RpWarning,ScrewSpeed,0); } /********************************************************************************/ @@ -440,6 +462,9 @@ void ScrewTimerInterrupt(int ARG0) ROM_TimerIntClear(Screw_timerBase, TIMER_TIMA_TIMEOUT); // Clear the timer interrupt ROM_IntMasterDisable(); + Read_Screw_Encoder(); + ScrewLocationRun[ScrewCurrentDirection] = Screw_RotEnc.Position; + if (SCREW_TimerActivated == true) { ROM_TimerLoadSet(Screw_timerBase, TIMER_A,(int)ScrewRunningTime); @@ -455,13 +480,7 @@ void ScrewTimerInterrupt(int ARG0) } ROM_IntMasterEnable(); Rotations+=0.03; - /*random++; - if (random >= 2) - random = -1;*/ - //Report("ScrewTimerInterrupt dir, duration, speed", __FILE__,ScrewCurrentDirection,ScrewRunningTime, RpMessage, ScrewSpeed, 0); - // - // Enable all interrupts. - // + return ; } diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c index d19be0f29..e50286290 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c @@ -232,7 +232,7 @@ uint32_t PowerOffWaitForTemperatureCallback(uint32_t IfIndex, uint32_t BusyFlag) MaxTemp = readTemp; - if ((MaxTemp>PowerOffTemperatureThreshold)&&(WaitForProcessCounter++<3500)) + if ((MaxTemp>PowerOffTemperatureThreshold)&&(WaitForProcessCounter++<3600)) { Report("On going cooling down, wait for end of cooling",__FILE__,__LINE__,(int)MaxTemp,RpWarning,(int)WaitForProcessCounter,0); resetIdleCounter(); diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index 1bd07c06e..f1892f15b 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -628,6 +628,7 @@ void JobRequestFunc(MessageContainer* requestContainer) } status = PASSED; JobEndReason = JOB_OK; + TotalProcessedLength = 0.0; JobAlarmReason = AlarmHandlingPrepareJob(CurrentJob); if (JobAlarmReason ==OK) { diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c index c52ed8b4c..d238d2f82 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c @@ -222,7 +222,7 @@ JobDescriptionFileBrushStop *GetNextBrushStopFromJobFile() LOG_ERROR (0, "f_read error brush stop size error"); status = ERROR; } - REPORT_MSG(BrushStop->index,"BrushStop file Read Index"); + //REPORT_MSG(BrushStop->index,"BrushStop file Read Index"); return BrushStop; } -- cgit v1.3.1 From d42d96fdb1656ed45abedf181ffbe9dd3f2f481e Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 2 May 2019 15:06:14 +0300 Subject: hide screw encoder reading --- .../Embedded/Modules/Thread/Thread_Winder.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 937ae63b7..df88db3f9 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -143,9 +143,9 @@ uint32_t Winder_PrepareStage2(uint32_t deviceID, uint32_t ReadValue) //MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,InternalWinderCfg.segmentoffsetpulses); //REPORT_MSG(numOfSteps, "Winder_PrepareStage2"); - Read_Screw_Encoder(); - ScrewLocationLimitSwitch = Screw_RotEnc.Position; - REPORT_MSG(ScrewLocationLimitSwitch, "Winder_PrepareStage2 Encoder Location"); + //Read_Screw_Encoder(); + //ScrewLocationLimitSwitch = Screw_RotEnc.Position; + //REPORT_MSG(ScrewLocationLimitSwitch, "Winder_PrepareStage2 Encoder Location"); REPORT_MSG(millisecondCounter/*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].maxfrequency*/, "Winder_PrepareStage2"); @@ -169,8 +169,8 @@ uint32_t Winder_ScrewAtOffsetCallback(uint32_t deviceID, uint32_t BusyFlag) //SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_SCREW); //set this point as the spool home //MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,temp_MaxFrequency); - Read_Screw_Encoder(); - ScrewLocationStart = Screw_RotEnc.Position; + //Read_Screw_Encoder(); + //ScrewLocationStart = Screw_RotEnc.Position; REPORT_MSG(ScrewLocationStart, "Winder_ScrewAtOffsetCallback Encoder Location"); @@ -249,9 +249,9 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) ScrewCurrentDirection = 1-ScrewCurrentDirection; CalculationDirectionChangeCounter++; //REPORT_MSG(ScrewLocationRun[1] - ScrewLocationRun[0], "Screw Run NumberOfSteps"); - usnprintf(ScrewStr, 100, "Winder Encoder: 0 0x%x 1 0x%x diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],abs(ScrewLocationRun[1] - ScrewLocationRun[0])); + //usnprintf(ScrewStr, 100, "Winder Encoder: 0 0x%x 1 0x%x diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],abs(ScrewLocationRun[1] - ScrewLocationRun[0])); //usnprintf(ScrewStr, 100, "Winder Encoder: 0 %d 1 %d diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],ScrewLocationRun[1] - ScrewLocationRun[0]); - Report(ScrewStr,__FILE__,__LINE__,ScrewLocationLimitSwitch,RpWarning,ScrewLocationStart, 0); + //Report(ScrewStr,__FILE__,__LINE__,ScrewLocationLimitSwitch,RpWarning,ScrewLocationStart, 0); if (ScrewCurrentDirection == 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize) //next time going out { @@ -462,8 +462,8 @@ void ScrewTimerInterrupt(int ARG0) ROM_TimerIntClear(Screw_timerBase, TIMER_TIMA_TIMEOUT); // Clear the timer interrupt ROM_IntMasterDisable(); - Read_Screw_Encoder(); - ScrewLocationRun[ScrewCurrentDirection] = Screw_RotEnc.Position; + //Read_Screw_Encoder(); + //ScrewLocationRun[ScrewCurrentDirection] = Screw_RotEnc.Position; if (SCREW_TimerActivated == true) { -- cgit v1.3.1