diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-01-13 18:02:20 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-01-13 18:02:20 +0200 |
| commit | 18a3cf5d3cdec6142ee41f5beff5f63e6c68285c (patch) | |
| tree | 4ae27f913abfd02cb6779f3b0388d1ee719e3ee7 /Software/Embedded_SW/Embedded | |
| parent | c3c4c18e1c6e834b734243f968fca0555e901753 (diff) | |
| download | Tango-18a3cf5d3cdec6142ee41f5beff5f63e6c68285c.tar.gz Tango-18a3cf5d3cdec6142ee41f5beff5f63e6c68285c.zip | |
Version 1.4.6.3 fix power down reports, enable feeder as speed master, prepare keepalive testing for reconnection
Diffstat (limited to 'Software/Embedded_SW/Embedded')
11 files changed, 104 insertions, 36 deletions
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 8bcb8fc29..fcb2620b7 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,4,6,1}; +TangoVersion_t _gTangoVersion = {1,4,6,3}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d diff --git a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c index f0258c8da..56ceccd28 100644 --- a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c +++ b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c @@ -224,12 +224,12 @@ int32_t SetCommunicationPath(bool UARTorUSB) CommType = UARTorUSB; return OK; } -#define MAX_CONT_LOG 199 +/*#define MAX_CONT_LOG 199 uint16_t cSendSize[MAX_CONT_LOG+1] = {0}; uint32_t cSendTime[MAX_CONT_LOG+1] = {0}; uint16_t cSendindex = 0; - +*/ /****************************************************************************** * ======== communicationTask ======== * Task for this function is created statically. See the project's .cfg file. @@ -258,12 +258,12 @@ void communicationTxTask(UArg arg0, UArg arg1) else if (CommType == isUART) Uart_Tx(CommTxMessage.Buff, CommTxMessage.msgSize); } - cSendSize[cSendindex] = CommTxMessage.msgSize; +/* cSendSize[cSendindex] = CommTxMessage.msgSize; cSendTime[cSendindex] = msec_millisecondCounter; if (cSendindex++>=MAX_CONT_LOG) cSendindex = 0; - +*/ if (diagnosticscontainer_buffer == CommTxMessage.Buff) diagnosticscontainer_buffer = 0; my_free(CommTxMessage.Buff); diff --git a/Software/Embedded_SW/Embedded/Communication/Connection.c b/Software/Embedded_SW/Embedded/Communication/Connection.c index 9f355fa59..473aa05ee 100644 --- a/Software/Embedded_SW/Embedded/Communication/Connection.c +++ b/Software/Embedded_SW/Embedded/Communication/Connection.c @@ -133,8 +133,9 @@ void DisconnectionRequest(MessageContainer* requestContainer) } int KeepAliveOneSecondCounter = 0; -#define KEEPALIVE_COMMUNICATION_ABORT_LIMIT 30 +#define KEEPALIVE_COMMUNICATION_ABORT_LIMIT 10 bool KeepAliveActive = false; +bool keepalivetest = false; void KeepAliveRequestFunc(MessageContainer* requestContainer) { MessageContainer responseContainer; @@ -142,7 +143,8 @@ void KeepAliveRequestFunc(MessageContainer* requestContainer) //KeepAliveRequest* request = keep_alive_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); KeepAliveResponse response = KEEP_ALIVE_RESPONSE__INIT; - KeepAliveOneSecondCounter = 0; + if (keepalivetest == false) + KeepAliveOneSecondCounter = 0; KeepAliveActive = true; responseContainer = createContainer(MESSAGE_TYPE__KeepAliveResponse, requestContainer->token, true, &response, &keep_alive_response__pack, &keep_alive_response__get_packed_size); //------------------------------------------------------------------------------------------- @@ -156,21 +158,28 @@ void KeepAliveOneSecondCall(void) { if (KeepAliveActive == false) return; + if (FileUploadGetState()==false) + return; + KeepAliveOneSecondCounter++; + if (KeepAliveOneSecondCounter > (KEEPALIVE_COMMUNICATION_ABORT_LIMIT/2)) + { + Report("keepalive danger",__FILE__,__LINE__,KeepAliveOneSecondCounter,RpWarning,msec_millisecondCounter, 0); + } if (KeepAliveOneSecondCounter > KEEPALIVE_COMMUNICATION_ABORT_LIMIT) { Report("keepalive ",__FILE__,__LINE__,KeepAliveOneSecondCounter,RpWarning,msec_millisecondCounter, 0); //LOG_ERROR(KeepAliveOneSecondCounter, "Communication keepalive failed"); KeepAliveOneSecondCounter = 0; KeepAliveActive = false; - ReportStopReporting(); + //ReportStopReporting(); DiagnosticsStop(); JobStopReporting(); - AlarmHandlingStop(); + //AlarmHandlingStop(); //CommunicationMailboxFlush(); - - USBCDCD_init(); - //USBCDCD_Reinit(); + keepalivetest = false; + //USBCDCD_init(); + USBCDCD_Reinit(); //UART_ResetBuffers(); } } diff --git a/Software/Embedded_SW/Embedded/Communication/Connection.h b/Software/Embedded_SW/Embedded/Communication/Connection.h index f09d53996..8089cd82f 100644 --- a/Software/Embedded_SW/Embedded/Communication/Connection.h +++ b/Software/Embedded_SW/Embedded/Communication/Connection.h @@ -15,5 +15,6 @@ void KeepAliveRequestFunc(MessageContainer* requestContainer); void KeepAliveOneSecondCall(void); extern int KeepAliveOneSecondCounter; +extern bool keepalivetest; #endif /* COMMUNICATION_CONNECTION_H_ */ diff --git a/Software/Embedded_SW/Embedded/Communication/Container.c b/Software/Embedded_SW/Embedded/Communication/Container.c index eed14b2e7..5c27fb96e 100644 --- a/Software/Embedded_SW/Embedded/Communication/Container.c +++ b/Software/Embedded_SW/Embedded/Communication/Container.c @@ -136,12 +136,13 @@ void receive_callback(char* buffer, size_t length) MessageContainer* requestContainer = message_container__unpack(NULL, length, (uint8_t*)buffer); if (requestContainer == NULL) return; - /*if ((requestContainer->type>= MESSAGE_TYPE__StartDiagnosticsRequest)&&(requestContainer->type != MESSAGE_TYPE__KeepAliveRequest)) //user action resets the idle counter + if ((requestContainer->type>= MESSAGE_TYPE__StartDiagnosticsRequest)&&(requestContainer->type != MESSAGE_TYPE__KeepAliveRequest)) //user action resets the idle counter { ReportWithPackageFilter(CommFilter,"Message received", __FILE__,__LINE__,requestContainer->type, RpMessage,length, 0); - }*/ + } if (requestContainer->type != MESSAGE_TYPE__KeepAliveRequest) resetIdleCounter(); + //ReportWithPackageFilter(CommFilter,"Message received", __FILE__,__LINE__,requestContainer->type, RpMessage,length, 0); KeepAliveOneSecondCounter = 0; /*msgId[RxIndex] = requestContainer->type; Length[RxIndex] = length; diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c index 2e39607d6..87f259e83 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c @@ -6,6 +6,8 @@ #include "include.h" #include "driverlib/gpio.h" +#include "Communication/Connection.h" + #include "Drivers/USB_Communication/USBCDCD.h" #include "StateMachines/Initialization/PowerOffSequence.h" @@ -290,6 +292,17 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) response.has_progress = true; } + + else + if(request->amount == 0xB3) //fast refresh for pressure + { + LOG_ERROR(request->amount,"keep alive test"); + + keepalivetest = true; + response.progress = keepalivetest; + response.has_progress = true; + + } else if((request->amount == 0xDF) && (request->delay == 0xDF)) //Power off { @@ -299,7 +312,7 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) if(request->amount == 0xF1) { LOG_ERROR(request->delay,"NumberOfRotationPerPassage"); - //NumberOfRotationPerPassage = (float)(request->delay)/1000; + NumberOfRotationPerPassage = (float)(request->delay)/1000; } else { diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 0aff26320..049e64a64 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -647,6 +647,9 @@ // CurrentControlledSpeed[FEEDER_MOTOR] = 1000; //MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmInfo.LoadArmRounds); + ThreadMotorIdToMotorId[FEEDER_MOTOR] = HARDWARE_MOTOR_TYPE__MOTO_RDRIVING ; + ThreadMotorIdToMotorId[DRYER_MOTOR] = HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING; + MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&DrierPrevLocation); numberOfCycles = 0; 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; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 45ab2cb19..26616c141 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -41,11 +41,7 @@ double CurrentControlledSpeed[MAX_THREAD_MOTORS_NUM] = {0}; -#ifndef DRIER_CONTROL_TEST -TimerMotors_t ThreadMotorIdToMotorId[MAX_THREAD_MOTORS_NUM] = {HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,HARDWARE_MOTOR_TYPE__MOTO_WINDER,HARDWARE_MOTOR_TYPE__MOTO_SCREW}; -#else TimerMotors_t ThreadMotorIdToMotorId[MAX_THREAD_MOTORS_NUM] = {HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,HARDWARE_MOTOR_TYPE__MOTO_WINDER,HARDWARE_MOTOR_TYPE__MOTO_SCREW}; -#endif HardwareDancerType ThreadMotorIdToDancerId[MAX_THREAD_MOTORS_NUM] = {FEEDER_DANCER,NUM_OF_DANCERS,POOLER_DANCER,WINDER_DANCER,NUM_OF_DANCERS}; uint32_t ControlIdtoMotorId [MAX_THREAD_MOTORS_NUM] = {0xFF,0xFF,0xFF,0xFF,0xFF}; uint32_t SpeedControlId=0xFF; @@ -121,8 +117,8 @@ uint32_t Control_Delta_Position_Pass(uint32_t Current_Read,uint32_t Previous_Rea if (Current_Read < Previous_Read) { - Time_Pass = (MAX_COUNTER - Previous_Read) + Current_Read + 1; ReportWithPackageFilter(ThreadFilter,"Length rollover",__FILE__,__LINE__,(int)Current_Read,RpWarning,(int)Previous_Read,0); + Time_Pass = (MAX_COUNTER - Previous_Read) + Current_Read + 1; } else Time_Pass = Current_Read - Previous_Read; @@ -500,6 +496,10 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) } KeepReadValue = ReadValue; TranslatedReadValue = ReadValue - DancersCfg[DancerId].zeropoint; + if (abs(TranslatedReadValue) > 0x2000) + { + TranslatedReadValue = 0x3FFF- TranslatedReadValue; //overcome zero environment + } if (index == POOLER_MOTOR) { //pooler dancer is right sided: data is opposite @@ -608,14 +608,14 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) DancerError[DancerId] = NormalizedError; MotorControlConfig[index].m_calculatedError = PIDAlgorithmCalculation((float)MotorControlConfig[index].m_SetParam , (float)MotorControlConfig[index].m_mesuredParam, &MotorControlConfig[index].m_params, &MotorControlConfig[index].m_preError, &MotorControlConfig[index].m_integral); - if (index != FEEDER_MOTOR) //feeder unit handles errors opposite to left unit + if ((index != FEEDER_MOTOR)||(MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].speedmaster == false)) //feeder unit handles errors opposite to left unit { MotorControlConfig[index].m_calculatedError = (-1*MotorControlConfig[index].m_calculatedError); } - else + /*else { //KeepNormalizedError = NormalizedError; - } + }*/ /*if ((JobCounter % 100) == 0) { //if (index == WINDER_MOTOR) //feeder unit handles errors opposite to left unit @@ -742,6 +742,16 @@ uint32_t ThreadInitialTestStub(HardwareMotor * request) EnableIntersegment = JobTicket->enableintersegment; IntersegmentLength = JobTicket->intersegmentlength; + if(MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].speedmaster == false) + { + ThreadMotorIdToMotorId[FEEDER_MOTOR] = HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING; + ThreadMotorIdToMotorId[DRYER_MOTOR] = HARDWARE_MOTOR_TYPE__MOTO_RDRIVING; + } + else + { + ThreadMotorIdToMotorId[FEEDER_MOTOR] = HARDWARE_MOTOR_TYPE__MOTO_RDRIVING ; + ThreadMotorIdToMotorId[DRYER_MOTOR] = HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING; + } MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, Hard_Stop); if (FPGA_Read_limit_Switches(Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_DH_LID]) != LIMIT) diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c index e1866a6d9..aa8583a4d 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerOffSequence.c @@ -81,6 +81,8 @@ void PowerOffSetTemperatureThreshold (int32_t temperature) Report("PowerOff Set Temperature",__FILE__,__LINE__,(int)PowerOffTemperatureThreshold,RpWarning,(int)3600,0); } } +#define UPDATE_TIMEOUT 2 +uint8_t UpdateCounter = 0; /*******************************************************************************************************/ uint32_t PowerOffScheduler(uint32_t IfIndex, uint32_t BusyFlag) { @@ -89,6 +91,11 @@ uint32_t PowerOffScheduler(uint32_t IfIndex, uint32_t BusyFlag) StoredMachineState = PowerOffMachineState; PowerOffSequenceStateMachine (PowerOffMachineState); } + if (UpdateCounter++ >= UPDATE_TIMEOUT) + { + UpdateCounter = 0; + PowerDownUpdate(PowerOffMachineState); + } return OK; } /*******************************************************************************************************/ @@ -183,12 +190,15 @@ uint32_t PowerOffMixerFlushCallback(void) Task_sleep (20); - for (i=0;i<MAX_SYSTEM_DISPENSERS;i++) + if (AutoHoming_Config >= AutoHoming_PowerOff ) { - if(IDS_HomeDispenser(i,1000,PowerOffDispenserHomingCallback) == OK) + for (i=0;i<MAX_SYSTEM_DISPENSERS;i++) { - DispenserHomingActive[i] = true; - REPORT_MSG (i, "PowerOffDispenserHomingCallback"); + if(IDS_HomeDispenser(i,1000,PowerOffDispenserHomingCallback) == OK) + { + DispenserHomingActive[i] = true; + REPORT_MSG (i, "PowerOffDispenserHomingCallback"); + } } } PowerOffMachineState++; @@ -210,9 +220,12 @@ uint32_t PowerOffMixerFlush(void) for (i=0;i<MAX_SYSTEM_DISPENSERS;i++) { if (i!=TI_DISPENSER_ID) - IDS_Dispenser_Close_Valve_And_Stop_Motor(i, NULL); + IDS_StopHomeDispenser(i); else + { IDS_Dispenser_Close_Valve_And_Stop_Motor(i, PowerOffMixerFlushDispenserStopCallback); + IDS_StopHomeDispenser(i); + } } return OK; @@ -373,8 +386,8 @@ uint32_t PowerOffWaitForTemperatureCallback(uint32_t IfIndex, uint32_t BusyFlag) { Report("On going cooling down, wait for end of cooling",__FILE__,__LINE__,(int)MaxTemp,RpWarning,(int)WaitForProcessCounter,0); resetIdleCounter(); - if (WaitForProcessCounter%10 == 2) - PowerDownUpdate(POWER_OFF_WAIT_FOR_TEMPERATURE); + //if (WaitForProcessCounter%UPDATE_TIMEOUT == 2) + // PowerDownUpdate(POWER_OFF_WAIT_FOR_TEMPERATURE); } else { @@ -524,10 +537,24 @@ uint32_t PowerDownUpdate(POWER_OFF_STAGES_ENUM stage) response.progresspercentage = 0.0; response.message = "Initializing"; break; + case POWER_OFF_STOP_RUNNING_JOB: + response.state = stage +1; + response.progresspercentage = 2.0; + response.message = "Stop running job"; + break; case POWER_OFF_HEAD_CLEAN: response.state = stage +1; + response.message = "Head Cleaning running"; response.progresspercentage = 5.0; - response.message = "Clean head"; + if ((HeaterCheckReady())&&(PoolerTotalProcessedLength < 1.0)) + { + response.message = "Head Cleaning heating up"; + response.progresspercentage = 10.0; + } + response.progresspercentage += ((PoolerTotalProcessedLength/job_length)*10); + Report("Job calculation",__FILE__,(int)response.progresspercentage,(int)PoolerTotalProcessedLength,RpWarning,(int)job_length,0); + if (response.progresspercentage > 20.0) + response.progresspercentage = 20.0; break; case POWER_OFF_MIXER_FLUSH: response.state = stage +1; @@ -549,11 +576,6 @@ uint32_t PowerDownUpdate(POWER_OFF_STAGES_ENUM stage) response.progresspercentage = 30.0; response.message = "Wait for processes"; break; - case POWER_OFF_STOP_RUNNING_JOB: - response.state = stage +1; - response.progresspercentage = 31.0; - response.message = "Stop running job"; - break; case POWER_OFF_SET_VALVE_POSITION: response.state = stage +1; response.progresspercentage = 32.0; @@ -611,6 +633,7 @@ uint32_t PowerDownUpdateFunc(MessageContainer* requestContainer) // MachineUpdateInitParams InitParams; + Report("PowerDownUpdateFunc",__FILE__,__LINE__,(int)0,RpWarning,(int)0,0); StartPowerDownRequest* request = start_power_down_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); ustrncpy (PowerDownToken, requestContainer->token,36); @@ -651,6 +674,7 @@ uint32_t AbortPowerDownFunc(MessageContainer* requestContainer) //USBCDCD_sendData(container_buffer, container_size,10); SendChars((char*)container_buffer, container_size); + PowerOffMachineState = POWER_OFF_CANCELLED; PowerDownUpdate(POWER_OFF_CANCELLED); ctlId = AddControlCallback("Abort", AbortPowerDownResetCallBackFunction, 2* eOneSecond, TemplateDataReadCBFunction,0,0, 0 ); diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index 3ac39d390..29dd386a6 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -472,12 +472,14 @@ uint32_t ThreadCleaningJobFunc(int speed) Ticket.n_segments = 1; Ticket.enableintersegment = true; Ticket.intersegmentlength = 100; + Ticket.length += Ticket.intersegmentlength; n_segments = 2; Ticket.segments = my_malloc(sizeof(Ticket.segments)*2); TSegment = my_malloc(sizeof(JobSegment)); Tspool = my_malloc(sizeof(JobSpool)); TbrushStop = my_malloc(sizeof(JobBrushStop)); TSegment->length = 10.0; + Ticket.length += (TSegment->length*n_segments); TSegment->n_brushstops = 1; TSegment->brushstops = my_malloc(sizeof(TSegment->brushstops)); TSegment->brushstops[0] = TbrushStop; @@ -501,6 +503,8 @@ uint32_t ThreadCleaningJobFunc(int speed) Tspool->rotationsperpassage = 3.1415926*2; Ticket.spool = Tspool; CurrentJob = &Ticket; + job_length = CurrentJob->length + dryerbufferMeters; + JobAlarmReason = AlarmHandlingPrepareJob(CurrentJob); if (JobAlarmReason !=OK) { @@ -758,6 +762,7 @@ void JobRequestFunc(MessageContainer* requestContainer) if (JobAlarmReason ==OK) { n_unit_segments = n_segments; + n_units = 1; if ((Ticket->has_numberofunits)&&(Ticket->numberofunits > 1)) { n_units = Ticket->numberofunits; diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h index bd9998a31..8fa70a99e 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h @@ -150,6 +150,8 @@ extern JobTicket *CurrentJob; extern Mailbox_Handle JobmsgQ; extern bool JobAbortedByUser; +extern double job_length; + void PrintSTMMsgHandler(void * msg); //void JobInit(void); //void PrintingsInit(void); |
