From 0cbf104a30c3f0c4e9dbbe9db47d6ad72df03655 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 11 Jun 2019 18:49:45 +0300 Subject: Embedded SW Release note - Version 1.4.0.9 ============================================================= Drivers: Support for PowerStep 01 motor drivers (combined current/voltage) - initialization only Screw encoder reading (requires FPGA firmware update) Motor speeds in float - to enable small speeds. read motor speed from driver. Modules: PID - support small numbers in PID function - thread improved General -Safety alarms (not fully tested) Heaters PID fixed - use band setting for PID start of operation IDS - check that all brushstop data is read before moving to next segment. file initial reading improved. WFCF for active dispenser Thread - Thread control fixed. screw goes home on the last 800 milliseconds Procedures: JOBS units - supported in embedded, waiting for cooperation with APP --- .../Embedded_SW/Embedded/Common/SW_Info/SW_Info.c | 2 +- .../Embedded_SW/Embedded/Drivers/Motors/Motor.c | 4 -- .../Embedded/Drivers/USB_Communication/USBCDCD.c | 3 + Software/Embedded_SW/Embedded/Main.c | 2 +- .../Embedded_SW/Embedded/Modules/General/buttons.c | 16 +++++ .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 34 ++++++++--- .../Embedded/Modules/Thread/Thread_Winder.c | 2 +- .../Embedded/Modules/Thread/Thread_ex.h | 1 + .../Embedded/Modules/Thread/Thread_print.c | 4 ++ .../Embedded/Software Release Notes.txt | 22 +++++++ .../Embedded/StateMachines/Printing/JobSTM.c | 14 ++++- .../Embedded/StateMachines/Printing/PrintingSTM.c | 69 ++++++++++++++++++---- .../Embedded/StateMachines/Printing/PrintingSTM.h | 2 + 13 files changed, 144 insertions(+), 31 deletions(-) (limited to 'Software') 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 6cfff6e17..f0ee0af19 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,0,7}; +TangoVersion_t _gTangoVersion = {1,4,0,9}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c index c83be0a5c..2c29ad564 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c @@ -120,10 +120,6 @@ uint32_t MotorSetDirection(TimerMotors_t _motorId,bool _direction) uint32_t MotorSetSpeed(TimerMotors_t _motorId, float _freq)//TODO MicroSteps? { - if (_motorId == HARDWARE_MOTOR_TYPE__MOTO_SCREW) - { - LOG_ERROR ((int)_freq, "SCREW SET SPEED CALLED"); - } uint32_t RunSpeed = SpdCalc(_freq); #ifdef EVALUATION_BOARD Run_Value = RunSpeed; diff --git a/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c b/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c index 5863c90e5..56e695ca4 100644 --- a/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c +++ b/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c @@ -455,6 +455,9 @@ DFUDetachCallback(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgData, // // Release updateSem // + ControlStop(); + MillisecStop(); + Semaphore_post(updateSem); ROM_WatchdogResetDisable(WATCHDOG0_BASE); //ROM_WatchdogReloadSet(WATCHDOG0_BASE, 120000000*90); diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index 36825d232..224e32a70 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -74,7 +74,7 @@ #include "Modules/General/buttons.h" #include "Modules/Waste/Waste.h" #include -#define WATCHDOG +//#define WATCHDOG //***************************************************************************** diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.c b/Software/Embedded_SW/Embedded/Modules/General/buttons.c index cfd44a6fa..1c719d778 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/buttons.c +++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.c @@ -613,6 +613,22 @@ void Ink_Cart_Led()//temporary for ITMA { Pannel_Leds( CART_1, MODE_OFF); } + if(Is_Cartridge_Present(CART_2) == true) + { + Pannel_Leds( CART_2, MODE_ON); + } + else + { + Pannel_Leds( CART_2, MODE_OFF); + } + if(Is_Cartridge_Present(CART_3) == true) + { + Pannel_Leds( CART_3, MODE_ON); + } + else + { + Pannel_Leds( CART_3, MODE_OFF); + } } void test_avi() diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 0b54658ad..826a9ff26 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -196,21 +196,25 @@ JobDescriptionFileBrushStop *GetNextBrushStopFromJobFile(); void FreeBrushStopFileData(JobDescriptionFileBrushStop *BrushStop); */ - /************************************************************************************************************************************ - uint32_t IDS_MapDispenserUsedinFileJobshort(void *JobDetails) + /************************************************************************************************************************************/ + uint32_t IDS_MapDispenserUsedinFileJob(void *JobDetails) { JobTicket* JobTicket = JobDetails; - JobDescriptionFileBrushStop *BrushStop; - JobDescriptionFileSegment *Segment; + JobDescriptionFileBrushStop *BrushStop = NULL; + JobDescriptionFileSegment *Segment = NULL; int Dispenser_i, Brush_i,DispenserId; FRESULT Fresult = FR_OK; uint32_t status = OK; bool lookForLubrication = false; + int brushCounter = 0; + + GeneralHwReady = false; for (Dispenser_i = 0;Dispenser_ienablelubrication == true) @@ -225,6 +229,7 @@ void FreeBrushStopFileData(JobDescriptionFileBrushStop *BrushStop); Segment = GetNextSegmentFromJobFile(); while(Segment) { + n_segments++; if ((Segment->has_brushstopscount)&&(Segment->brushstopscount)) { for (Brush_i=0;Brush_ibrushstopscount;Brush_i++) @@ -232,6 +237,12 @@ void FreeBrushStopFileData(JobDescriptionFileBrushStop *BrushStop); BrushStop = GetNextBrushStopFromJobFile(); if (BrushStop) { + if ((brushCounter % 100)==0) + { + SendJobProgress(0.0,0,false, "Processing file"); + Control_WD(ENABLE,55); //activate heaters/dispenser watchdog, 0.5 seconds + } + brushCounter++; if (BrushStop->n_dispensers) { for (Dispenser_i = 0;Dispenser_i < BrushStop->n_dispensers;Dispenser_i++) @@ -245,6 +256,9 @@ void FreeBrushStopFileData(JobDescriptionFileBrushStop *BrushStop); { lookForLubrication = false; lubricant_speed = BrushStop->dispensers[Dispenser_i]->nanolitterpersecond/BrushStop->dispensers[Dispenser_i]->nanoliterperpulse; + REPORT_MSG (BrushStop->dispensers[Dispenser_i]->nanolitterpersecond*100, "LUBRICANT nl / sec"); + REPORT_MSG (BrushStop->dispensers[Dispenser_i]->nanoliterperpulse*100, "LUBRICANT nl / pulse"); + REPORT_MSG (BrushStop->dispensers[Dispenser_i]->dispenserstepdivision, "step division"); if (BrushStop->dispensers[Dispenser_i]->dispenserstepdivision != DISPENSER_STEP_DIVISION__Auto) { @@ -281,11 +295,13 @@ void FreeBrushStopFileData(JobDescriptionFileBrushStop *BrushStop); FreeSegmentFileData(Segment); CloseJobFile(); } + GeneralHwReady = true; + REPORT_MSG (n_segments, "Finished checking the file"); return status; } - *************************************************************************************************************************************/ - /************************************************************************************************************************************/ + /*************************************************************************************************************************************/ + /************************************************************************************************************************************ uint32_t IDS_MapDispenserUsedinFileJob(void *JobDetails) { JobTicket* JobTicket = JobDetails; @@ -299,7 +315,7 @@ void FreeBrushStopFileData(JobDescriptionFileBrushStop *BrushStop); FIL *FileHandle = 0; //the system supports a single active file bool lookForLubrication = false; int brushCounter = 0; -/* +/`* Parsing the job description file. The job description file simply contains an array of segments and their brush stops. The job description file is meant to be read brush stop by brush stop while the job is in progress. @@ -319,7 +335,7 @@ a. Read brush stop message length. b. Read brush stop message. c. Go to step 2.a x Segment.BrushStopsCount. 3. Go to step 1 until end of file. - */ + *`/ GeneralHwReady = false; for (Dispenser_i = 0;Dispenser_i1) + { + n_segments = n_segments*n_units; + } //#warning Process parameters in job request are not handled. push separately for now if (Ticket->processparameters) { @@ -923,6 +928,7 @@ uint32_t ResumeCurrentJobRequestFunc(MessageContainer* requestContainer) ustrncpy (JobToken, requestContainer->token,36); JobResumed = true; usnprintf(ErrorMsg, 100, "Job Resumed"); + Report("Job resumed",__FILE__,__LINE__, JobActive,RpMessage,JobResumed,0); jobStatus.message =ErrorMsg; jobStatus.has_progress = true; @@ -934,7 +940,7 @@ uint32_t ResumeCurrentJobRequestFunc(MessageContainer* requestContainer) else { usnprintf(ErrorMsg, 100, "Job not Resumed"); - + Report("Job not resumed",__FILE__,__LINE__, JobActive,RpMessage,JobResumed,0); jobStatus.message =ErrorMsg; jobStatus.has_progress = true; jobStatus.progress = 0.0; @@ -997,7 +1003,9 @@ Void jobTask(UArg arg0, UArg arg1) { case JobRequestMsg: JobEndReason = JOB_OK; + Report("JobRequestMsg",__FILE__,__LINE__, JobActive,RpMessage,JobResumed,0); JobActive = true; + JobResumed = false; setmachineActive(true); PrepareState (CurrentJob); break; diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c index 484dc9e7e..729e3ab8e 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c @@ -38,11 +38,14 @@ * functions describes motor operation flow and movement state during profile execution * used to operate in runtime correct profileflow execution *********************************************************************************************/ -static uint32_t PreSegmentState(void *Segment, int); -static uint32_t SegmentState(void *Segment, int); +static uint32_t PreSegmentState(void *Segment, int,int); +static uint32_t SegmentState(void *Segment, int,int); uint32_t EndState(void *JobDetails, char *Message); //static uint32_t ExitState(void *JobDetails); uint16_t n_segments = 0; +uint16_t n_units = 1; +uint16_t n_unit_segments = 0; + /********************************************************************** * the array and enum of PrintingState_t below must be in sync order ***********************************************************************/ @@ -98,7 +101,6 @@ uint8_t *SegmentPtr = 0, *BrushStopPtr = 0; FIL *JobRequestFileHandle = 0; //the system supports a single active file FRESULT OpenJobFile() { - //n_segments = 0; if (CurrentJob->uploadstrategy == JOB_UPLOAD_STRATEGY__JobDescriptionFile) { JobRequestFileHandle = my_malloc(sizeof(FIL)); @@ -112,6 +114,20 @@ FRESULT OpenJobFile() } return Fresult; } +FRESULT RewindJobFile() +{ + if (CurrentJob->uploadstrategy == JOB_UPLOAD_STRATEGY__JobDescriptionFile) + { + Fresult = f_lseek(JobRequestFileHandle, 0); + + if (Fresult == FR_OK) + { + readbBytes = 0; + } + REPORT_MSG(bBytes,"RewindJobFile"); + } + return Fresult; +} FRESULT CloseJobFile() { Fresult = f_close(JobRequestFileHandle); @@ -380,7 +396,7 @@ uint32_t PreSegmentReady(int ModuleId, ModuleStateEnum result) } //******************************************************************************************************************** -static uint32_t PreSegmentState(void *SegmentDetails, int SegmentId) +static uint32_t PreSegmentState(void *SegmentDetails, int SegmentId,int SegmentIdPointer) { SendJobProgress(0.0, SegmentId, false, "PreSegment Start"); if (Configured[Module_Thread]) @@ -462,7 +478,7 @@ uint32_t SegmentReady(int ModuleId, ModuleStateEnum result) } //******************************************************************************************************************** -static uint32_t SegmentState(void *SegmentDetails, int SegmentId) +static uint32_t SegmentState(void *SegmentDetails, int SegmentId,int SegmentIdPointer) { SendJobProgress(0.0, SegmentId, false, "Segment Start"); if (Configured[Module_IDS]) @@ -551,6 +567,7 @@ static uint32_t DistanceToSpoolState(void *JobDetails) if (Configured[Module_Winder]) { //DistanceToSpoolWaiting[Module_Winder] = ModuleWaiting; + WinderDistanceToSpoolState(); //Winder_DistanceToSpool(JobDetails); } return OK; @@ -625,7 +642,7 @@ void StartPrinting(void) //******************************************************************************************************************** //******************************************************************************************************************** -int SegmentId = 0; +int SegmentId = 0,UnitId = 0, SegmentIdPointer = 0; JobDescriptionFileSegment *Segment; JobSegment SSegment; @@ -647,27 +664,29 @@ void PrintSTMMsgHandler(void * msg) { case PrintRequest: SegmentId = 0; + SegmentIdPointer = 0; + UnitId = 0; if (CurrentJob->uploadstrategy == JOB_UPLOAD_STRATEGY__JobDescriptionFile) { Segment = GetNextSegmentFromJobFile(); SSegment.length = Segment->length; SSegment.has_length = Segment->has_length; SSegment.n_brushstops = Segment->brushstopscount; - PreSegmentState(&SSegment,SegmentId); + PreSegmentState(&SSegment,SegmentId,SegmentIdPointer); } else { - PreSegmentState(CurrentJob->segments[SegmentId],SegmentId); + PreSegmentState(CurrentJob->segments[SegmentIdPointer],SegmentId,SegmentIdPointer); } break; case PreSegmentResultsOk: if (CurrentJob->uploadstrategy == JOB_UPLOAD_STRATEGY__JobDescriptionFile) { - SegmentState(&SSegment,SegmentId); + SegmentState(&SSegment,SegmentId,SegmentIdPointer); } else { - SegmentState(CurrentJob->segments[SegmentId],SegmentId); + SegmentState(CurrentJob->segments[SegmentIdPointer],SegmentId,SegmentIdPointer); } break; case PreSegmentResultsFail: @@ -676,7 +695,33 @@ void PrintSTMMsgHandler(void * msg) break; case SegmentResultsOk: SegmentId++; + SegmentIdPointer++; //REPORT_MSG(SegmentId, "SegmentResultsOk segmentId"); + if ((SegmentId % n_unit_segments)==0) //finished a unit + { + Report("unit finished",__FILE__,__LINE__, SegmentId,RpMessage,n_unit_segments,0); + UnitId++; + if (UnitId < n_units) + { + if (CurrentJob->uploadstrategy == JOB_UPLOAD_STRATEGY__JobDescriptionFile) + { + //rewind file + if (RewindJobFile() != FR_OK) + { + JobEndReason = JOB_OTHER_ALARM; + if (dryerbufferlength == 0) + EndState(CurrentJob, "Job Ended"); + else + DistanceToSpoolState(CurrentJob); + } + Report("start unit ",__FILE__,__LINE__, UnitId,RpMessage,n_units,0); + } + SegmentIdPointer = 0; + } + } + + + Report("SegmentResultsOk segmentId",__FILE__,__LINE__, SegmentId,RpMessage,n_segments,0); if (SegmentId >= n_segments) { @@ -720,11 +765,11 @@ void PrintSTMMsgHandler(void * msg) SSegment.length = Segment->length; SSegment.has_length = Segment->has_length; SSegment.n_brushstops = Segment->brushstopscount; - PreSegmentState(&SSegment,SegmentId); + PreSegmentState(&SSegment,SegmentId,SegmentIdPointer); } else { - PreSegmentState(CurrentJob->segments[SegmentId],SegmentId); + PreSegmentState(CurrentJob->segments[SegmentIdPointer],SegmentId,SegmentIdPointer); } } break; diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h index d7d8262f4..b9a82defa 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.h @@ -173,6 +173,8 @@ bool JobIsActive(void); extern bool SuspendLargeMessages; extern uint16_t n_segments; +extern uint16_t n_units; +extern uint16_t n_unit_segments; void SendJobProgress(double ProcessedLength,int SegmentId, bool done, char *Message); uint32_t PrepareReady(int ModuleId, ModuleStateEnum result); -- cgit v1.3.1