aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-04-30 14:49:51 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-04-30 14:49:51 +0300
commit8b1f81f413f51facb57a320fef47f2a0e297dc40 (patch)
tree7b1c111437418cf42415ba9fe4eb675fb362a838 /Software/Embedded_SW
parentac8e5600d3ad7a8ff9f76fc35dcaf4d155ebce66 (diff)
downloadTango-8b1f81f413f51facb57a320fef47f2a0e297dc40.tar.gz
Tango-8b1f81f413f51facb57a320fef47f2a0e297dc40.zip
Version 1.3.9.32 reduced diagnostics. new ITMA screens. heating improved. lubricant handled better
Diffstat (limited to 'Software/Embedded_SW')
-rw-r--r--Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c2
-rw-r--r--Software/Embedded_SW/Embedded/Common/Utilities/Utils.c2
-rw-r--r--Software/Embedded_SW/Embedded/Embedded.cfg10
-rw-r--r--Software/Embedded_SW/Embedded/Main.c14
-rw-r--r--Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c18
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c28
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c48
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS.h3
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c11
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c20
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c12
11 files changed, 116 insertions, 52 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 c8ec2a487..092772989 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,3,9,3};
+TangoVersion_t _gTangoVersion = {1,3,9,32};
#define BUILD_DATE __DATE__
char Dat[50] = BUILD_DATE;
char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d
diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c b/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c
index 542ea659a..078aa5f53 100644
--- a/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c
+++ b/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c
@@ -11,6 +11,7 @@
#include "Common/Utilities/Utils.h"
//#include <driverlib/systick.h>
#include "driverlib/hibernate.h"
+#include <driverlib/Watchdog.h>
//*****************************************************************************
@@ -98,6 +99,7 @@ void InitWatchdog(uint32_t clock)
//
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0);
ROM_WatchdogIntClear(WATCHDOG0_BASE);
+ ROM_WatchdogIntTypeSet(WATCHDOG0_BASE,0); //interrupt, not NMI
ROM_IntEnable(INT_WATCHDOG);
//
diff --git a/Software/Embedded_SW/Embedded/Embedded.cfg b/Software/Embedded_SW/Embedded/Embedded.cfg
index 1127c5a30..001fab666 100644
--- a/Software/Embedded_SW/Embedded/Embedded.cfg
+++ b/Software/Embedded_SW/Embedded/Embedded.cfg
@@ -136,12 +136,12 @@ Program.global.control = Task.create("&controlTask", ControlTaskParams);
var AlarmHandlingTaskParams = new Task.Params();
AlarmHandlingTaskParams.instance.name = "AlarmHandling";
AlarmHandlingTaskParams.stackSize = 2048;
-AlarmHandlingTaskParams.priority = 10;
+AlarmHandlingTaskParams.priority = 9;
Program.global.AlarmHandling = Task.create("&AlarmHandlingTask", AlarmHandlingTaskParams);
var CommTxTaskParams = new Task.Params();
CommTxTaskParams.instance.name = "communicationTx";
-CommTxTaskParams.priority = 9;
+CommTxTaskParams.priority = 10;
CommTxTaskParams.stackSize = 4096;
Program.global.communicationTx = Task.create("&communicationTxTask", CommTxTaskParams);
@@ -176,7 +176,7 @@ Program.global.controlLow = Task.create("&controlLowTask", ControlLowTaskParams)
var DiagnosticsTaskParams = new Task.Params();
DiagnosticsTaskParams.instance.name = "Diagnostics";
-DiagnosticsTaskParams.priority = 4;
+DiagnosticsTaskParams.priority = 6;
DiagnosticsTaskParams.stackSize = 8192;
Program.global.Diagnostics = Task.create("&DiagnosticsTask", DiagnosticsTaskParams);
@@ -219,7 +219,9 @@ Text.isLoaded = true;
* reference unspecified external functions
*/
Error.raiseHook = "&errHook";
-
+
+BIOS.customCCOpts += " -Dxdc_FILE=__FILE__ ";
+
/* set user-defined code for E_generic errors */
Error.E_generic.code = 28;
diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c
index 379c45f76..ad88a9ed2 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 <Drivers/I2C_Communication/Dispenser_Card/IO_Ports/Dispenser_IO.h>
-//#define WATCHDOG
+#define WATCHDOG
//*****************************************************************************
@@ -114,7 +114,7 @@ Void errHook(Error_Block *eb)
FRESULT Fresult = FR_OK;
FIL *FileHandle = 0; //the system supports a single active file
uint32_t Bytes = 0;
- char ErrorPath[50] = "0://ErrorFile.txt";
+ char ErrorPath[50] = "0://ErrFile.txt";
char File[50] = "";
char message[300];
int len;
@@ -138,14 +138,14 @@ Void errHook(Error_Block *eb)
Fresult = f_open(FileHandle,ErrorPath,FA_OPEN_ALWAYS | FA_WRITE | FA_READ);
if (Fresult == FR_OK)
{
+ f_lseek(FileHandle, FileHandle->fsize);
strcpy(File,site->file);
- len = usnprintf(message, 80, "\r\n%s %s %s",__DATE__, __TIME__,File);
+ len = usnprintf(message, 80, "\r\n%s %s",__DATE__, __TIME__);
Fresult = f_write(FileHandle,message,len,&Bytes );
/* print user supplied error code */
- len = usnprintf(message, 300, "\r\nerror %d, eid %d file %s line %d mod %d",
- eCode, eid, site->file,
- site->line,
- site->mod);
+ len = usnprintf(message, 300, "\r\nerror %d, eid %d mod %d file %s line %d",
+ eCode, eid,site->mod,
+ site->file,site->line);
Fresult = f_write(FileHandle,message,len,&Bytes );
LOG_ERROR (eCode, "error # ");
diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c
index 2a7aef30a..3361bfdaa 100644
--- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c
+++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c
@@ -175,6 +175,14 @@ const AlarmHandlingItemStruc HardCodedAlarmItem[MAX_SYSTEM_ALARMS]={
{eOneSecond,ALARM_SOURCE_TYPE__DoNotPollAlarm,0,0,0,0,DEBUG_LOG_CATEGORY__Critical,0xFF,0,EVENT_TYPE__DISPENSER_7_OVERPRESSURE,"Dispenser 7 Over Pressure"},
{eOneSecond,ALARM_SOURCE_TYPE__DoNotPollAlarm,0,0,0,0,DEBUG_LOG_CATEGORY__Critical,0xFF,0,EVENT_TYPE__DISPENSER_8_OVERPRESSURE,"Dispenser 8 Over Pressure"},
+ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,0,0,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning,0xFF,2,EVENT_TYPE__MID_TANK_1_EMPTY,"MidTank 1 Empty alarm"},
+ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,1,1,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning,0xFF,2,EVENT_TYPE__MID_TANK_2_EMPTY,"MidTank 2 Empty alarm"},
+ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,2,2,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning,0xFF,2,EVENT_TYPE__MID_TANK_3_EMPTY,"MidTank 3 Empty alarm"},
+ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,3,3,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning,0xFF,2,EVENT_TYPE__MID_TANK_4_EMPTY,"MidTank 4 Empty alarm"},
+ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,4,4,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning,0xFF,2,EVENT_TYPE__MID_TANK_5_EMPTY,"MidTank 5 Empty alarm"},
+ {eOneSecond,ALARM_SOURCE_TYPE__FluidLevelAlarm,7,7,50/*500cc*/,false,DEBUG_LOG_CATEGORY__Warning,0xFF,2,EVENT_TYPE__MID_TANK_8_EMPTY,"MidTank 8 Empty alarm"},
+
+
{eOneSecond,ALARM_SOURCE_TYPE__MotorAlarm,HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,x_STATUS_OCD,false,DEBUG_LOG_CATEGORY__Error,0xFF,2,EVENT_TYPE__DRYER_MOTOR_OVERCURRENT,"Motor Drier Over Current"},
{eOneSecond,ALARM_SOURCE_TYPE__MotorAlarm,HARDWARE_MOTOR_TYPE__MOTO_RDRIVING, HARDWARE_MOTOR_TYPE__MOTO_RDRIVING, x_STATUS_OCD,false,DEBUG_LOG_CATEGORY__Error,0xFF,2,EVENT_TYPE__FEEDER_MOTOR_OVERCURRENT,"Motor Feeder Over Current"},
{eOneSecond,ALARM_SOURCE_TYPE__MotorAlarm,HARDWARE_MOTOR_TYPE__MOTO_SCREW, HARDWARE_MOTOR_TYPE__MOTO_SCREW, x_STATUS_OCD,false,DEBUG_LOG_CATEGORY__Error,0xFF,2,EVENT_TYPE__SCREW_MOTOR_OVERCURRENT,"Motor Screw Over Current"},
@@ -566,6 +574,7 @@ JobEndReasonEnum AlarmHandlingPrepareJob(void *CurrentJob)
}
for (Alarm_i = 0;Alarm_i<MAX_SYSTEM_ALARMS;Alarm_i++)
{
+
if (AlarmItem[Alarm_i].AlarmSource == ALARM_SOURCE_TYPE__CoversAlarm)
{
if (AlarmState[Alarm_i].Status == true)
@@ -575,6 +584,15 @@ JobEndReasonEnum AlarmHandlingPrepareJob(void *CurrentJob)
break;
}
}
+ if (AlarmItem[Alarm_i].AlarmSource == ALARM_SOURCE_TYPE__FluidLevelAlarm)
+ {
+ if (AlarmState[Alarm_i].Status == true)
+ {
+ status = ERROR;
+ AlarmId = Alarm_i;
+ break;
+ }
+ }
if (AlarmItem[Alarm_i].AlarmSource == ALARM_SOURCE_TYPE__MotorAlarm)
{
if (AlarmState[Alarm_i].Status == true)
diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c
index f2b629c51..040803b7a 100644
--- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c
+++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c
@@ -61,6 +61,7 @@ uint32_t Diagnostics_ControlTrigger(uint32_t IfIndex, uint32_t ReadValue);
uint32_t Diagnostics_TenMiliControlTrigger(uint32_t IfIndex, uint32_t ReadValue);
uint32_t DispensersCollection(uint32_t IfIndex, uint32_t ReadValue);
+#define REDUCED_DIAGNOSTICS
DiagnosticsMonitors DiagnosticsMonitor = DIAGNOSTICS_MONITORS__INIT;
#define DIAGNOSTICS_LIMIT 3
@@ -322,6 +323,7 @@ void DiagnosticTenMsecCollection(void)
{
if (DiagnosticsActive == false)
return;
+#ifdef TEN_MSEC_COLLECTION
/*if (JobIsActive()== false)
return;*/
DiagnosticLoadDancer(WINDER_DANCER,Control_Read_Dancer_Position(WINDER_DANCER, 0,0));
@@ -333,7 +335,7 @@ void DiagnosticTenMsecCollection(void)
DiagnosticLoadDancerError(FEEDER_DANCER,ThreadGetMotorCalculatedError(FEEDER_DANCER));
//DiagnosticLoadSpeedSensor(getSensorSpeedData());
-
+#endif
}
void Diagnostic100msecCollection(void)
{
@@ -342,7 +344,10 @@ void Diagnostic100msecCollection(void)
return;
DiagnosticLoadSpeedSensor(getSensorSpeedData());
-
+#ifndef REDUCED_DIAGNOSTICS
+#ifndef TEN_MSEC_COLLECTION
+ DiagnosticTenMsecCollection(); //call the 10msec function every 100 msec to reduce transport
+#endif
//if (JobIsActive())
{
DiagnosticLoadMotor(FEEDER_MOTOR, ThreadGetMotorSpeed (FEEDER_MOTOR));
@@ -351,6 +356,7 @@ void Diagnostic100msecCollection(void)
DiagnosticLoadMotor(WINDER_MOTOR, ThreadGetMotorSpeed (WINDER_MOTOR));
DiagnosticLoadMotor(SCREW_MOTOR, ThreadGetMotorSpeed (SCREW_MOTOR));
}
+#endif
DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__MixerHeater, MillisecGetTemperatures( MIXER_PT100));
DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ1, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP1));
DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ2, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP2));
@@ -368,11 +374,13 @@ void Diagnostic100msecCollection(void)
dispenserspressure[i][DiagnosticsIndex] = GetDispenserPressure(i); //Read_MidTank_Pressure_Sensor
MidTankpressure[i][0] = Get_MidTank_Pressure_Sensor(i);
}
+#ifndef REDUCED_DIAGNOSTICS
for (i=0;i<NUM_OF_CURRENT_HEATERS;i++)
{
HeatersCurrent[i][0] = Get_Heaters_Current(i);
}
-/* dispenser1motorfrequency[DiagnosticsIndex] = MotorGetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1);
+#endif
+ /* dispenser1motorfrequency[DiagnosticsIndex] = MotorGetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1);
dispenser2motorfrequency[DiagnosticsIndex] = MotorGetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_2);
dispenser3motorfrequency[DiagnosticsIndex] = MotorGetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_3);
dispenser4motorfrequency[DiagnosticsIndex] = MotorGetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_4);
@@ -449,6 +457,7 @@ void SendDiagnostics(void)
DiagnosticsMonitor.dancer2angle = dancer2angle;
DiagnosticsMonitor.dancer3angle = dancer3angle;
*/
+#ifndef REDUCED_DIAGNOSTICS
//if (JobIsActive())
{
DiagnosticsMonitor.n_dancer1angle = DancerCounterIndex[0];
@@ -478,7 +487,7 @@ void SendDiagnostics(void)
DiagnosticsMonitor.n_windermotor = MotorCounterIndex[WINDER_MOTOR];
DiagnosticsMonitor.n_screwmotor = MotorCounterIndex[SCREW_MOTOR];
}
-
+#endif
DiagnosticsMonitor.mixertemperature = HeaterTemperature[HARDWARE_PID_CONTROL_TYPE__MixerHeater];
DiagnosticsMonitor.headzone1temperature = HeaterTemperature[HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ1];
DiagnosticsMonitor.headzone2temperature = HeaterTemperature[HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ2];
@@ -660,11 +669,11 @@ void SendDiagnostics(void)
}
void DispensersCollectionCall(void)
{
- int i;
+ /*int i;
for (i = 0; i<MAX_SYSTEM_DISPENSERS;i++)
{
IDS_Dispenser_Content_Calculation(i);
- }
+ }*/
}
uint32_t DiagnosticsControlId = 0xff;
uint32_t Diagnostics10MSControlId = 0xff;
@@ -682,11 +691,12 @@ uint32_t DiagnosticsStart(void)
DiagnosticsControlId = AddControlCallback(Diagnostics_ControlTrigger,DiagnosticLimit,TemplateDataReadCBFunction,0,0,0);
else
LOG_ERROR(DiagnosticsControlId,"Diagnostics restarted");
+#ifdef TEN_MSEC_COLLECTION
if (Diagnostics10MSControlId == 0xFF)
Diagnostics10MSControlId = AddControlCallback(Diagnostics_TenMiliControlTrigger,DiagnosticFastLimit,TemplateDataReadCBFunction,0,0,0);
else
LOG_ERROR(DiagnosticsControlId,"Diagnostics restarted");
-
+#endif
if (DispensersControlId == 0xFF)
DispensersControlId = AddControlCallback(DispensersCollection,eOneSecond,TemplateDataReadCBFunction,0,0,0);
else
@@ -759,8 +769,8 @@ uint32_t DispensersCollection(uint32_t IfIndex, uint32_t ReadValue)
//send message to the Millisec task
Message.messageId = DispensersCollectionTrigger;
Message.msglen = sizeof(DiagnosticsMessageStruc);
- if (DiagnosticsMsgQ != NULL)
- Mailbox_post(DiagnosticsMsgQ , &Message, BIOS_NO_WAIT);
+ //if (DiagnosticsMsgQ != NULL)
+ // Mailbox_post(DiagnosticsMsgQ , &Message, BIOS_NO_WAIT);
return OK;
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
index 7a013f49f..be4328f4c 100644
--- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
@@ -249,13 +249,13 @@ uint32_t HeatersSingleHeaterEnd(HardwarePidControlType HeaterId)
{
status |= RemoveControlCallback(ControlIdtoHeaterId [HeaterId], DCHeaterControlCBFunction);
ControlIdtoHeaterId [HeaterId]=0xFF;
- HeaterRecalculateHeaterParams(HeaterId, 0);
}
if (ControlIdtoMaxHeaterId [HeaterId]!=0xFF)
{
status |= RemoveControlCallback(ControlIdtoMaxHeaterId [HeaterId], DcHeaterMaxTempCBFunction);
ControlIdtoMaxHeaterId [HeaterId]=0xFF;
}
+ HeaterRecalculateHeaterParams(HeaterId, 0);
DeActivateHeater(HeaterId);
HeaterReady[HeaterId] = true;
}
@@ -323,7 +323,7 @@ void HeatersStartControlTimer (void)
Report("HeatersStartControlTimer ", __FILE__,__LINE__,0, RpMessage, 0, 0);
return;
}
-/***************************************************************************************************/
+/***************************************************************************************************
int GetFilteredHeaterRead(int HeaterId)
{
#define MAX_FILTER 12
@@ -347,7 +347,7 @@ int GetFilteredHeaterRead(int HeaterId)
Report("GetFilteredHeaterRead ", __FILE__,HeaterId,sum, minread, maxread, 0);
return (sum/(MAX_FILTER-2));
}
-/**************************************************************************************
+**************************************************************************************
* HeaterCommandRequestMessage
* called by: Communication from host
* initialized all global data
@@ -462,9 +462,9 @@ void PrepareACHeater(int HeaterId,uint32_t Frequency, uint32_t SetTemperatue)
HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain, 0);
HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary, 0);
if (MainDryerHeaterMaxTempControl == 0xFF)
- MainDryerHeaterMaxTempControl = AddControlCallback( HeaterMaxTempCBFunction, eHundredMillisecond,MillisecGetTemperatures,(IfTypeHeaters*0x100+HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain),HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain],0);
+ MainDryerHeaterMaxTempControl = AddControlCallback( HeaterMaxTempCBFunction, eOneSecond,MillisecGetTemperatures,(IfTypeHeaters*0x100+HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain),HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain],0);
if (SecondDryerHeaterMaxTempControl == 0xFF)
- SecondDryerHeaterMaxTempControl = AddControlCallback( HeaterMaxTempCBFunction, eHundredMillisecond,MillisecGetTemperatures,(IfTypeHeaters*0x100+HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary),HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary],0);
+ SecondDryerHeaterMaxTempControl = AddControlCallback( HeaterMaxTempCBFunction, eOneSecond,MillisecGetTemperatures,(IfTypeHeaters*0x100+HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary),HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary],0);
//InitialHeating = true;
HeaterReady[HeaterId] = false;
if (BlowerCfg.enabled == true)
@@ -492,7 +492,7 @@ int PrepareDCHeater(int HeaterId, uint32_t Frequency, uint32_t SetTemperatue)
DisasterControlId = AddControlCallback( HeatersDisasterControl, eOneSecond,TemplateDataReadCBFunction,0,0, 0);
if (ControlIdtoHeaterId [HeaterId] == 0xFF)
- ControlIdtoHeaterId [HeaterId] = AddControlCallback( DCHeaterControlCBFunction, Frequency/*eOneSecond*/,MillisecGetTemperatures,(IfTypeHeaters*0x100+HeaterId),HeaterId2PT100Id[HeaterId],0);
+ ControlIdtoHeaterId [HeaterId] = AddControlCallback( DCHeaterControlCBFunction, Frequency/*eOneSecond*/,MillisecGetTemperatures,(IfTypeHeaters*0x100+HeaterId),HeaterId2PT100Id[HeaterId],0);
//HeaterPIDConfig[HeaterId].m_params.dt *=10;
//DCInitialHeating[HeaterId] = true;
HeaterReady[HeaterId] = false;
@@ -665,7 +665,7 @@ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue)
MaxreadValue = max (MainPT100Read,SecondaryPT100Read);
MinreadValue = min (MainPT100Read,SecondaryPT100Read);
- if ((MaxreadValue) >= HeaterControl[index].sensormaxvalue)
+ if ((MinreadValue) >= HeaterControl[index].sensormaxvalue)
{
if (HeaterMaxTempFlag[index] == false)
{
@@ -808,7 +808,7 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
//Heaters OFF until coming into the proportional band
HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain,0);
HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary,0);
- //LOG_ERROR (0, "unconfigured");
+ LOG_ERROR (0, "unconfigured");
return ERROR;
}
if (abs(readValue - HeaterPreviousRead[index])>2000)
@@ -847,19 +847,22 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
return OK;
}
// if (readValue < ((HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100))
- if (readValue < (/*HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000*/HeaterCmd[index].targettemperatue-1000))
+ if (readValue < (/*HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000*/HeaterCmd[index].targettemperatue-800))
{
if ((HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary] == false)&&(HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain] == false))
{
ActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary);
ActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain);
+ HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain,100);
+ HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary,100);
}
return OK;
}
- if ((readValue > (HeaterCmd[index].targettemperatue-1000)/*(HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000)*/)&&(readValue < (HeaterCmd[index].targettemperatue * AcHeatersUpperoperationLimit/1000)))//read value within 0.5 percent from target
+/* if ((readValue > (HeaterCmd[index].targettemperatue-300)/`*(HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000)*`/)&&(readValue < (HeaterCmd[index].targettemperatue * AcHeatersUpperoperationLimit/1000)))//read value within 0.5 percent from target
{
//////////////////
+ Report("AC Turn Off secondary",__FILE__,__LINE__,readValue,RpWarning,(HeaterCmd[index].targettemperatue), 0);
//InitialHeating = false;
DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary);
HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary, 0);
@@ -875,11 +878,25 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
Control_Voltage_To_Blower(BlowerCfg.voltage);
}
}
- if ((readValue > HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000)&&(readValue < (HeaterCmd[index].targettemperatue * AcHeatersUpperoperationLimit/1000)))//read value within 0.5 percent from target
+ */
+ if ((readValue > (HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000))&&(readValue < (HeaterCmd[index].targettemperatue * AcHeatersUpperoperationLimit/1000)))//read value within 0.5 percent from target
{
//////////////////
//InitialHeating = false;
- Report("AC PID Activating",__FILE__,__LINE__,readValue,RpWarning,(HeaterCmd[index].targettemperatue-1000), 0);
+ Report("AC PID Activating",__FILE__,__LINE__,readValue,RpWarning,(HeaterCmd[index].targettemperatue), 0);
+////////////////////////
+ DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary);
+ HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary, 0);
+ HeatersControlStart();
+ AlarmHandlingSetAlarm(HeaterUnderEventType[index], false);
+ if (BlowerCfg.enabled == true)
+ {
+ Turn_the_Blower_On();//Turn on with the Default_Voltage
+ if (BlowerCfg.voltage)
+ //Gradual_Increase_Blower(BlowerCfg.heatingvoltage,BlowerCfg.voltage);
+ Control_Voltage_To_Blower(BlowerCfg.voltage);
+ }
+
////////////////////////
HeaterReady[index] = true;
Disable_Reading_Heaters_Current(HeaterId2CurrentId[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain]);
@@ -974,13 +991,14 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
if (HeaterCmd[index].targettemperatue == 0)
{
DeActivateHeater(index);
- //LOG_ERROR (index, "unconfigured");
+ HeaterRecalculateHeaterParams(index, 0);
+ LOG_ERROR (index, "unconfigured");
return ERROR;
}
if (abs(readValue - HeaterPreviousRead[index])>2000)
{
Report("DC Temperature Spike",__FILE__,index,HeaterPreviousRead[index],RpWarning,readValue, index);
- if (readValue > HeaterCmd[index].targettemperatue)
+ //if (readValue > HeaterCmd[index].targettemperatue)
{
DeActivateHeater(index);
HeaterRecalculateHeaterParams(index, 0);
@@ -991,6 +1009,7 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
{
Report("DC Temperature disaster",__FILE__,index,HeaterPreviousRead[index],RpWarning,readValue, index);
DeActivateHeater (index);
+ HeaterRecalculateHeaterParams(index, 0);
return ERROR;
}
@@ -1017,6 +1036,7 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
if ((readValue > (HeaterCmd[index].targettemperatue * DcHeatersLoweroperationLimit/1000))&&(readValue < (HeaterCmd[index].targettemperatue * DcHeatersUpperoperationLimit/1000)))//read value within 0.5 percent from target
{
+ Report("DC PID Activating",__FILE__,index,readValue,RpWarning,(HeaterCmd[index].targettemperatue), 0);
//DCInitialHeating[index] = false;
HeatersControlStart();
HeaterReady[index] = true;
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h
index 3d2bcf9ff..b47305d8c 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h
@@ -5,6 +5,9 @@
#include "drivers/motors/motor.h"
#include "ids_ex.h"
+#define LUBRICANT_DISPENSER 7
+#define CLEANER_DISPENSER 6
+
extern int32_t CurrentDispenserSpeed[MAX_SYSTEM_DISPENSERS];
extern uint32_t DispenserIdToMotorId[MAX_SYSTEM_DISPENSERS];
extern float DispenserPressure[MAX_SYSTEM_DISPENSERS];
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c
index 13142ad5f..ed9a3adb7 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c
@@ -66,8 +66,15 @@ uint32_t IDS_Dispenser_Build_Pressure_Callback(uint32_t DispenserId, uint32_t Re
{
uint32_t status;
DispenserPrepareTime[DispenserId]+=DispenserPrepareTimeLag;
+ double DispenserPressure = DispenserPreparePressure;
- if ((GetDispenserPressure(DispenserId)>=DispenserPreparePressure)||(DispenserPrepareTime[DispenserId]>=DispenserPrepareTimeout))
+ if (DispenserId == LUBRICANT_DISPENSER)
+ {
+ DispenserPressure = DispenserPreparePressure/5;
+ //lubricant lower pressure buildup
+ }
+
+ if ((GetDispenserPressure(DispenserId)>=DispenserPressure)||(DispenserPrepareTime[DispenserId]>=DispenserPrepareTimeout))
{
if (DispenserPrepareTime[DispenserId]>=DispenserPrepareTimeout)
status = ERROR;
@@ -249,6 +256,7 @@ void IDS_Dispenser_Content_Init (void)
uint16_t seconds_counter = 0;
uint32_t IDS_Dispenser_Store_Data (void)
{
+ uint32_t timing = msec_millisecondCounter;
FRESULT Status = FR_OK;
IDSDispenserData.n_dispenserinfo = MAX_SYSTEM_DISPENSERS;
IDSDispenserData.dispenserinfo = dispenserdata;
@@ -263,6 +271,7 @@ uint32_t IDS_Dispenser_Store_Data (void)
else
return ERROR;
+ REPORT_MSG(msec_millisecondCounter - timing, "Updating dispensers file - time");
return Status;
}
void IDS_Dispenser_Content_Calculation (char DispenserId)
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c
index 4bcdcc06a..30ad7d857 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c
@@ -40,8 +40,6 @@ typedef struct
PID_Config_Params m_params;
}DispenserControlConfig_t;
HardwarePidControl *DispensersControl;// = (HardwarePidControl *)GENHWCFG_MAP_IN_FLASH + 0x4000;
-#define LUBRICANT_DISPENSER 7
-#define CLEANER_DISPENSER 6
#define MAX_DYE_DISPENSERS 6
int32_t DispenserSamples[MAX_SYSTEM_DISPENSERS][MAX_CONTROL_SAMPLES] = {0};
int DispenserSamplePointer[MAX_SYSTEM_DISPENSERS] = {0};
@@ -321,6 +319,7 @@ 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_i<MAX_SYSTEM_DISPENSERS;Dispenser_i++)
{
DispenserUsedInJob[Dispenser_i] = false;
@@ -375,11 +374,12 @@ c. Go to step 2.a x Segment.BrushStopsCount.
readBytes += ImmediateRead;
BrushStop = job_description_file_brush_stop__unpack(NULL, BrushStopSize, BrushStopPtr);
//REPORT_MSG (BrushStopSize, "BrushStop");
- if ((brushCounter++ % 100)==0)
+ 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++)
@@ -478,6 +478,7 @@ c. Go to step 2.a x Segment.BrushStopsCount.
if (BrushStop != NULL)
job_description_file_brush_stop__free_unpacked (BrushStop,NULL);
Fresult = f_close(FileHandle);
+ GeneralHwReady = true;
REPORT_MSG (n_segments, "Finished checking the file");
return status;
@@ -1147,23 +1148,22 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId)
}
}
-
+ IDS_StopLubrication();
return OK;
}
uint32_t IDS_StartLubrication(void)
{
IDS_Dispenser_Start_Motor_and_Open_Valve(LUBRICANT_DISPENSER,lubricant_speed,NULL);
+ CurrentDispenserSpeed[LUBRICANT_DISPENSER] = lubricant_speed;
REPORT_MSG (lubricant_speed, "IDS_StartLubrication");
Lubricant_2Way_Valve (START);
return OK;
}
uint32_t IDS_StopLubrication(void)
{
- if(DispenserUsedInJob[LUBRICANT_DISPENSER])
- {
- IDS_Dispenser_Close_Valve_And_Stop_Motor(LUBRICANT_DISPENSER,IDS_Valve_EndValveReady);
- REPORT_MSG (lubricant_speed, "IDS_StopLubrication");
- Lubricant_2Way_Valve (STOP);
- }
+ IDS_Dispenser_Close_Valve_And_Stop_Motor(LUBRICANT_DISPENSER,IDS_Valve_EndValveReady);
+ CurrentDispenserSpeed[LUBRICANT_DISPENSER] = 0;
+ REPORT_MSG (lubricant_speed, "IDS_StopLubrication");
+ Lubricant_2Way_Valve (STOP);
return OK;
}
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
index b5034a11c..96b2b372e 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
@@ -713,6 +713,9 @@ void JobRequestFunc(MessageContainer* requestContainer)
char logmsg[254];
char infomsg[254];
uint8_t JobStatusBuffer[400];
+ResumeCurrentJobResponse resumeresponse = RESUME_CURRENT_JOB_RESPONSE__INIT;
+JobResponse JobResponseMsg = JOB_RESPONSE__INIT;
+JobStatus jobStatus = JOB_STATUS__INIT;
void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Message)
{
@@ -734,9 +737,6 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes
if (JobToken[0] != 0)
{
- ResumeCurrentJobResponse resumeresponse = RESUME_CURRENT_JOB_RESPONSE__INIT;
- JobResponse response = JOB_RESPONSE__INIT;
- JobStatus jobStatus = JOB_STATUS__INIT;
if (Message)
{
@@ -756,9 +756,9 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes
}
else
{
- response.status = &jobStatus;
- //responseContainer = createContainer(MESSAGE_TYPE__JobResponse, JobToken, done, &response, &job_response__pack, &job_response__get_packed_size);
- responseContainer = createAllocatedContainer(MESSAGE_TYPE__JobResponse, JobToken, done, &response, &job_response__pack, &job_response__get_packed_size,&JobStatusBuffer);
+ JobResponseMsg.status = &jobStatus;
+ //responseContainer = createContainer(MESSAGE_TYPE__JobResponse, JobToken, done, &JobResponseMsg, &job_response__pack, &job_response__get_packed_size);
+ responseContainer = createAllocatedContainer(MESSAGE_TYPE__JobResponse, JobToken, done, &JobResponseMsg, &job_response__pack, &job_response__get_packed_size,&JobStatusBuffer);
}
container_buffer = my_malloc(message_container__get_packed_size(&responseContainer));