From 797d4654f845a6d6c8f6e02bcdc6bc11ceeed51f Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Sun, 1 Dec 2019 14:34:42 +0200 Subject: update with Beta code --- .../Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c | 19 ++++++++++--------- .../Embedded/Modules/Thread/Thread_Winder.c | 12 ++++++------ 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 856812c12..852c19a1a 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -67,6 +67,7 @@ uint8_t CallbackCounter = 0; uint8_t TimeoutsCounter = 0; + uint32_t UnloadingStart = 0; uint8_t NumberOfDrierLoaderCycles = 0; uint32_t status = OK; uint32_t LoadingControlId = 0xFF,PullerControlId = 0xFF,WinderControlId = 0xFF; @@ -184,8 +185,6 @@ { Report("Thread_Load_Set_Load_Arm_To_Start_Position_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0); //storeLoadArmParameters(); - MotorMove(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,LoadArmInfo.LoadArmBackLash ); - SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home LoadStages++; ThreadLoadStateMachine(LoadStages); @@ -215,6 +214,8 @@ //move to exact location? // Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); CallbackCounter = 0; + Report("Thread_Load_Set_Load_Arm_To_Stopper time",__FILE__,msec_millisecondCounter - UnloadingStart,msec_millisecondCounter,RpMessage,UnloadingStart,0); + Report("Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0); NumberOfDrierLoaderCycles=0; //storeLoadArmParameters(); @@ -614,7 +615,7 @@ LoadArmInfo.LoadArmRounds = 0; //uint32_t numberOfSteps = 0; //Start Feeder Pid, Rotate Loading Arm Counter Thread Direction X Circles According To Rml. Feeder Speed Is 40 - SetOriginMotorSpeed(19); + SetOriginMotorSpeed(30); // OriginalMotorSpd_2PPS[FEEDER_MOTOR] = 1000; // CurrentControlledSpeed[FEEDER_MOTOR] = 1000; @@ -670,14 +671,14 @@ CallbackCounter++; //MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize, // numberOfSteps, Thread_Load_Dryer_Loading_Callback, 100000); - Report("Thread_Load_Set_Load_Arm_To_Start_Position",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); + UnloadingStart = msec_millisecondCounter; + Report("Thread_Load_Set_Load_Arm_To_Start_Position",__FILE__,UnloadingStart,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0); LoadArmInfo.LoadArmBackLash = 5; - status |= MotorMoveToStopper(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize), - MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000); + MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/2, Thread_Load_Set_Load_Arm_To_Stopper_Callback,LoadArmInfo.LoadArmBackLash,1000); //Keep Notation How Many Rotations In The Dryer - LoadArmInfo.LoadArmBackLash = 5; + //LoadArmInfo.LoadArmBackLash = 0; LoadArmInfo.LoadArmRounds = (int)dryerbufferlength; load.color = BLINK; return OK; @@ -840,7 +841,7 @@ uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) CurrentControlledSpeed[index] = calculated_speed; MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed); } - if (index == POOLER_MOTOR) + /* if (index == POOLER_MOTOR) { if ((TranslatedReadValue)<(-1200)) { @@ -868,7 +869,7 @@ uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) } - } + }*/ /* LoadCounter++; if ((LoadCounter % 5001) == 0) { diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 741fed7af..0d1656301 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -107,6 +107,8 @@ uint32_t InternalWindingConfigMessage(JobSpool* request) InternalWinderCfg.startoffsetpulses = request->startoffsetpulses; InternalWinderCfg.SpoolBottomBackingRate = request->bottombackingrate; InternalWinderCfg.NumberOfRotationPerPassage = 3.1415926*2;//request->rotationsperpassage; + if (request->rotationsperpassage > 6.1) + InternalWinderCfg.NumberOfRotationPerPassage = request->rotationsperpassage; InternalWinderCfg.diameter = request->diameter; usnprintf(ScrewStr, 150, "WindingConfig start,offset,head,tail {, %d, %d, %d, %d, %d}",InternalWinderCfg.startoffsetpulses,(int)InternalWinderCfg.segmentoffsetpulses, (int)InternalWinderCfg.spoolbackingrate,(int)InternalWinderCfg.SpoolBottomBackingRate); @@ -279,7 +281,7 @@ numOfSteps = InternalWinderCfg.startoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__ double WinderReferenceSpeed=0; double TotalWinderSpeed=0; bool Add100 = false; -double Rotations = 6.0; +double Rotations = 10.0; int flipflop = 0; uint32_t motspeed; float speedf; @@ -400,11 +402,11 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) }*/ //WinderReferenceSpeed = 1000; //ScrewNumberOfSteps = 1000; - screw_horizontal_speed = ScrewNumberOfSteps / Rotations;//InternalWinderCfg.NumberOfRotationPerPassage; + //screw_horizontal_speed = ScrewNumberOfSteps / Rotations;//InternalWinderCfg.NumberOfRotationPerPassage; // if (Rotations > 6.6)//7.0) // Rotations = 6.0; - RotationsPerSecond = WinderReferenceSpeed / (double)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; - tempScrewSpeed = screw_horizontal_speed*RotationsPerSecond; + //RotationsPerSecond = WinderReferenceSpeed / (double)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; + //tempScrewSpeed = screw_horizontal_speed*RotationsPerSecond; //ROM_IntMasterDisable(); tempScrewSpeed = ScrewSpeed; @@ -468,7 +470,6 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) InternalWinderCfg.SpoolBottomBackingRate = 2000; //no cone shape for samples InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw JobSegment* Segment = SegmentDetails; - InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw ScrewSpeed = InternalWinderCfg.segmentoffsetpulses/(((Segment->length *100)/dyeingspeed)/3); ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; @@ -481,7 +482,6 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) InternalWinderCfg.SpoolBottomBackingRate = 2000; //no cone shape for samples InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw JobSegment* Segment = SegmentDetails; - InternalWinderCfg.NumberOfRotationPerPassage = 100; // a very slow movement of the screw ScrewSpeed = InternalWinderCfg.segmentoffsetpulses/(((Segment->length *100)/dyeingspeed)/20); ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; } -- cgit v1.3.1 From c6a5719857a4b935b65c63913f5b01d2ad01e036 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Mon, 2 Dec 2019 16:14:37 +0200 Subject: message type SetupDebugDisributorsRequest/Response --- .../Embedded_SW/Embedded/Modules/General/buttons.c | 304 ++++++++------------- .../Embedded/Modules/Thread/Thread_Winder.c | 46 ---- .../Embedded/Modules/Waste/Waste_init.c | 34 ++- Software/PMR/Messages/Common/MessageType.proto | 2 + 4 files changed, 140 insertions(+), 246 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.c b/Software/Embedded_SW/Embedded/Modules/General/buttons.c index 6868cfda1..bbb8cb880 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/buttons.c +++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.c @@ -44,12 +44,6 @@ int thredJog(); #define SECOND2 (2000/BUTTONS_SAMPLE_TIME) #define SECOND5 (5000/BUTTONS_SAMPLE_TIME) -//enum PBstat OnOffPBstate = OFFPB; -//enum PBstat ret -//enum PBstat threadPB = OFFPB; - - - button power, jog, load, cart1, cart2, cart3; uint32_t ButtonPowerCallBackFunction(uint32_t IfIndex, uint32_t ReadValue); uint32_t ButtonPowerCBFunction(uint32_t IfIndex, uint32_t ReadValue); @@ -60,8 +54,6 @@ uint32_t StateMachine( button *pBtn); uint32_t ButtonJogCallBackFunction(uint32_t IfIndex, uint32_t ReadValue); uint32_t ButtonJogCBFunction(uint32_t IfIndex, uint32_t ReadValue); uint8_t thraedJogging(uint8_t off); -//uint32_t setJoggingEnableCondition( button *pBtn); -uint32_t joggingMachine( button *pBtn); //uint8_t OnOffPB, uint32_t ButtonLoadCallBackFunction(uint32_t IfIndex, uint32_t ReadValue); @@ -69,12 +61,6 @@ uint32_t ButtonLoadCBFunction(uint32_t IfIndex, uint32_t ReadValue); uint32_t LoadStatMachine( button *pBtn); uint32_t LoadLongPress( button *pBtn); bool get_pbAction ( button *pBtn, PB_Status ReadValue); -/* -void Power_Reset(); -uint8_t Buttons_LEDS(BUTTON Button, OPERATION_MODE LED_Mode); -uint8_t Buzzer(OPERATION_MODE Buzzer_Mode); -bool Read_PWR_Button();//TODO move to GPIO folder -*/ #define LOADLONGPRESS 3 @@ -138,34 +124,53 @@ bool SetPowerMachineState(PBmachineState state) */ bool get_pbAction (button *pBtn, PB_Status ReadValue ) { - if ((pBtn->bttn_status == RELEASE) && ( ReadValue == PRESS)) - { - // load.bttn_status = PRESS; - load.count = 1 ; - } - else + pBtn->bttn_status = ReadValue; + switch (pBtn->Action) { - load.Action = OFFPB; - if ((pBtn->bttn_status == PRESS) && ( ReadValue == PRESS ) && (pBtn->count > 0 )) - { - pBtn->count ++ ; - if (pBtn->count > SECOND5) + case OFFPB: + if (ReadValue == PRESS) + { + pBtn->count = 1 ; + pBtn->Action = COUNTPB; + } + else { pBtn->count = 0 ; - pBtn->Action = LONGPB; + pBtn->Action = OFFPB; } - } - else if ((pBtn->bttn_status == PRESS) && ( ReadValue == RELEASE ) && (pBtn->count > 0 )) - { -// load.bttn_status = RELEASE; - pBtn->count = 0 ; - pBtn->Action = SHORTPB; - } + break; + case COUNTPB: + if (ReadValue == PRESS) + { + pBtn->count += 1 ; + if (pBtn->count > SECOND5) + { + pBtn->Action = LONGPB; + } + } + else + { + pBtn->count = 0 ; + pBtn->Action = SHORTPB; + } + break; + case SHORTPB: + pBtn->Action = OFFPB; + break ; + case LONGPB: + if (ReadValue == RELEASE) + { + pBtn->count = 0 ; + pBtn->Action = OFFPB; + } + break ; + default: + break; } - pBtn->bttn_status = ReadValue; -return OK; + return OK; } + /* * read GPIO status * port: GPIO_PORTN_BASE @@ -176,23 +181,16 @@ return OK; uint32_t ButtonPowerCallBackFunction(uint32_t IfIndex, uint32_t ReadValue) { return Read_PWR_Button(); - /* - * - if(ROM_GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_7)) - return 0x00; - else - return 0x01; - */ } uint32_t ButtonJogCallBackFunction(uint32_t IfIndex, uint32_t ReadValue) { - return Get_Thread_Jogging_Button(); -// -// if(ROM_GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_7)) -// return 0x00; -// else -// return 0x01; + if (jog.state != sttDISABLE) + { + ReadValue = Get_Thread_Jogging_Button(); + get_pbAction ( &jog, ReadValue ); + } + return ReadValue; } uint32_t ButtonLoadCallBackFunction(uint32_t IfIndex, uint32_t ReadValue) @@ -244,18 +242,82 @@ uint32_t ButtonPowerCBFunction(uint32_t IfIndex, uint32_t ReadValue) return 0; } + +/*ButtonJogCBFunction() + * state machine for thread jogging button: + * 1. OFF - when the machine is working + * 2. blue - when the machin is not workig so we can jog thread + * 3. blink - when pushing the JOG button + * when pushing the JOG more the 5 second + * + */ uint32_t ButtonJogCBFunction(uint32_t IfIndex, uint32_t ReadValue) { - jog.bttn_status = ReadValue; - //if (ReadValue == PRESS) + switch (jog.state) { - //setJoggingEnableCondition(&jog); - joggingMachine(&jog); + case sttDISABLE: + if (JobIsActive() == false) + { + jog.color = colorON; + Pannel_Leds(THREAD_JOGGING, MODE_ON); + jog.state = sttENABLE; + } + break; + case sttENABLE: + if (jog.Action == COUNTPB) + { + ReportWithPackageFilter(GeneralFilter,"------------ joggingMachine: Jogging is sttENABLE and PRESS-----------------", __FILE__,__LINE__,0, RpMessage, 0, 0); jog.state = sttJOGGING; + jog.color = colorON; + jog.color = BLINK; + ThreadJoggingFunc(40); + jog.state = sttJOGGING; + } + else + { + if (JobIsActive() == true) + { + ReportWithPackageFilter(GeneralFilter,"------------ joggingMachine: Jogging is Disable -----------------", __FILE__,__LINE__,0, RpMessage, 0, 0); + jog.Action = OFFPB; + jog.color = colorOFF; + Pannel_Leds(THREAD_JOGGING,MODE_OFF); + jog.state = sttDISABLE; + } + } + break; + case sttJOGGING: + if (jog.Action == SHORTPB) //PB is OFF + { + ReportWithPackageFilter(GeneralFilter,"------------ joggingMachine: sttJOGGING action->SHORTPB-----------------", __FILE__,__LINE__,0, RpMessage, 0, 0); jog.state = sttJOGGING; + ThreadAbortJoggingFunc(); + jog.color = colorON; + Pannel_Leds(THREAD_JOGGING, MODE_ON); + jog.state = sttENABLE; + } + else if (jog.Action == LONGPB) + { + ReportWithPackageFilter(GeneralFilter,"------------ joggingMachine: sttJOGGING action->LONGPB-----------------", __FILE__,__LINE__,0, RpMessage, 0, 0); jog.state = sttJOGGING; + jog.state = sttLONG_JOGGING; + } + break; + case sttLONG_JOGGING: + if (jog.Action == COUNTPB) + { + ReportWithPackageFilter(GeneralFilter,"------------ joggingMachine: sttLONG_JOGGING action->COUNTPB-----------------", __FILE__,__LINE__,0, RpMessage, 0, 0); jog.state = sttJOGGING;ThreadAbortJoggingFunc(); // to do!!!! + ThreadAbortJoggingFunc(); + jog.color = colorON; + Pannel_Leds(THREAD_JOGGING, MODE_ON); + jog.state = sttENABLE; + } + break; + default: + break; } return OK; } + + uint32_t ButtonLoadCBFunction(uint32_t IfIndex, uint32_t ReadValue) { switch (load.Action) @@ -447,138 +509,6 @@ return OK; } - - - - /*-----------------------------------------------------------------------------------*/ - - - /* int rdJoggingEnableCondition() - * read if we can enabl the thraed jogging - * - * return 0 or 1 - * disable OFF(0) - the machine is working now you cannot jogging the thread. - * enable ON(1) - joggin thread is enable - */ - - - -//uint32_t setJoggingEnableCondition( button *pBtn) -//{ -// uint8_t parameter = 3; -// -// if (0 -//// to do : what are the conditions for enable / disable -//// 1. -//// 2. -//// 3. -//// ... -// ) -// { -// pBtn->state = sttDISABLE; -// REPORT_MSG(parameter," ------------ Jogging : setJoggingEnableCondition sttDISABLE ----------------- "); -// pBtn->color = colorOFF; -// Pannel_Leds(THREAD_JOGGING, MODE_OFF); //AVI+ -// // ThreadAbortJoggingFunc(); -// } -// -// else -// { -// pBtn->state = sttENABLE; -//// REPORT_MSG(parameter," ------------ Jogging : setJoggingEnableCondition sttENABLE ----------------- "); -// pBtn->color = BLUE; -// Pannel_Leds(THREAD_JOGGING, MODE_ON); //AVI+ -// //ThreadJoggingFunc(40); -// } -// -//return 0; -//} - - - - - -/*int joggingMachine() - * state machine for thread jogging button: - * 1. OFF - when the machine is working - * 2. blue - when the machin is not workig so we can jog thread - * 3. blink - when pushing the jog thread button and jogigthread - * - */ - - -uint32_t joggingMachine( button *pBtn) //uint8_t OnOffPB, -{ - -// uint8_t parameter = 4; - - if (sttDISABLE == pBtn->state) - { - // jogging is disable - ReportWithPackageFilter(GeneralFilter,"------------ joggingMachine: Jogging is Disable -----------------", __FILE__,__LINE__,0, RpMessage, 0, 0); - pBtn->Action = OFFPB; - pBtn->color = colorOFF; - Pannel_Leds(THREAD_JOGGING,MODE_OFF);//AVI+ - } - else - { - if ( (pBtn->Action != OFFPB) && (pBtn->bttn_status == RELEASE)) - { - ReportWithPackageFilter(GeneralFilter,"------------ joggingMachine: Jogging OnOffPB == 0 -----------------", __FILE__,__LINE__,0, RpMessage, 0, 0); - ReportWithPackageFilter(GeneralFilter,"------------ joggingMachine: stop Jogging -----------------", __FILE__,__LINE__,0, RpMessage, 0, 0); - pBtn->Action = OFFPB; - ThreadAbortJoggingFunc(); // to do!!!! - pBtn->color = colorON; - Pannel_Leds(THREAD_JOGGING, MODE_ON);//AVI+ - } - else if ((pBtn->Action == OFFPB) && (pBtn->bttn_status == PRESS)) - { - pBtn->Action = LONGPB; - ReportWithPackageFilter(GeneralFilter,"------------ joggingMachine: Jogging OnOffPB == 1 -----------------", __FILE__,__LINE__,0, RpMessage, 0, 0); - ReportWithPackageFilter(GeneralFilter,"------------ joggingMachine: start Jogging -----------------", __FILE__,__LINE__,0, RpMessage, 0, 0); - pBtn->color = BLINK; - ThreadJoggingFunc(40); - } -// if (pBtn->bttn_status == press)ThreadJoggingFunc(40); -// else -// { -// pBtn->Action = OFFPB; -// REPORT_MSG(parameter," ??????????????????? joggingMachine: start Jogging ???????????????????"); -// } - } - - - -// if (OnOffPB == release) -// { -// REPORT_MSG(parameter," ------------joggingMachine: Jogging OnOffPB == 00----------------- "); -// REPORT_MSG(parameter," ------------joggingMachine: stop Jogging ----------------- "); -// pBtn->Action = OFFPB; -// ThreadAbortJoggingFunc(); // to do!!!! -// pBtn->color = BLUE; -// Pannel_Leds(THREAD_JOGGING, MODE_ON);//AVI+ -// } -// else -// { -// if (pBtn->Action == OFFPB) -// { -// pBtn->Action = LONGPB; -// REPORT_MSG(parameter," ------------joggingMachine: Jogging OnOffPB == 1 ----------------- "); -// REPORT_MSG(parameter," ------------joggingMachine: start Jogging ----------------- "); -// pBtn->color = BLINK; -// ThreadJoggingFunc(40); -// } -// else -// { -// REPORT_MSG(parameter," ??????????????????? joggingMachine: start Jogging ???????????????????"); -// } -// -// } -// } -return OK; -} - - /*------------------------------------------------------------------------------*/ /*------ THREAD LOAD/UNLOAD ----------*/ @@ -599,7 +529,7 @@ uint32_t LoadStatMachine( button *pBtn) case (REPLONGPB): pBtn->state = sttPRELOAD; pBtn->color = BLINK;*/ - if (ThreadLoadButton( THREAD_LOAD_INIT) == OK) + if (ThreadLoadButton( THREAD_LOAD_INIT)== OK) { pBtn->state = sttPRELOAD ; // to do pBtn->color = colorON; @@ -624,7 +554,7 @@ uint32_t LoadStatMachine( button *pBtn) case (REPLONGPB): pBtn->color = BLUE; Pannel_Leds(THREAD_LOAD, MODE_ON);//AVI+*/ - if (ThreadLoadButton( THREAD_LOAD_INITIAL_TENSION) == OK) + if (ThreadLoadButton( THREAD_LOAD_INITIAL_TENSION)== OK) { pBtn->state = sttRDY ; // to do pBtn->color = colorON; @@ -644,7 +574,7 @@ uint32_t LoadStatMachine( button *pBtn) ReportWithPackageFilter(GeneralFilter,"------------ load.state = sttLOADING -----------------", __FILE__,__LINE__,0, RpMessage, 0, 0); pBtn->color = fastBILNK; Pannel_Leds(THREAD_LOAD, MODE_ON);//AVI+ - if (ThreadLoadButton( THREAD_LOAD_END) == OK) + if (ThreadLoadButton( THREAD_LOAD_END)== OK) { pBtn->state = sttRDY ; // to do pBtn->color = colorON; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 0d1656301..4de702e14 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -281,7 +281,6 @@ numOfSteps = InternalWinderCfg.startoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__ double WinderReferenceSpeed=0; double TotalWinderSpeed=0; bool Add100 = false; -double Rotations = 10.0; int flipflop = 0; uint32_t motspeed; float speedf; @@ -292,12 +291,6 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) double temp,tempScrewSpeed; double screw_horizontal_speed = 0; double RotationsPerSecond; - //double Averagewinderspeed = 0; - -// { -// TotalWinderSpeed-=WinderMotorSpeed[WinderMotorSpeedCounter]; -// WinderMotorSpeed[WinderMotorSpeedCounter] = CurrentControlledSpeed[WINDER_MOTOR]; -// TotalWinderSpeed+=WinderMotorSpeed[WinderMotorSpeedCounter]; if (WinderMotorSpeedCounter++>=MAX_WINDER_SPEED_CALCULATION) { if (WinderMotorSpeedRollOver == false) @@ -307,17 +300,6 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) } // WinderMotorSpeedCounter=0; } -// } - /*if (flipflop == 0) - { - MotorGetSpeedFromFPGA1(HARDWARE_MOTOR_TYPE__MOTO_SCREW); - } - else if (flipflop == 1) - { - speedf = MotorGetSpeedFromFPGA_Res(HARDWARE_MOTOR_TYPE__MOTO_SCREW); - } - flipflop ++; - */ if (ScrewDirectionChangeCounter == CalculationDirectionChangeCounter) return OK; //deley TODO @@ -355,16 +337,6 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) Report("Winder difference",__FILE__,CalculationDirectionChangeCounter,ScrewLocationPrev[0],RpWarning,ScrewLocationRun[0], 0); } ScrewLocationPrev[0] = ScrewLocationRun[0]; - //else - // Report("winder run error value" ,__FILE__,WinderRun,ScrewLocationRun[0],RpWarning,ScrewLocationRun[1], 0); - - //Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0); - //REPORT_MSG(abs(ScrewLocationRun[1] - ScrewLocationRun[0]), "Screw Run NumberOfSteps"); - //usnprintf(ScrewStr, 100, "Winder Encoder: 0 0x%x 1 0x%x diff %d intent %d rot %d",ScrewLocationRun[0],ScrewLocationRun[1],abs(ScrewLocationRun[1] - ScrewLocationRun[0]),ScrewNumberOfSteps,Rotations*10); - //usnprintf(ScrewStr, 150, "Winder Encoder:id, diff, intended, winderspeed, rotation, speed, time, mot speed {, %d, %d, %d, %d, %d, %d, %d, %d, }",CalculationDirectionChangeCounter, - // abs(ScrewLocationRun[1] - ScrewLocationRun[0]),ScrewNumberOfSteps,(int)(WinderReferenceSpeed),(int)(Rotations*10),(int)ScrewSpeed,(int)ScrewRunningTime,(int)speedf); - //usnprintf(ScrewStr, 100, "Winder Encoder: 0 %d 1 %d diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],ScrewLocationRun[1] - ScrewLocationRun[0]); - //Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0); #endif if (ScrewCurrentDirection == 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize) //next time going out { @@ -390,24 +362,6 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) // Report("Bottom Backing ",__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewNumberOfSteps, 0); } } - /* if (WinderMotorSpeedRollOver) - { - if (WinderCalculation%60000 == 0)//100 minutes - { - Averagewinderspeed = TotalWinderSpeed/MAX_WINDER_SPEED_CALCULATION; - //Report("WinderSpeedUpdated",__FILE__,__LINE__,(int)TotalWinderSpeed,RpWarning,(int)Averagewinderspeed,0); - WinderReferenceSpeed = Averagewinderspeed; - } - WinderCalculation++; - }*/ - //WinderReferenceSpeed = 1000; - //ScrewNumberOfSteps = 1000; - //screw_horizontal_speed = ScrewNumberOfSteps / Rotations;//InternalWinderCfg.NumberOfRotationPerPassage; - // if (Rotations > 6.6)//7.0) - // Rotations = 6.0; - //RotationsPerSecond = WinderReferenceSpeed / (double)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; - //tempScrewSpeed = screw_horizontal_speed*RotationsPerSecond; - //ROM_IntMasterDisable(); tempScrewSpeed = ScrewSpeed; CurrentControlledSpeed[SCREW_MOTOR] = ScrewSpeed; diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c index 9c4628f4f..6339797d0 100644 --- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c @@ -371,20 +371,22 @@ bool SetValveDirection() U8 CartridgeWasteFilling(bool status) { bool ret = notOK; - //SetValveDirection(); + SetValveDirection(); if ((status == ON) && (WHS_info.active_cartridge != no_waste_cartridge)) { - SetValveDirection();//Valve_Set(VALVE_WASTE_TANK, WHS_info.active_cartridge); //set the valve direction + //SetValveDirection();//Valve_Set(VALVE_WASTE_TANK, WHS_info.active_cartridge); //set the valve direction //Pannel_Leds(PANEL_BUTTON_OR_CRAT_ID Pannel_Led_Id, OPERATION_MODE LED_Mode); //set cartridge led color slow blink SetWastePump(OPEN); //WHS_info.WHS_pump.time = 0; REPORT_MSG(WHS_empty," ------------ WHS WHS_empty start PUMP ----------------- "); + AlarmHandlingSetAlarm( EVENT_TYPE__NO_WASTE_CARTRIDGE_AVAILABLE, false); ret=OK; } else // stop Waste cartridge filling { SetWastePump(CLOSE); - Valve_Set(VALVE_WASTE_TANK, VALVE_DIR_WASTE_CARTRIDGE1); //set the valve direction set to low POWER !!! + //Valve_Set(VALVE_WASTE_TANK, VALVE_DIR_WAST_CARTRIDGE1); //set the valve direction set to low POWER !!! + AlarmHandlingSetAlarm( EVENT_TYPE__ALL_WASTE_CARTRIDGES_FULL, true); switch (WHS_info.active_cartridge) { @@ -496,7 +498,7 @@ bool initWHS_WasteTank() WHS_info.WHS_sensors.waste_tank_empty_sensor = RdWasteTankEmptySensor(); WHS_info.WHS_sensors.waste_tank_full_sensor = SENSORnotFULL; UpdateStateMachine(); - AddControlCallback("Waste tank",WasteTankCBFunction, WasteTankCallBackTime , WasteTankCallBackFunction, 0,0,0);//eOneMinute + AddControlCallback(WasteTankCBFunction, WasteTankCallBackTime , WasteTankCallBackFunction, 0,0,0);//eOneMinute return OK; } @@ -567,6 +569,14 @@ WHS_sensor WasteTankCallBackFunction() return ret; } +/* +bool start_WHS_machin() +{ + AddControlCallback( WasteTankCBFunction, eTenMillisecond, WasteTankCallBackFunction, 0,0,0 );// eOneMinute + return OK; +} + */ + bool WasteTankCBFunction() { @@ -617,6 +627,8 @@ bool WasteTankCBFunction() REPORT_MSG(WHS_emptying," ------------ WHS_full , cartridge cover is open cant start the pump!!!! ----------------- "); REPORT_MSG(WHS_emptying," ------------ close the cartridge cover to start the pump!!!! ----------------- "); //pump_on_flag = OPEN; + AlarmHandlingSetAlarm( EVENT_TYPE__NO_WASTE_CARTRIDGE_AVAILABLE, true); + WHS_info.WHS_sensors.waste_tank_full_sensor = SENSORnotFULL; break; } @@ -745,6 +757,7 @@ bool WasteTankCBFunction() REPORT_MSG(WHS_full," ------------ Mid-tank filling in process ----------------- "); Pannel_Leds(CART_1, MODE_ON); cart1.color = BLINK; + MidTankValvesAction(Cartridge_MidTank_ON); //add timeout IFS_TimeOutAlarm(false); IFS_info.Ink.time_out = 1; @@ -1203,27 +1216,22 @@ bool SetActiveWastCartridge() uint8_t parameter = 5; bool ret = notOK; - if (( WHS_info.WHS_sensors.waste_cartridge1_precense_sensor == PRECENSE ) - && (WHS_info.cartridge_1.autheticate == PASSED) - && (WHS_info.cartridge_1.status == WasteEmpty)) + if (( WHS_info.WHS_sensors.waste_cartridge1_precense_sensor == PRECENSE ) && + (WHS_info.cartridge_1.autheticate == PASSED)) { REPORT_MSG(parameter," ------------ WHS : active_cartridge = waste_cartridge 1 ----------------- "); WHS_info.active_cartridge = waste_cartridge1; - AlarmHandlingSetAlarm( EVENT_TYPE__NO_WASTE_CARTRIDGE_AVAILABLE, false); } - else if (( WHS_info.WHS_sensors.waste_cartridge2_precense_sensor == PRECENSE) - && (WHS_info.cartridge_2.autheticate == PASSED) - && (WHS_info.cartridge_2.status == WasteEmpty)) + else if (( WHS_info.WHS_sensors.waste_cartridge2_precense_sensor == PRECENSE) && + (WHS_info.cartridge_2.autheticate == PASSED)) { REPORT_MSG(parameter," ------------ WHS : active_cartridge = waste_cartridge 2 ----------------- "); WHS_info.active_cartridge = waste_cartridge2; - AlarmHandlingSetAlarm( EVENT_TYPE__NO_WASTE_CARTRIDGE_AVAILABLE, false); } else { REPORT_MSG(parameter," ------------ WHS : NO active_cartridge ----------------- "); WHS_info.active_cartridge = no_waste_cartridge; - AlarmHandlingSetAlarm( EVENT_TYPE__NO_WASTE_CARTRIDGE_AVAILABLE, true); } return ret; diff --git a/Software/PMR/Messages/Common/MessageType.proto b/Software/PMR/Messages/Common/MessageType.proto index a9bd65db9..d794393fe 100644 --- a/Software/PMR/Messages/Common/MessageType.proto +++ b/Software/PMR/Messages/Common/MessageType.proto @@ -209,6 +209,8 @@ enum MessageType StopDebugLogResponse = 4003; SetDebugLogCategoryRequest = 4004; SetDebugLogCategoryResponse = 4005; + SetupDebugDisributorsRequest = 4006; + SetupDebugDisributorsResponse = 4007; //Hardware UploadHardwareConfigurationRequest = 5000; -- cgit v1.3.1