diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-09-26 12:32:54 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-09-26 12:32:54 +0300 |
| commit | 387c1ee40b7bce5edd92491dc8d9edeb30a02524 (patch) | |
| tree | a935cdc365230ab4d4e324c5c1712ffe4ba39b60 /Software/Embedded_SW/Embedded/Modules | |
| parent | 771b7e5014a6023e660139100bb9221f86474a2b (diff) | |
| download | Tango-387c1ee40b7bce5edd92491dc8d9edeb30a02524.tar.gz Tango-387c1ee40b7bce5edd92491dc8d9edeb30a02524.zip | |
fix bug where thread jogging caused next jobs to be without ink, and other small problems
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules')
9 files changed, 87 insertions, 54 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index c8fdb452e..169cf5a11 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -245,65 +245,67 @@ void DiagnosticLoadMotor(int MotorId, int frequency) if (MotorCounterIndex[MotorId]>=DIAGNOSTICS_LIMIT ) MotorCounterIndex[MotorId] = 0; } -void DiagnosticsLoadDigitalValues(void) +uint32_t DiagnosticsLoadDigitalValues(void) { - DigitalOutputState[0].interfaceio = INTERFACE_IOS__GPO_DRYER_SSR3_CTRL; + uint32_t index = 0; + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_DRYER_SSR3_CTRL; if(F2_CTRL_Reg.ushort & CLEANER_PUMP_SSR3_CTRL) - DigitalOutputState[0].value = true; + DigitalOutputState[index++].value = true; else - DigitalOutputState[0].value = false; + DigitalOutputState[index++].value = false; - DigitalOutputState[1].interfaceio = INTERFACE_IOS__GPO_DRYER_SSR1_CTRL; - DigitalOutputState[1].value = GetHeaterState(1); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_DRYER_SSR1_CTRL; + DigitalOutputState[index++].value = GetHeaterState(1); - DigitalOutputState[2].interfaceio = INTERFACE_IOS__GPO_DRYER_SSR2_CTRL; - DigitalOutputState[2].value = GetHeaterState(2); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_DRYER_SSR2_CTRL; + DigitalOutputState[index++].value = GetHeaterState(2); - DigitalOutputState[3].interfaceio = INTERFACE_IOS__GPO_DYEINGH_SSR8_CTRL; - DigitalOutputState[3].value = GetHeaterState(3); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_DYEINGH_SSR8_CTRL; + DigitalOutputState[index++].value = GetHeaterState(3); - DigitalOutputState[4].interfaceio = INTERFACE_IOS__GPO_DYEINGH_SSR7_CTRL; - DigitalOutputState[4].value = GetHeaterState(4); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_DYEINGH_SSR7_CTRL; + DigitalOutputState[index++].value = GetHeaterState(4); - DigitalOutputState[5].interfaceio = INTERFACE_IOS__GPO_DYEINGH_SSR6_CTRL; - DigitalOutputState[5].value = GetHeaterState(5); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_DYEINGH_SSR6_CTRL; + DigitalOutputState[index++].value = GetHeaterState(5); - DigitalOutputState[6].interfaceio = INTERFACE_IOS__GPO_DYEINGH_SSR5_CTRL; - DigitalOutputState[6].value = GetHeaterState(6); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_DYEINGH_SSR5_CTRL; + DigitalOutputState[index++].value = GetHeaterState(6); - DigitalOutputState[7].interfaceio = INTERFACE_IOS__GPO_DILUTORPUMP_SSR10_CTRL; - DigitalOutputState[7].value = GetHeaterState(7); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_DILUTORPUMP_SSR10_CTRL; + DigitalOutputState[index++].value = GetHeaterState(7); - DigitalOutputState[8].interfaceio = INTERFACE_IOS__GPO_EXTWINDER_SSR11_CTRL; - DigitalOutputState[8].value = GetHeaterState(8); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_EXTWINDER_SSR11_CTRL; + DigitalOutputState[index++].value = GetHeaterState(8); - DigitalOutputState[9].interfaceio = INTERFACE_IOS__GPO_MIXCHIP_SSR4_CTRL; - DigitalOutputState[9].value = GetHeaterState(9); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_MIXCHIP_SSR4_CTRL; + DigitalOutputState[index++].value = GetHeaterState(9); - DigitalOutputState[10].interfaceio = INTERFACE_IOS__GPO_SPARE_SSR13_CTRL; - DigitalOutputState[10].value = ReadHeadMagnetBit(); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_SPARE_SSR13_CTRL; + DigitalOutputState[index++].value = ReadHeadMagnetBit(); - DigitalOutputState[11].interfaceio = INTERFACE_IOS__GPO_LED4; - DigitalOutputState[11].value = DataUpdated; + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_LED4; + DigitalOutputState[index++].value = DataUpdated; - DigitalOutputState[12].interfaceio = INTERFACE_IOS__GPI_WCONTAINER_FULL; - DigitalOutputState[12].value = WHS_IsContainerFull(); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPI_WCONTAINER_FULL; + DigitalOutputState[index++].value = WHS_IsContainerFull(); - DigitalOutputState[13].interfaceio = INTERFACE_IOS__GPI_WCONTAINER_WARN; - DigitalOutputState[13].value = WHS_IsContainerEmpty(); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPI_WCONTAINER_WARN; + DigitalOutputState[index++].value = WHS_IsContainerEmpty(); - DigitalOutputState[14].interfaceio = INTERFACE_IOS__GPO_SPARE1_1; /*waste lower cartridge presence*/ - DigitalOutputState[14].value = WHS_WasteCartridgeLowerPresent(); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_SPARE1_1; /*waste lower cartridge presence*/ + DigitalOutputState[index++].value = WHS_WasteCartridgeLowerPresent(); - DigitalOutputState[15].interfaceio = INTERFACE_IOS__GPO_SPARE1_2; /*waste middle cartridge presence*/ - DigitalOutputState[15].value = WHS_WasteCartridgeMiddlePresent(); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_SPARE1_2; /*waste middle cartridge presence*/ + DigitalOutputState[index++].value = WHS_WasteCartridgeMiddlePresent(); - DigitalOutputState[16].interfaceio = INTERFACE_IOS__GPO_SPARE_SSR12_CTRL; /*lubricant valve*/ - DigitalOutputState[16].value = GetLubricantState(); + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_SPARE_SSR12_CTRL; /*lubricant valve*/ + DigitalOutputState[index++].value = GetLubricantState(); - DigitalOutputState[17].interfaceio = INTERFACE_IOS__GPO_TFEED_BREAK_1; /*Secondary Pump Active*/ - DigitalOutputState[17].value = SecondaryPumpActive; + DigitalOutputState[index].interfaceio = INTERFACE_IOS__GPO_TFEED_BREAK_1; /*Secondary Pump Active*/ + DigitalOutputState[index++].value = SecondaryPumpActive; + return index; } void DiagnosticLoadTemperature(int HeaterId, int temperature) { @@ -682,8 +684,7 @@ void SendDiagnostics(void) //response.digitalpins = DigitalPinArray; response.n_componentsstates = 0; - DiagnosticsLoadDigitalValues(); - response.n_digitalinterfacestates = 18; + response.n_digitalinterfacestates = DiagnosticsLoadDigitalValues(); response.digitalinterfacestates = digitalinterfacestates; for (i=HEATER_TYPE__DryerAirHeater;i<=HEATER_TYPE__MixerHeater;i++) diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c index f5606f704..14c083b4d 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c @@ -66,6 +66,9 @@ uint32_t MotorHomingRequestFunc(MessageContainer* requestContainer) MotorHomingResponse response = MOTOR_HOMING_RESPONSE__INIT; TimerMotors_t MotorId = (TimerMotors_t)request->motortype; + if (LoadArmRounds <= 2) + LoadArmRounds = 20; + int speed = request->speed; if (speed == 0) speed = 150; if (MotorId <= NUM_OF_MOTORS) diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c index 29d5e0b31..1e4b1c0b3 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c @@ -157,6 +157,11 @@ uint32_t DispenserJoggingRequestFunc(MessageContainer* requestContainer) Control3WayValvesWithCallback ((Valves_t) request->index, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer SysCtlDelay(180000); direction = MotorsCfg[MotorId].directionthreadwize; + if (request->index == LUBRICANT_DISPENSER) + { + REPORT_MSG (request->index, "Open lubrication valve"); + Lubricant_2Way_Valve (START); + } break; case MOTOR_DIRECTION__Backward: Control3WayValvesWithCallback ((Valves_t) request->index, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer @@ -204,6 +209,12 @@ uint32_t DispenserAbortJoggingRequestFunc(MessageContainer* requestContainer) MotorStop(MotorId,Hard_Hiz); Control3WayValvesWithCallback ((Valves_t) request->index, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer + if (request->index == LUBRICANT_DISPENSER) + { + REPORT_MSG (request->index, "Close lubrication valve"); + Lubricant_2Way_Valve (STOP); + } + responseContainer = createContainer(MESSAGE_TYPE__DispenserAbortJoggingResponse, requestContainer->token, false, &response, &dispenser_abort_jogging_response__pack, &dispenser_abort_jogging_response__get_packed_size); responseContainer.continuous = false; uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.c b/Software/Embedded_SW/Embedded/Modules/General/buttons.c index e691cad69..c979d3c1d 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/buttons.c +++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.c @@ -204,7 +204,7 @@ uint32_t ButtonJogCBFunction(uint32_t IfIndex, uint32_t ReadValue) uint32_t ButtonLoadCBFunction(uint32_t IfIndex, uint32_t ReadValue) { - uint8_t parameter = 2; + //uint8_t parameter = 2; if ((load.bttn_status == press) && ( ReadValue == release )) { diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c index de8db6f9e..a160a0d6a 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c @@ -192,8 +192,8 @@ uint32_t IDS_HomeDispenserCallback(uint32_t motorId, uint32_t ReadValue) IDS_Dispenser_RefillEnded ( DispenserId, MotorsCfg[motorId].microstep); Report("Start backlash",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); DispenserHomingControlId[DispenserId] = AddControlCallback( IDS_HomeDispenserBackMoveCallback, InitialDispenserTimeLag, GetDispenserPressure,motorId, motorId, 0 ); - Task_sleep(10); MotorSetDirection(motorId,MotorsCfg[motorId].directionthreadwize); + Task_sleep(10); MotorSetSpeed(motorId, InitialDispenserSpeed); CurrentDispenserSpeed[DispenserId] = InitialDispenserSpeed; return OK; diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 607d0d07a..043f83b7b 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -271,7 +271,15 @@ void FreeBrushStopFileData(JobDescriptionFileBrushStop *BrushStop); CloseJobFile(); } GeneralHwReady = true; - REPORT_MSG (n_segments, "Finished checking the file"); + int ActiveDispensers = 0; + for (Dispenser_i = 0; Dispenser_i < MAX_DYE_DISPENSERS; Dispenser_i++) + { + if (DispenserUsedInJob[Dispenser_i] == true) //we actually should check for all dispensers + { + ActiveDispensers++; + } + } + Report("Finished checking the file", __FILE__, __LINE__, n_segments, RpWarning, ActiveDispensers, 0); return status; } @@ -644,7 +652,7 @@ c. Go to step 2.a x Segment.BrushStopsCount. //******************************************************************************************************************** uint32_t IDSPrepareState(void *JobDetails) { - int Motor_i, HW_Motor_Id, Pid_Id; + int Motor_i, Pid_Id; //start IDS control for all motors IDS_Active = true; Valve_Set(VALVE_MIXCHIP_WASTECH, Mixer_Waste); @@ -654,7 +662,7 @@ c. Go to step 2.a x Segment.BrushStopsCount. for (Motor_i = 0;Motor_i < MAX_SYSTEM_DISPENSERS;Motor_i++) { - HW_Motor_Id = DispenserIdToMotorId[Motor_i]; + //HW_Motor_Id = DispenserIdToMotorId[Motor_i]; Pid_Id = Motor_i;/*IDSMotorIdToControlId[Motor_i];*/ DispenserControlConfig[Motor_i].m_params.MAX = 1; DispenserControlConfig[Motor_i].m_params.MIN = DispensersControl[Pid_Id].outputproportionalpowerlimit*-1; @@ -1516,6 +1524,8 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) //MotorStop(HW_Motor_Id,Hard_Hiz); if (AutoHoming_Config >= AutoHoming_JobEnd_PowerOn_off) { + Report("IDS_Valve_EndValveReady start homing",__FILE__,deviceID,(int)AutoHoming_Config,RpWarning,(int)AutoHoming_JobEnd_PowerOn_off,0); + if (deviceID!=LUBRICANT_DISPENSER) IDS_HomeDispenser (deviceID, 1000 , NULL); } diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 9ad42d739..c68156e68 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -567,13 +567,13 @@ { REPORT_MSG(LoadStages, "Thread UnLoad State Machine step"); LoadArmInfo.LoadArmRounds = 0; - uint32_t numberOfSteps = 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); // OriginalMotorSpd_2PPS[FEEDER_MOTOR] = 1000; // CurrentControlledSpeed[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; + //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; MotorControlConfig[POOLER_MOTOR].m_params.MAX = 1; MotorControlConfig[POOLER_MOTOR].m_params.MIN = MotorsControl[POOLER_MOTOR].outputproportionalpowerlimit*-1; MotorControlConfig[POOLER_MOTOR].m_params.Kd = MotorsControl[POOLER_MOTOR].derivativetime; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 4cbe1f70f..60bf8123f 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -322,16 +322,19 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) #ifdef READ_SCREW_ENCODER int WinderRun; WinderRun = abs(ScrewLocationRun[1] - ScrewLocationRun[0]); - if ((WinderRun < 50000)&&(Add100 == false)) + if ((WinderRun < 20000)&&(Add100 == false)) { - WinderRunSum+=WinderRun; WinderRunSamples++; - WinderRunAverage = WinderRunSum/WinderRunSamples; - if ((fabs(WinderRun-WinderRunAverage)>=30)||(WinderRunSamples%100 == 0)) + if (WinderRunSamples>10) { - usnprintf(ScrewStr, 150, "curr,sum,avg,samples {Winder Encoder:, %d, %d, %d, %d, %d}",WinderRun,(int)WinderRunSum,(int)WinderRunAverage,(int)WinderRunSamples, - (int)(100*WinderRun/ScrewNumberOfSteps)); - Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0); + WinderRunSum+=WinderRun; + WinderRunAverage = WinderRunSum/(WinderRunSamples-10); + if ((fabs(WinderRun-WinderRunAverage)>=30)||(WinderRunSamples%100 == 0)) + { + usnprintf(ScrewStr, 150, "curr,sum,avg,samples {Winder Encoder:, %d, %d, %d, %d, %d}",WinderRun,(int)WinderRunSum,(int)WinderRunAverage,(int)WinderRunSamples, + (int)(100*WinderRun/ScrewNumberOfSteps)); + Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0); + } } } else diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index 5d84bb5d0..88d62a495 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -11,6 +11,9 @@ #include "PMR/Hardware/HardwareDancer.pb-c.h" #include "PMR/Hardware/HardwareWinder.pb-c.h" #include "PMR/Hardware/HardwareBreakSensor.pb-c.h" +#include <PMR/Diagnostics/EventType.pb-c.h> + +#include "Modules/AlarmHandling/AlarmHandling.h" #include "PMR/Printing/JobSpool.pb-c.h" #include "PMR/common/MessageContainer.pb-c.h" @@ -49,6 +52,8 @@ uint32_t MotorsConfigMessage(HardwareConfiguration * HWrequest) HardwareMotor *request; if (HWrequest == NULL) return ERROR; + AlarmHandlingSetAlarm (EVENT_TYPE__MACHINE_STATE_HW_CONFIG_FAILED,OFF); + for (MotorId = 0; MotorId < HWrequest->n_motors ; MotorId++) { request = HWrequest->motors[MotorId]; |
