aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2020-12-23 22:45:37 +0200
committerShlomo Hecht <shlomo@twine-s.com>2020-12-23 22:45:37 +0200
commita7d02907a37ba35da13b03264ba5110bd08f83c1 (patch)
treeca2bb997a06e16e34eb64a3c7ccea258cdfa925e /Software/Embedded_SW/Embedded
parentbd9bea9c2555a86fe092d5edb725867aadc64671 (diff)
downloadTango-a7d02907a37ba35da13b03264ba5110bd08f83c1.tar.gz
Tango-a7d02907a37ba35da13b03264ba5110bd08f83c1.zip
prepare progress
Diffstat (limited to 'Software/Embedded_SW/Embedded')
-rw-r--r--Software/Embedded_SW/Embedded/Main.c1
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c21
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h3
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c1
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c22
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c12
8 files changed, 62 insertions, 2 deletions
diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c
index 6b2878677..899143c36 100644
--- a/Software/Embedded_SW/Embedded/Main.c
+++ b/Software/Embedded_SW/Embedded/Main.c
@@ -13,6 +13,7 @@
*/
#include <driverlib/sysctl.h>
#include "driverlib/eeprom.h"
+#include "driverlib/hibernate.h"
#include "Drivers/USB_Communication/USBCDCD.h"
#include "Drivers/I2C_Communication/I2C.h"
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
index fd13e37e5..c939b27c6 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
@@ -748,7 +748,7 @@ uint32_t MillisecLowLoop(uint32_t tick)
ulocaltime(umktime(&LocalTime)+1,&LocalTime);
HibernateCalendarSet(&LocalTime);
- ReportWithPackageFilter(ThreadFilter,"Time: ",__FILE__,LocalTime.tm_hour,LocalTime.tm_min,RpWarning,(int) LocalTime.tm_sec,0);
+ //ReportWithPackageFilter(ThreadFilter,"Time: ",__FILE__,LocalTime.tm_min,LocalTime.tm_sec,RpWarning,(int) msec_millisecondCounter,0);
Trigger_WHS_MAX11614_Read_allADC();
FPGA_GetAllDispensersValveBusyOCD();
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h
index 7c11b12bf..7e3f6252f 100644
--- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h
+++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h
@@ -40,6 +40,8 @@ void Heaters_SetOverHeatTimeOutValues(uint32_t OverHeatTimeout, uint32_t UnderHe
void Heaters_SetOperationLimits(int acheatersloweroperationlimit,int acheatersupperoperationlimit,int dcheatersloweroperationlimit,int dcheatersupperoperationlimit);
uint32_t DrierHeaterVoltageSetup(void);
+//this function returns preparation ratio for the most cool heater (current temperature/ target temerature)
+double HeatersPrepareProgress(void);
uint32_t HeatersEnd(void);
void HeatersControlStart(void);
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
index db7261090..d48139255 100644
--- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
@@ -574,6 +574,27 @@ uint32_t HeatersSingleHeaterEnd(int HeaterId)
return status;
}
+//this function returns preparation ratio for the most cool heater (current temperature/ target temerature)
+double HeatersPrepareProgress(void)
+{
+ HardwarePidControlType i;
+ double MaxDifference = 1.00,temp = 0;
+ for (i=0;i<HEATER_TYPE_MAX_HEATERS;i++)
+ {
+ if(HeaterCmd[i].targettemperatue)
+ {
+ if (MillisecGetTemperatures(HeaterId2PT100Id[i])>=HeaterCmd[i].targettemperatue)
+ continue;
+ temp = MillisecGetTemperatures(HeaterId2PT100Id[i])/HeaterCmd[i].targettemperatue;
+ if (temp<MaxDifference)
+ MaxDifference = temp;
+ }
+ }
+ Report("HeatersPrepareProgress" ,__FILE__,__LINE__,(int)(MaxDifference*100),RpWarning,0,0);
+
+ return MaxDifference;
+
+}
uint32_t HeatersEnd(void)
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h
index 0a8060496..ceb504099 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h
@@ -60,6 +60,9 @@ void IDS_Dispenser_Content_Init (void);
uint32_t IDSPrepareState(void *JobDetails);
void IDSPrepareStart(void);
+//this function returns preparation ratio for the most cool heater (current temperature/ target temerature)
+double IdsPrepareProgress(void);
+
uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId);
uint32_t IDSCheckSegmentData(void *SegmentDetails, int SegmentId);
uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId);
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c
index 1528a9a3b..9c422444f 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c
@@ -195,6 +195,7 @@ uint32_t IDS_Honing_Timeout_Callback(uint32_t DispenserId, uint32_t ReadValue)
ReportWithPackageFilter(IDSFilter,"IDS_Honing_Timeout_Callback",__FILE__,DispenserId,(int)(GetDispenserPressure(DispenserId)*100),RpWarning,2000,0);
SafeRemoveControlCallback(DispenserHomingTimeoutControlId[DispenserId], IDS_Honing_Timeout_Callback );
AlarmHandlingSetAlarm (DispenserId+EVENT_TYPE__DISPENSER_1_REFILL_FAILURE,true);
+ return OK;
}
uint32_t IDS_HomeDispenserCallback(uint32_t motorId, uint32_t ReadValue)
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c
index 2d371595c..aaa371aac 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c
@@ -459,11 +459,31 @@ c. Go to step 2.a x Segment.BrushStopsCount.
uint32_t DispenserPrepareControlId = 0xFF;
int NumOfActiveDispensers = 0;
int DispenserBuildTimeCounter = 0;
- double TargetNumberOfStepsPreRun,MaximalPressurePreRun;
+ double TargetNumberOfStepsPreRun = 120000,MaximalPressurePreRun = 4;
int DispenserTotalPrepareSteps[MAX_SYSTEM_DISPENSERS];
bool DispenserLastMovementDown[MAX_SYSTEM_DISPENSERS];
#define PRESSURE_READ_TIME_GAP 100
+ //this function returns preparation ratio for the most cool heater (current temperature/ target temerature)
+ double IdsPrepareProgress(void)
+ {
+ HardwarePidControlType i;
+ double MaxDifference = 1.00,temp = 0;
+ if (TargetNumberOfStepsPreRun == 0)
+ return 1.00;
+ for (i = 0; i < MAX_DYE_DISPENSERS; i++)
+ {
+ if (DispenserUsedInJob[i] == false) //we actually should check for all dispensers
+ continue;
+ if (DispenserTotalPrepareSteps[i]>TargetNumberOfStepsPreRun)
+ continue;
+ temp = DispenserTotalPrepareSteps[i]/TargetNumberOfStepsPreRun;
+ if (temp<MaxDifference)
+ MaxDifference = temp;
+ }
+ Report("IdsPrepareProgress" ,__FILE__,__LINE__,(int)(MaxDifference*100),RpWarning,0,0);
+ return MaxDifference;
+ }
uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue)
{
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
index c5ac305e2..aef2af830 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
@@ -115,6 +115,8 @@ ModuleStateEnum PrepareWaiting[MAX_SYSTEM_MODULES] = {ModuleIdle,ModuleIdle,Modu
double job_length = 0.0;
char infomsg[190];
+bool prepare_state = false;
+
/********************************************************************************************
* functions describes motor operation flow and movement state during profile execution
* used to operate in runtime correct profileflow execution
@@ -212,6 +214,8 @@ static ReturnCode PrepareState(void *JobDetails)
usnprintf(ErrorMsg, 80,"Configured Thrd %d Wind %d IDS %d Heat %d WHS %d",Configured[Module_Thread],Configured[Module_Winder],Configured[Module_IDS],Configured[Module_Heaters],Configured[Module_Waste]);
Report(ErrorMsg, __FILE__, __LINE__, 0, RpWarning, 0, 0);
+ prepare_state = true;
+
if (Configured[Module_IDS])
{
PrepareWaiting[Module_IDS] = ModuleWaiting;
@@ -305,6 +309,7 @@ uint32_t PrepareReady(int ModuleId, ModuleStateEnum result)
Report(infomsg, __FILE__, __LINE__, ready, RpError, status, 0);
SendJobProgress(0.0,0,false, infomsg);
+ prepare_state = false;
SendJobProgress(0.0, 0, false, "Prepare Ready");
if (status == OK) Message.messageId = PreparationResultsOk;
else Message.messageId = PreparationResultsFail;
@@ -1167,6 +1172,12 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes
Report(infomsg,__FILE__,__LINE__,55,RpWarning,33, 44);
}*/
//UInt Key = Task_disable();
+
+ if (prepare_state == true)
+ {
+ double prepare_progress = 0.9*HeatersPrepareProgress()+0.1*IdsPrepareProgress();
+ Report("prepare_progress" ,__FILE__,__LINE__,(int)(prepare_progress*100),RpWarning,0,0);
+ }
double totlength = 0;
if (JobToken[0] != 0)
@@ -1278,6 +1289,7 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes
CurrentRequest = NULL;
}
JobStopReporting();
+ prepare_state = false;
HandleJobEnd(JobEndReason);
}
// if (responseContainer.data.data)