aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-04-17 14:48:09 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-04-17 14:48:09 +0300
commitc4cc44a16a7da32d8bcf23928aa396b035bc1ad2 (patch)
tree05e50121a61537625b76ba479a4e273b8a72786f /Software/Embedded_SW/Embedded/Modules
parent225ffd633d781537de51f1c59ef2f1eb77d1ee67 (diff)
parent07550eee00f4b6de20e01679cf8811e9a6597df2 (diff)
downloadTango-c4cc44a16a7da32d8bcf23928aa396b035bc1ad2.tar.gz
Tango-c4cc44a16a7da32d8bcf23928aa396b035bc1ad2.zip
merge
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/control.c86
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c6
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c21
-rw-r--r--Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/General/buttons.c137
-rw-r--r--Software/Embedded_SW/Embedded/Modules/General/buttons.h6
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c71
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c17
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_HW_Version.c34
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.c24
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.h3
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c8
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Waste/Waste.h17
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h1
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c131
15 files changed, 377 insertions, 187 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c
index 608d17a7b..b316fd73f 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/control.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c
@@ -166,11 +166,51 @@ uint32_t ControlActivityLed( uint32_t Parameter1)
ACTIVITY_RED_LED_OFF; // Heaters indication - all the Heaters OFF
if(power.color == fastBILNK)
Pannel_Leds(POWER_ON_OFF,MODE_OFF);
-
+ else
if((power.color == BLINK) && (counter % Blink_Freq == 0) )
{
Pannel_Leds(POWER_ON_OFF,MODE_OFF);
}
+ ///////////////////////////////////////////////////////////
+ if(jog.color == fastBILNK)
+ Pannel_Leds(THREAD_JOGGING,MODE_OFF);
+ else
+ if((jog.color == BLINK) && (counter % Blink_Freq == 0) )
+ {
+ Pannel_Leds(THREAD_JOGGING,MODE_OFF);
+ }
+ ///////////////////////////////////////////////////////////
+ if(load.color == fastBILNK)
+ Pannel_Leds(THREAD_LOAD,MODE_OFF);
+ else
+ if((load.color == BLINK) && (counter % Blink_Freq == 0) )
+ {
+ Pannel_Leds(THREAD_LOAD,MODE_OFF);
+ }
+ ///////////////////////////////////////////////////////////
+ if(cart1.color == fastBILNK)
+ Pannel_Leds(CART_1,MODE_OFF);
+ else
+ if((cart1.color == BLINK) && (counter % Blink_Freq == 0) )
+ {
+ Pannel_Leds(CART_1,MODE_OFF);
+ }
+ ///////////////////////////////////////////////////////////
+ if(cart2.color == fastBILNK)
+ Pannel_Leds(CART_2,MODE_OFF);
+ else
+ if((cart2.color == BLINK) && (counter % Blink_Freq == 0) )
+ {
+ Pannel_Leds(CART_2,MODE_OFF);
+ }
+ ///////////////////////////////////////////////////////////
+ if(cart3.color == fastBILNK)
+ Pannel_Leds(CART_3,MODE_OFF);
+ else
+ if((cart3.color == BLINK) && (counter % Blink_Freq == 0) )
+ {
+ Pannel_Leds(CART_3,MODE_OFF);
+ }
flag = false;
}
else
@@ -181,11 +221,53 @@ uint32_t ControlActivityLed( uint32_t Parameter1)
if(power.color == fastBILNK)
Pannel_Leds(POWER_ON_OFF,MODE_ON);
-
+ else
if((power.color == BLINK) && (counter % Blink_Freq == 0) )
{
Pannel_Leds(POWER_ON_OFF,MODE_ON);
}
+ ///////////////////////////////////////////////////////////
+ if(jog.color == fastBILNK)
+ Pannel_Leds(THREAD_JOGGING,MODE_ON);
+ else
+ if((jog.color == BLINK) && (counter % Blink_Freq == 0) )
+ {
+ Pannel_Leds(THREAD_JOGGING,MODE_ON);
+ }
+ ///////////////////////////////////////////////////////////
+ if(load.color == fastBILNK)
+ Pannel_Leds(THREAD_LOAD,MODE_ON);
+ else
+ if((load.color == BLINK) && (counter % Blink_Freq == 0) )
+ {
+ Pannel_Leds(THREAD_LOAD,MODE_ON);
+ }
+ ///////////////////////////////////////////////////////////
+ if(cart1.color == fastBILNK)
+ Pannel_Leds(CART_1,MODE_ON);
+ else
+ if((cart1.color == BLINK) && (counter % Blink_Freq == 0) )
+ {
+ Pannel_Leds(CART_1,MODE_ON);
+ }
+ ///////////////////////////////////////////////////////////
+ if(cart2.color == fastBILNK)
+ Pannel_Leds(CART_2,MODE_ON);
+ else
+ if((cart2.color == BLINK) && (counter % Blink_Freq == 0) )
+ {
+ Pannel_Leds(CART_2,MODE_ON);
+ }
+ ///////////////////////////////////////////////////////////
+ if(cart3.color == fastBILNK)
+ Pannel_Leds(CART_3,MODE_ON);
+ else
+ if((cart3.color == BLINK) && (counter % Blink_Freq == 0) )
+ {
+ Pannel_Leds(CART_3,MODE_ON);
+ }
+
+
flag = true;
}
diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c
index c9bbe2df6..97489f431 100644
--- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c
+++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c
@@ -255,6 +255,12 @@ uint32_t SetDigitalOutRequestRequestFunc(MessageContainer* requestContainer)
else
Control_Dryer_Fan(STOP,0);//use START or STOP, 0 - 100%();
break;
+ case INTERFACE_IOS__GPO_WASTECH_PUMP2://valve
+ Valve_Set(VALVE_WASTE_TANK, request->value);
+ break;
+ case INTERFACE_IOS__GPO_WHS_WTANKPUMP2:
+ SetWastePump( request->value);
+ break;
default:
responseContainer.has_error = true;
responseContainer.error = ERROR_CODE__GENERAL_ERROR;
diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c
index d39c97621..5ef216264 100644
--- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c
+++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c
@@ -29,6 +29,7 @@
#include "Modules/AlarmHandling/AlarmHandling.h"
#include "Modules/heaters/heaters_ex.h"
#include "modules/thread/thread_ex.h"
+#include "modules/waste/waste.h"
#include "PMR/Hardware/HardwareDancerType.pb-c.h"
#include <PMR/Diagnostics/StartDiagnosticsRequest.pb-c.h>
@@ -104,7 +105,7 @@ DoubleArray DiagnosticsDispenserPressure[MAX_SYSTEM_DISPENSERS];
HeaterState **heatersstates;
HeaterState HeaterInfo[HEATER_TYPE__MixerHeater+1];
DigitalInterfaceState **digitalinterfacestates;
-DigitalInterfaceState DigitalOutputState[MAX_HEATERS_NUM+2];
+DigitalInterfaceState DigitalOutputState[MAX_HEATERS_NUM+8];
/*double dispenser1motorfrequency[DIAGNOSTICS_LIMIT+1];
double dispenser2motorfrequency[DIAGNOSTICS_LIMIT+1];
double dispenser3motorfrequency[DIAGNOSTICS_LIMIT+1];
@@ -168,8 +169,8 @@ void DiagnosticsInit(void)
heater_state__init(&HeaterInfo[i]);
heatersstates[i] = &HeaterInfo[i];
}
- digitalinterfacestates = (DigitalInterfaceState**)my_malloc(sizeof(DigitalInterfaceState *)*MAX_HEATERS_NUM);
- for (i = 0;i<MAX_HEATERS_NUM;i++ )
+ digitalinterfacestates = (DigitalInterfaceState**)my_malloc(sizeof(DigitalInterfaceState *)*(MAX_HEATERS_NUM+8));
+ for (i = 0;i<(MAX_HEATERS_NUM+8);i++ )
{
digital_interface_state__init(&DigitalOutputState[i]);
DigitalOutputState[i].has_interfaceio = true;
@@ -251,6 +252,18 @@ void DiagnosticsLoadDigitalValues(void)
DigitalOutputState[11].interfaceio = INTERFACE_IOS__GPO_LED4;
DigitalOutputState[11].value = DataUpdated;
+ DigitalOutputState[12].interfaceio = INTERFACE_IOS__GPI_WCONTAINER_FULL;
+ DigitalOutputState[12].value = WHS_IsContainerOverflow();
+
+ DigitalOutputState[13].interfaceio = INTERFACE_IOS__GPI_WCONTAINER_WARN;
+ DigitalOutputState[13].value = WHS_IsContainerFull();
+
+ DigitalOutputState[14].interfaceio = INTERFACE_IOS__GPO_SPARE1_1; /*waste lower cartridge presence*/
+ DigitalOutputState[14].value = WHS_WasteCartridgeLowerPresent();
+
+ DigitalOutputState[15].interfaceio = INTERFACE_IOS__GPO_SPARE1_2; /*waste middle cartridge presence*/
+ DigitalOutputState[15].value = WHS_WasteCartridgeMiddlePresent();
+
}
void DiagnosticLoadTemperature(int HeaterId, int temperature)
{
@@ -586,7 +599,7 @@ void SendDiagnostics(void)
response.n_componentsstates = 0;
DiagnosticsLoadDigitalValues();
- response.n_digitalinterfacestates = MAX_HEATERS_NUM;
+ response.n_digitalinterfacestates = MAX_HEATERS_NUM+6;
response.digitalinterfacestates = digitalinterfacestates;
for (i=HEATER_TYPE__DryerAirHeater;i<=HEATER_TYPE__MixerHeater;i++)
diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
index 1483f2889..6f1dc2052 100644
--- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
+++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
@@ -142,7 +142,7 @@ void LoadConfigurationParameters(ConfigurationParameters *Params)
EmbeddedParameters.has_dispenserbuildpressurelag = true;
EmbeddedParameters.dispenserbuildpressurelag=50;
EmbeddedParameters.has_acheatersloweroperationlimit = true;
- EmbeddedParameters.acheatersloweroperationlimit = 995;
+ EmbeddedParameters.acheatersloweroperationlimit = 980;
EmbeddedParameters.has_acheatersupperoperationlimit = true;
EmbeddedParameters.acheatersupperoperationlimit = 1005;
EmbeddedParameters.has_dcheatersloweroperationlimit = true;
diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.c b/Software/Embedded_SW/Embedded/Modules/General/buttons.c
index 21d425221..74cb81aac 100644
--- a/Software/Embedded_SW/Embedded/Modules/General/buttons.c
+++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.c
@@ -13,7 +13,6 @@
#include "Modules/General/buttons.h"
#include "StateMachines/Printing/PrintingSTM.h"
#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h"
-//#include "StateMachines/Initialization/PowerOffSequence.h"
#include <stdlib.h>
#include <stdint.h>
@@ -24,33 +23,13 @@
#include "Modules/General/buttons.h"
#include "StateMachines/Initialization/PowerOffSequence.h"
+#include "StateMachines/Initialization/PowerIdle.h"
-//int MachineOnOff();
int PowerDown();
int PowerUp();
int thredJog();
-/*
-typedef enum
-{
- OFFPB = 0,
- COUNTPB ,
- SHORTPB ,
- LONGPB ,
- REPLONGPB //repeat long PB
-}PBstat;
-*/
-typedef enum
-{
- MSEC = 0,
- lESS200 ,
- LESS500 ,
- LESS5000 ,
- MORE5000
-}timems;
-
-
//enum PBstat OnOffPBstate = OFFPB;
//enum PBstat ret
@@ -58,7 +37,7 @@ typedef enum
-button power , jog, load;
+button power, jog, load, cart1, cart2, cart3;
uint32_t ButtonPowerCallBackFunction(uint32_t IfIndex, uint32_t ReadValue);
uint32_t ButtonPowerCBFunction(uint32_t IfIndex, uint32_t ReadValue);
uint32_t ShortLongOffPB(uint8_t OnOffPB, button *pBtn);
@@ -68,7 +47,7 @@ uint32_t StateMachine( button *pBtn);
uint32_t ButtonJogCallBackFunction(uint32_t IfIndex, uint32_t ReadValue);
uint32_t ButtonJogCBFunction(uint32_t IfIndex, uint32_t ReadValue);
uint8_t thraedJogging(uint8_t off);
-uint32_t setJoggingEnableCondition( button *pBtn);
+//uint32_t setJoggingEnableCondition( button *pBtn);
uint32_t joggingMachine( button *pBtn); //uint8_t OnOffPB,
@@ -87,8 +66,8 @@ bool Read_PWR_Button();//TODO move to GPIO folder
int PowerDown()
{
- bool ret = OK;
- PowerOffInit();
+ bool ret = !OK;
+ ret = PowerOffInit();
return ret;
}
@@ -100,42 +79,25 @@ int PowerUp()
return ret;
}
-
bool SetPowerMachineState(PBmachineState state)
{
bool ret = OK;
switch ( state )
{
case sttOFF:
- power.state = state;
- break;
case sttON:
+ case sttIDLE:
power.state = state;
- break;
+ break;
case sttDISABLE:
- jog.state = state;
- break;
case sttENABLE:
- jog.state = state;
- break;
- case sttIDLE:
- power.state = state;
- break;
case sttJOGGING:
jog.state = state;
break;
case sttRDY:
- load.state = state;
- break;
case sttPRELOAD:
- load.state = state;
- break;
case sttLOADING:
- load.state = state;
- break;
case sttLOADSUCSESS:
- load.state = state;
- break;
case sttLOADFAIL:
load.state = state;
break;
@@ -190,9 +152,7 @@ uint32_t ButtonLoadCallBackFunction(uint32_t IfIndex, uint32_t ReadValue)
uint32_t Buttons_Init(void)
{
-
-// power.bttn_status = 0 ;
-// power.bttn_name = "power"; //option
+ strcpy(power.bttn_name, "power");
power.bttn_status = release; // 0=release 1=press
power.Action = OFFPB ; //off,short,long,count,replong
power.color = BLUE; //off, blue, blink, bithing
@@ -201,8 +161,7 @@ uint32_t Buttons_Init(void)
AddControlCallback( ButtonPowerCBFunction, BUTTOMS_SAMPLE_TIME, ButtonPowerCallBackFunction, 0,0,0 ); // eFiftyMillisecond
-// jog.bttn_status = 0 ;
-// jog.bttn_name = "jog"; //option
+ strcpy(jog.bttn_name, "jog");
jog.bttn_status = release; // 0=release 1=press
jog.Action = OFFPB ; //OFFPB,short,long,count,replong
jog.color = colorOFF; //colorOFF, BLUE, BLINK,
@@ -210,12 +169,11 @@ uint32_t Buttons_Init(void)
jog.count = 0;
AddControlCallback( ButtonJogCBFunction, BUTTOMS_SAMPLE_TIME, ButtonJogCallBackFunction, 0,0,0 ); //
-// load.bttn_status = 0 ;
-// load.bttn_name = "load"; //option
+ strcpy(load.bttn_name, "load");
load.bttn_status = release; // 0=release 1=press
load.Action = OFFPB ; //OFFPB,short,long,count,replong
load.color = colorOFF; //colorOFF, BLUE, BLINK,
- load.state = sttOFF; // sttDISABLE, sttENABLE, sttJOGGING
+ load.state = sttRDY; //
load.count = 0;
AddControlCallback( ButtonLoadCBFunction, BUTTOMS_SAMPLE_TIME, ButtonLoadCallBackFunction, 0,0,0 ); //
@@ -232,15 +190,12 @@ uint32_t ButtonPowerCBFunction(uint32_t IfIndex, uint32_t ReadValue)
uint32_t ButtonJogCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
-
jog.bttn_status = ReadValue;
//if (ReadValue == press)
{
- setJoggingEnableCondition(&jog);
+ //setJoggingEnableCondition(&jog);
joggingMachine(&jog);
}
-
-
return 0;
}
@@ -452,36 +407,36 @@ return 0;
-uint32_t setJoggingEnableCondition( button *pBtn)
-{
- uint8_t parameter = 3;
-
- if (0
-// to do : what are the conditions for enable / disable
-// 1.
-// 2.
-// 3.
-// ...
- )
- {
- pBtn->state = sttDISABLE;
- REPORT_MSG(parameter," ------------ Jogging : setJoggingEnableCondition sttDISABLE ----------------- ");
- pBtn->color = colorOFF;
- Pannel_Leds(THREAD_JOGGING, MODE_OFF); //AVI+
- // ThreadAbortJoggingFunc();
- }
-
- else
- {
- pBtn->state = sttENABLE;
-// REPORT_MSG(parameter," ------------ Jogging : setJoggingEnableCondition sttENABLE ----------------- ");
- pBtn->color = BLUE;
- Pannel_Leds(THREAD_JOGGING, MODE_ON); //AVI+
- //ThreadJoggingFunc(40);
- }
-
-return 0;
-}
+//uint32_t setJoggingEnableCondition( button *pBtn)
+//{
+// uint8_t parameter = 3;
+//
+// if (0
+//// to do : what are the conditions for enable / disable
+//// 1.
+//// 2.
+//// 3.
+//// ...
+// )
+// {
+// pBtn->state = sttDISABLE;
+// REPORT_MSG(parameter," ------------ Jogging : setJoggingEnableCondition sttDISABLE ----------------- ");
+// pBtn->color = colorOFF;
+// Pannel_Leds(THREAD_JOGGING, MODE_OFF); //AVI+
+// // ThreadAbortJoggingFunc();
+// }
+//
+// else
+// {
+// pBtn->state = sttENABLE;
+//// REPORT_MSG(parameter," ------------ Jogging : setJoggingEnableCondition sttENABLE ----------------- ");
+// pBtn->color = BLUE;
+// Pannel_Leds(THREAD_JOGGING, MODE_ON); //AVI+
+// //ThreadJoggingFunc(40);
+// }
+//
+//return 0;
+//}
@@ -575,13 +530,14 @@ return 0;
uint32_t LoadStatMachine( button *pBtn)
{
- //uint8_t parameter = 5;
+ uint8_t parameter = 5;
//REPORT_MSG(parameter," ------------ start loading ----------------- ");
Report(" ------------ start loading ----------------- ",__FILE__,__LINE__,pBtn->state,RpWarning,pBtn->color,0);
switch (pBtn->state)
{
case sttRDY :
+ REPORT_MSG(parameter," ------------ load.state = sttRDY ----------------- ");
switch (pBtn->Action)
{
case (SHORTPB):
@@ -589,7 +545,6 @@ uint32_t LoadStatMachine( button *pBtn)
case (REPLONGPB):
pBtn->state = sttPRELOAD;
pBtn->color = BLINK;
- Pannel_Leds(THREAD_LOAD, MODE_ON);//AVI+
if (ThreadLoadStateMachine( THREAD_LOAD_INIT))
{
pBtn->state = sttPRELOAD ; // to do
@@ -607,6 +562,7 @@ uint32_t LoadStatMachine( button *pBtn)
}
break;
case sttPRELOAD:
+ REPORT_MSG(parameter," ------------ load.state = sttPRELOAD ----------------- ");
switch (pBtn->Action)
{
case (SHORTPB):
@@ -624,7 +580,6 @@ uint32_t LoadStatMachine( button *pBtn)
{
pBtn->state = sttLOADFAIL ;
pBtn->color = fastBILNK ; // to do
- Pannel_Leds(THREAD_LOAD, MODE_ON);//AVI+
}
break;
default :
@@ -632,6 +587,7 @@ uint32_t LoadStatMachine( button *pBtn)
}
break;
case sttLOADING:
+ REPORT_MSG(parameter," ------------ load.state = sttLOADING ----------------- ");
break;
// case sttLOADSUCSESS ?????
// break;
@@ -639,6 +595,7 @@ uint32_t LoadStatMachine( button *pBtn)
// break;
default: //sttDISABLE
+ REPORT_MSG(parameter," ------------ load.state = default ----------------- ");
pBtn->color = colorOFF;
Pannel_Leds(THREAD_LOAD, MODE_OFF);//AVI+
break;
diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.h b/Software/Embedded_SW/Embedded/Modules/General/buttons.h
index 8b064bbcc..2d14eb000 100644
--- a/Software/Embedded_SW/Embedded/Modules/General/buttons.h
+++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.h
@@ -29,10 +29,12 @@ typedef enum
{
sttOFF = 0,
sttON,
+ sttIDLE,
+
sttDISABLE,
sttENABLE,
- sttIDLE,
sttJOGGING,
+
sttRDY,
sttPRELOAD,
sttLOADING,
@@ -50,7 +52,7 @@ typedef struct Button
uint32_t count;
}button;
-extern button power , jog, load;
+extern button power, jog, load, cart1, cart2, cart3;
uint32_t Buttons_Init(void);
uint32_t Button_load_Init(void);
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
index 93048681d..75ed06b05 100644
--- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
@@ -218,7 +218,7 @@ void LoadHeaterState(HeaterType HeaterType,HeaterState *HeaterState)
HeaterState->heatertype = HeaterType;
HeaterState->has_setpoint = true;
HeaterState->setpoint = HeaterCmd[HeaterId].targettemperatue/100;
- // HeaterState->setpoint = DCTimeSliceAllocation[HeaterId]*100/NumberOFSlicesInUse;
+ //HeaterState->setpoint = DCTimeSliceAllocation[HeaterId]*100/NumberOFSlicesInUse;
HeaterState->has_currentvalue = true;
HeaterState->currentvalue = temp/100;//MillisecGetTemperatures(HeaterId2PT100Id[HeaterId])/100;
HeaterState->has_isactive = true;
@@ -227,11 +227,16 @@ void LoadHeaterState(HeaterType HeaterType,HeaterState *HeaterState)
HeaterState->isrampingup = 1-HeaterReady[HeaterId];
HeaterState->has_isinsetpoint = true;
HeaterState->isinsetpoint = HeaterReady[HeaterId];
- /*if (HeaterId == HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature)
+ if (HeaterId == HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain)
{
HeaterState->setpoint = HeaterControl[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain].outputproportionalpowerlimit;
//HeaterState->isrampingup = InitialHeating;
- }*/
+ }
+ if (HeaterId == HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary)
+ {
+ HeaterState->setpoint = HeaterControl[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary].outputproportionalpowerlimit;
+ //HeaterState->isrampingup = InitialHeating;
+ }
return;
}
uint32_t HeatersSingleHeaterEnd(HardwarePidControlType HeaterId)
@@ -667,10 +672,10 @@ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue)
LOG_ERROR (MaxreadValue/100, "Heater Over the max temperature, turned off");
}
DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain);
- HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain] = true;
+ HeaterMaxTempFlag[index] = true;
//HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain,0);
DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary);
- HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary] = true;
+ //HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary] = true;
//HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary,0);
return OK;
}
@@ -842,17 +847,18 @@ 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))
+ if (readValue < (/*HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000*/HeaterCmd[index].targettemperatue-1000))
{
ActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary);
ActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain);
return OK;
}
- 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-1000)/*(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);
DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary);
HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary, 0);
HeatersControlStart();
@@ -891,15 +897,30 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
}
else //PID active
{
- if (HeaterPIDConfig[index].m_params.IntegralErrorMultiplier == 0)
+ if ((readValue > ((HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100)))
{
- HeaterPIDConfig[index].m_calculatedError = PIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam,
- &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral);
+ //disable PID outside band
+ HeaterPIDConfig[index].m_calculatedError = 0;
+ HeaterPIDConfig[index].m_integral = 0;
+ }
+ else if ((readValue < ((HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100)))
+ {
+ //disable PID outside band
+ HeaterPIDConfig[index].m_calculatedError = 10000;
+ HeaterPIDConfig[index].m_integral = 0;
}
else
{
- HeaterPIDConfig[index].m_calculatedError = AdvancedPIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam,
- &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral);
+ if (HeaterPIDConfig[index].m_params.IntegralErrorMultiplier == 0)
+ {
+ HeaterPIDConfig[index].m_calculatedError = PIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam,
+ &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral);
+ }
+ else
+ {
+ HeaterPIDConfig[index].m_calculatedError = AdvancedPIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam,
+ &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral);
+ }
}
// len = usnprintf(ACheatstr, 254, "ACD Id, Temp , Integral, Output{ %d, %d ,%d, %d} ",index,(int)HeaterPIDConfig[index].m_mesuredParam ,(int)HeaterPIDConfig[index].m_integral,(int)HeaterPIDConfig[index].m_calculatedError);
// Report(logmsg[index],__FILE__,__LINE__,index,RpWarning,index, Counter[index]);
@@ -1015,15 +1036,31 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
{
//check only for the proportional band limits
HeaterPIDConfig[index].m_mesuredParam = readValue;
- if (HeaterPIDConfig[index].m_params.IntegralErrorMultiplier == 0)
+ if ((readValue > ((HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100)))
{
- HeaterPIDConfig[index].m_calculatedError = PIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam,
- &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral);
+ //disable PID outside band
+ HeaterPIDConfig[index].m_calculatedError = 0;
+ HeaterPIDConfig[index].m_integral = 0;
+ }
+ else if ((readValue < ((HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100)))
+ {
+ //disable PID outside band
+ HeaterPIDConfig[index].m_calculatedError = 10000;
+ HeaterPIDConfig[index].m_integral = 0;
}
else
{
- HeaterPIDConfig[index].m_calculatedError = AdvancedPIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam,
- &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral);
+ if (HeaterPIDConfig[index].m_params.IntegralErrorMultiplier == 0)
+ {
+ HeaterPIDConfig[index].m_calculatedError = PIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam,
+ &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral);
+ }
+ else
+ {
+ HeaterPIDConfig[index].m_calculatedError = AdvancedPIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam,
+ &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral);
+ }
+
}
// error[index][Counter[index]] = HeaterPIDConfig[index].m_preError;
// integral[index][Counter[index]] = HeaterPIDConfig[index].m_integral;
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c
index 6d80355b7..f3c5ad8da 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c
@@ -661,7 +661,10 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback);
if (MotorsCfg[HW_Motor_Id].hardwaremotortype
!= DispenserIdToMotorId[DispenserId])
continue;
-
+ if ((DispenserId == CLEANER_DISPENSER)||(DispenserId == LUBRICANT_DISPENSER))
+ {
+ continue;
+ }
//(Speed*uStep*PPR)/((2*PI*Dispenser_Radius)
segmentfirst_speed = Dispensers[Dispenser_i]->nanolitterpersecond
/ Dispensers[Dispenser_i]->nanoliterperpulse;
@@ -799,6 +802,13 @@ uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId)
DispenserPreSegmentReady[DispenserId] = true; //27/03/19 check if job should be stopped
continue;
}
+ if ((DispenserId == CLEANER_DISPENSER)||(DispenserId == LUBRICANT_DISPENSER))
+ {
+ REPORT_MSG(DispenserId,"Dispenser PreSegment cleaner or lubricant");
+ DispenserPreSegmentReady[DispenserId] = true; //27/03/19 check if job should be stopped
+ continue;
+ }
+
//REPORT_MSG(DispenserId,"IDS_Valve_Presegment start");
IDS_Dispenser_Set_Flow_Params(DispenserId,0,0);
if (Dispensers[Dispenser_i]->dispenserstepdivision != DISPENSER_STEP_DIVISION__Auto)
@@ -842,7 +852,10 @@ void IDS_StartBrushStop(int n_dispensers, JobDispenser** Dispensers)
if (MotorsCfg[HW_Motor_Id].hardwaremotortype
!= DispenserIdToMotorId[DispenserId])
continue;
-
+ if ((DispenserId == CLEANER_DISPENSER)||(DispenserId == LUBRICANT_DISPENSER))
+ {
+ continue;
+ }
//(Speed*uStep*PPR)/((2*PI*Dispenser_Radius)
segmentfirst_speed = Dispensers[Dispenser_i]->nanolitterpersecond
/ Dispensers[Dispenser_i]->nanoliterperpulse;
diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_HW_Version.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_HW_Version.c
index e2f2013c9..4867587d9 100644
--- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_HW_Version.c
+++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_HW_Version.c
@@ -22,41 +22,7 @@
#include "driverlib/rom.h"
-char Read_HW_Version(unsigned char *Brd_ID, unsigned char *Assy_ID)
-{
- //TODO Move in GPIO Initialisation
-
- // ----------- Set HW Version GPIO as Input -----------
- //MAP_GPIOPinTypeGPIOInput(GPIO_PORTS_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1);
- //MAP_GPIOPinTypeGPIOInput(GPIO_PORTJ_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_7);
- //MAP_GPIOPinTypeGPIOInput(GPIO_PORTP_BASE, GPIO_PIN_3 | GPIO_PIN_5);
-
- //Set HW Version GPIO to Pull down
- GPIOPadConfigSet(GPIO_PORTS_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1, GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPD );
- GPIOPadConfigSet(GPIO_PORTJ_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_7, GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPD );
- GPIOPadConfigSet(GPIO_PORTP_BASE, GPIO_PIN_3 | GPIO_PIN_5, GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPD );
- // ------------------------------------------------------
- if (ROM_GPIOPinRead(GPIO_PORTS_BASE, GPIO_PIN_3) == GPIO_PIN_3)
- *Brd_ID |= 0x08;
- if (ROM_GPIOPinRead(GPIO_PORTS_BASE, GPIO_PIN_2) == GPIO_PIN_2)
- *Brd_ID |= 0x04;
- if (ROM_GPIOPinRead(GPIO_PORTJ_BASE, GPIO_PIN_5) == GPIO_PIN_5)
- *Brd_ID |= 0x02;
- if (ROM_GPIOPinRead(GPIO_PORTJ_BASE, GPIO_PIN_4) == GPIO_PIN_4)
- *Brd_ID |= 0x01;
-
- if (ROM_GPIOPinRead(GPIO_PORTP_BASE, GPIO_PIN_3) == GPIO_PIN_3)
- *Assy_ID |= 0x08;
- if (ROM_GPIOPinRead(GPIO_PORTP_BASE, GPIO_PIN_5) == GPIO_PIN_5)
- *Assy_ID |= 0x04;
- if (ROM_GPIOPinRead(GPIO_PORTS_BASE, GPIO_PIN_1) == GPIO_PIN_1)
- *Assy_ID |= 0x02;
- if (ROM_GPIOPinRead(GPIO_PORTJ_BASE, GPIO_PIN_7) == GPIO_PIN_7)
- *Assy_ID |= 0x01;
-
- return PASSED;
-}
void Stub_HWVersionRequest(MessageContainer* requestContainer)
{
diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.c
index 636889127..7995b1a42 100644
--- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.c
+++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.c
@@ -21,7 +21,7 @@
#include "drivers/SPI/SPI_Comm.h"
#include "driverlib/ssi.h"
-
+/*
unsigned long Run_Value = 136902 ;
unsigned long Pos_Value;
unsigned long Mov_Value ;
@@ -43,6 +43,28 @@
unsigned long TestUint32_4;
unsigned long TestUint32_5;
unsigned long TestUint32_6;
+ */
+ extern unsigned long Run_Value ;
+ extern unsigned long Mov_Value ;
+ extern unsigned long Pos_Value;
+ extern bool Direction ;
+ extern unsigned long Time_2_Change_Direction ;
+ extern bool Display_Tx_ON_LCD;
+ extern bool Display_Rx_on_LCD;
+ extern unsigned long Init_MicroStep ;
+ extern unsigned long Init_Acc;
+ extern unsigned long Init_Dec;
+ extern bool TestBool_1;
+ extern bool TestBool_2;
+ extern bool TestBool_3;
+ extern bool TestBool_4;
+ extern bool TestBool_5;
+ extern unsigned long TestUint32_1;
+ extern unsigned long TestUint32_2;
+ extern unsigned long TestUint32_3;
+ extern unsigned long TestUint32_4;
+ extern unsigned long TestUint32_5;
+ extern unsigned long TestUint32_6;
void Stub_L6470DriverRequest(MessageContainer* requestContainer)
{
diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.h b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.h
deleted file mode 100644
index 0b4702861..000000000
--- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.h
+++ /dev/null
@@ -1,3 +0,0 @@
-void Stub_L6470DriverRequest(MessageContainer* requestContainer);
-
-void temp_init_spi2();
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
index 1f7836ea5..70f32ce6d 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
@@ -322,7 +322,9 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId)
// * calculate
// * 1. calculate speed according to JobTicket->processparameters->dyeingspeed
// * calculation input: traverse length in milimeters/pulses, number of rotations per traverse ==> length of traverse per rotation.
- screw_horizontal_speed = InternalWinderCfg.segmentoffsetpulses / InternalWinderCfg.NumberOfRotationPerPassage;
+ ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep;
+ ScrewNumberOfSteps -= 100;
+ screw_horizontal_speed = ScrewNumberOfSteps / InternalWinderCfg.NumberOfRotationPerPassage;
// calculation input#2: number of rotations per second - (basically: speed/winder perimeter. later - according to winder actual speed - calculate according to winder position accumulation in the last second.
//RotationsPerSecond = dyeingspeed / (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulleyradius * PI);
RotationsPerSecond = OriginalMotorSpd_2PPS[WINDER_MOTOR] / MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround;
@@ -343,10 +345,8 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId)
// * 3. calculate cart travel length from winding parameters
// * 4. start move of travel length
// * 5. register motor nBusy callback. this callback will flip between move(traverse length, hardstop) and goto(0), with handline og the coneshape and adjusting maxspeed
- ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep;
- ScrewNumberOfSteps -= 100;
temp = SYS_CLK_FREQ;
- temp *= InternalWinderCfg.segmentoffsetpulses;
+ temp *= ScrewNumberOfSteps;
temp /= ScrewSpeed;
ScrewRunningTime = temp;//(SYS_CLK_FREQ*InternalWinderCfg.segmentoffsetpulses)/ScrewSpeed;
REPORT_MSG(ScrewNumberOfSteps,"Winder pre segment - ScrewNumberOfSteps");
diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste.h b/Software/Embedded_SW/Embedded/Modules/Waste/Waste.h
index bda01564f..74f7b40ef 100644
--- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste.h
+++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste.h
@@ -38,14 +38,14 @@ typedef enum
typedef enum
{
- SENSORnotFULL = 0,
- SENSORFULL
+ SENSORFULL = 0,
+ SENSORnotFULL
} WHS_FullSensorStatus;
typedef enum
{
- SENSOREMPTY = 0,
- SENSORnotEMPTY
+ SENSORnotEMPTY = 0,
+ SENSOREMPTY
} WHS_EmptySensorStatus;
typedef enum
@@ -99,6 +99,15 @@ U8 WHS_init(void);
U8 WHS_HW_test(void);
bool WHS_IsEmptying();
+bool WHS_IsContainerFull();
+bool WHS_IsContainerOverflow();
+bool WHS_WasteCartridgeLowerPresent();
+bool WHS_WasteCartridgeMiddlePresent();
+bool WHS_IsPumpActive();
+bool WHS_IsValveOpen();
+
+bool SetWastePump( bool power);
+
#endif
diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h
index e69de29bb..8b1378917 100644
--- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h
+++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_ex.h
@@ -0,0 +1 @@
+
diff --git a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c
index 9531b67d6..8aa358e32 100644
--- a/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c
+++ b/Software/Embedded_SW/Embedded/Modules/Waste/Waste_init.c
@@ -19,7 +19,7 @@
#define CartridgeWaste2CallBackTime eOneSecond
#define STARTCOUNT 1
#define STOPCOUNT 0
-#define PumpTimeout 60 // minutes
+#define PumpTimeout 1200 // seconds; 20 minutes, per Moty, 15/4/19
/*------------Waste Tank function-----------------------*/
@@ -98,6 +98,14 @@ struct WHS_information
struct WHS_information WHS_info;
+bool WHS_IsContainerFull(){return WHS_info.WHS_sensors.waste_tank_full_sensor;}
+bool WHS_IsContainerOverflow(){return WHS_info.WHS_sensors.waste_tank_over_flow_sensor;}
+bool WHS_WasteCartridgeLowerPresent(){return WHS_info.WHS_sensors.waste_cartridge1_precense_sensor;}
+bool WHS_WasteCartridgeMiddlePresent(){return WHS_info.WHS_sensors.waste_cartridge2_precense_sensor;}
+bool WHS_IsPumpActive(){return WHS_info.WHS_pump.status;}
+bool WHS_IsValveOpen(){return WHS_info.WHS_valve;}
+
+
bool WHS_IsEmptying()
{
@@ -141,13 +149,17 @@ bool CartridgeAuthentication(cartridge_name cart_name)
{
case waste_cartridge1:
WHS_info.cartridge_1.autheticate = PASSED;
+ //Pannel_Leds(CART_2, MODE_ON);
break;
case waste_cartridge2:
WHS_info.cartridge_2.autheticate = PASSED;
+ //Pannel_Leds(CART_3, MODE_ON);
break;
default:
WHS_info.cartridge_1.autheticate = FAILED;
WHS_info.cartridge_2.autheticate = FAILED;
+ //Pannel_Leds(CART_2, MODE_OFF);
+ //Pannel_Leds(CART_3, MODE_OFF);
break;
}
ret = OK;
@@ -231,7 +243,9 @@ bool SetValveDirection()
*
* */
bool ret = notOK;
- if (WHS_info.WHS_valve != no_waste_cartridge)
+ //if (WHS_info.WHS_valve != no_waste_cartridge)
+ if (WHS_info.active_cartridge == waste_cartridge1) WHS_info.WHS_valve = 1;
+ else WHS_info.WHS_valve = 2;
{
Valve_Set(VALVE_WASTE_TANK, WHS_info.WHS_valve);
ret = OK;
@@ -258,6 +272,7 @@ U8 CartridgeWasteFilling(bool status)
SetWastePump(OPEN);
//WHS_info.WHS_pump.time = 0;
REPORT_MSG(WHS_empty," ------------ WHS WHS_empty start PUMP ----------------- ");
+ ret=OK;
}
else // stop Waste cartridge filling
{
@@ -352,7 +367,7 @@ WHS_sttMachin UpdateStateMachine()
bool initWHS_WasteTank()
{
WHS_info.WHS_sensors.waste_tank_empty_sensor = RdWasteTankEmptySensor();
- WHS_info.WHS_sensors.waste_tank_full_sensor = SENSORnotFULL;//RdWasteTankFullSensor();
+ WHS_info.WHS_sensors.waste_tank_full_sensor = SENSORnotFULL;//;RdWasteTankFullSensor()
UpdateStateMachine();
AddControlCallback(WasteTankCBFunction, WasteTankCallBackTime , WasteTankCallBackFunction, 0,0,0);//eOneMinute
return OK;
@@ -392,7 +407,7 @@ WHS_sensor FullSensorEvent()
{
WHS_info.event = WHS_full_sensor;
ret = WHS_full_sensor;
- WHS_info.WHS_sensors.waste_tank_full_sensor = !WHS_info.WHS_sensors.waste_tank_full_sensor;
+ WHS_info.WHS_sensors.waste_tank_full_sensor = 1-WHS_info.WHS_sensors.waste_tank_full_sensor;
}
return ret;
}
@@ -446,7 +461,10 @@ bool WasteTankCBFunction()
if (WHS_info.WHS_sensors.waste_tank_empty_sensor == SENSORnotEMPTY)
{
if (WHS_info.sttMachine == WHS_empty)
+ {
WHS_info.sttMachine = WHS_filling;
+ REPORT_MSG(WHS_filling," ------------ WHS_filling ----------------- ");
+ }
else
{
REPORT_MSG(WHS_filling," ------------ WHS EMPTY sensor failed !!!!!!! ----------------- ");
@@ -457,9 +475,10 @@ bool WasteTankCBFunction()
if (WHS_info.sttMachine == WHS_emptying)
{
WHS_info.sttMachine = WHS_empty;
+ REPORT_MSG(WHS_filling," ------------ WHS_empty ----------------- ");
ret = CartridgeWasteFilling(OFF);
WHS_info.Cartridge_Cover_device_Id = RemoveControlCallback(WHS_info.Cartridge_Cover_device_Id, WasteTankCBFunction );
- WHS_info.Cartridge_Cover_device_Id = AddControlCallback( WasteTankCBFunction, CartridgeCoverCallBackTime, CartridgeCoverCallBackFunction, 0,0,0 );//eOneSecond
+ WHS_info.Cartridge_Cover_device_Id = AddControlCallback( WasteTankCBFunction, CartridgeCoverCallBackTime, CartridgeCoverCallBackFunction, 0,0,0 );//eOneSecond
//SafeRemoveControlCallback(Cartridge_Cover_device_Id, CartridgeCoverCBFunction );
}
else
@@ -471,24 +490,25 @@ bool WasteTankCBFunction()
case WHS_full_sensor:
if (WHS_info.WHS_sensors.waste_tank_full_sensor == SENSORFULL)
{
- if (WHS_info.sttMachine == WHS_filling)
- {
- WHS_info.sttMachine = WHS_full;
- WHS_info.Cartridge_Cover_device_Id = RemoveControlCallback(WHS_info.Cartridge_Cover_device_Id, WasteTankCBFunction );
- WHS_info.Cartridge_Cover_device_Id = AddControlCallback( WasteTankCBFunction, CartridgeCoverCallBackFastTime , CartridgeCoverCallBackFunction, 0,0,0 );//eTenMillisecond
- ret = CartridgeWasteFilling(ON);
- // cant start a new Job
- }
- else
+ WHS_info.sttMachine = WHS_full;
+ REPORT_MSG(WHS_emptying," ------------ WHS_full ----------------- ");
+ WHS_info.Cartridge_Cover_device_Id = RemoveControlCallback(WHS_info.Cartridge_Cover_device_Id, WasteTankCBFunction );
+ WHS_info.Cartridge_Cover_device_Id = AddControlCallback( WasteTankCBFunction, CartridgeCoverCallBackFastTime , CartridgeCoverCallBackFunction, 0,0,0 );//eTenMillisecond
+ ret = CartridgeWasteFilling(ON);
+ if (ret != OK)
{
- REPORT_MSG(WHS_filling," ------------ WHS FULL sensor failed !!!!!!! ----------------- ");
+ //recreate the full event until cartridge is inserted
+ WHS_info.WHS_sensors.waste_tank_full_sensor = 1-WHS_info.WHS_sensors.waste_tank_full_sensor;
}
+
+ // cant start a new Job
}
else
{
if (WHS_info.sttMachine == WHS_full)
{
WHS_info.sttMachine = WHS_emptying;
+ REPORT_MSG(WHS_emptying," ------------ WHS_emptying ----------------- ");
// can start a new JOB
}
else
@@ -548,13 +568,15 @@ bool WasteTankCBFunction()
case WHS_waste1_presence_sensor :
if (WHS_info.WHS_sensors.waste_cartridge1_precense_sensor == WHS_CarteidgePrecense ) // waste cartridge 1 is inserted .
{
- SetCartridgeLED(waste_cartridge1, led_on);
+ //SetCartridgeLED(waste_cartridge1, led_on);
+ Pannel_Leds(CART_2, MODE_ON);
RdWasteCartridgeParam(waste_cartridge1);
+ SetActiveWastCartridge();
+ SetValveDirection();
if ( CartridgeAuthentication(waste_cartridge1)) // to define authentication
{
//WHS_info.cartridge_1.autheticate = PASSED; //='0'
//???WHS_info.WHS_valve = waste_cartridge1; // or we should do it only before pumping????
- //???SetValveDirection(); // or we should do it only before pumping????
}
else
{
@@ -564,6 +586,7 @@ bool WasteTankCBFunction()
}
else // waste cartridge 1 take out
{
+ Pannel_Leds(CART_2, MODE_OFF);
WHS_info.cartridge_1.autheticate = FAILED;
//???if (WHS_info.cartridge_2.autheticate == PASSED) // or we should do it only before pumping????
//???{
@@ -582,7 +605,7 @@ bool WasteTankCBFunction()
case WHS_waste2_presence_sensor :
if (WHS_info.WHS_sensors.waste_cartridge2_precense_sensor == WHS_CarteidgePrecense ) // waste cartridge is inserted .
{
- SetCartridgeLED(waste_cartridge2, led_on);
+ Pannel_Leds(CART_3, MODE_ON);//SetCartridgeLED(waste_cartridge2, led_on);
RdWasteCartridgeParam(waste_cartridge2);
if ( CartridgeAuthentication(waste_cartridge2)) // to define authentication
{
@@ -598,6 +621,7 @@ bool WasteTankCBFunction()
}
else // waste cartridge 2 take out
{
+ Pannel_Leds(CART_3, MODE_OFF);
WHS_info.cartridge_2.autheticate = FAILED;
/*
if (WHS_info.cartridge_2.autheticate == PASSED) // or we should do it only before pumping????
@@ -616,6 +640,7 @@ bool WasteTankCBFunction()
//SetActiveWastCartridge();
break;
case WHS_Timeout:
+ REPORT_MSG(WHS_emptying," ------------ WHS_Timeout ----------------- ");
AlarmHandlingSetAlarm( EVENT_TYPE__WASTE_CONTAINER_EMPTYING_TIMEOUT, true);
CartridgeWasteFilling(OFF);
break;
@@ -633,11 +658,16 @@ bool WasteTankCBFunction()
bool RdCartridgeCoverSensor()
{
+ uint32_t parameter = 6 ;
+
+ //REPORT_MSG(parameter," ------------ RD Cartridge Cover Sensor ----------------- ");
bool ret = notOK;
WHS_Read_GPI_Registers();
// WHS_info.WHS_sensors.cartridge_cover = Get_COVER_1_State(CartridgesDoor);
// ret = WHS_info.WHS_sensors.cartridge_cover;
ret = Get_COVER_1_State(CartridgesDoor);
+ if ((ret == OPEN ) && (ret != WHS_info.WHS_sensors.cartridge_cover)) Report(" ------------ RD Cartridge Cover Sensor is = OPEN(1) ----------------- ",__FILE__,__LINE__,ret,RpWarning,ret,0);
+ if ((ret == CLOSE ) && (ret != WHS_info.WHS_sensors.cartridge_cover)) REPORT_MSG(parameter," ------------ RD Cartridge Cover Sensor is = CLOSE(0) ----------------- ");
return ret;
}
@@ -646,10 +676,14 @@ bool RdCartridgeCoverSensor()
WHS_sensor CartridgeCoverCallBackFunction()
{
+ uint32_t parameter = 6 ;
+
+
WHS_sensor ret = WHS_no_event;
//ret = RdCartridgeCoverSensor();
if (WHS_info.WHS_sensors.cartridge_cover != RdCartridgeCoverSensor())
{
+ REPORT_MSG(parameter," ------------ find : WHS_cartridge_cover_sensor event ----------------- ");
WHS_info.event = WHS_cartridge_cover_sensor;
WHS_info.WHS_sensors.cartridge_cover = !WHS_info.WHS_sensors.cartridge_cover;
ret = WHS_cartridge_cover_sensor;
@@ -659,10 +693,13 @@ WHS_sensor CartridgeCoverCallBackFunction()
WHS_sensor CartridgeWaste1CallBackFunction()
{
+ uint32_t parameter = 6 ;
+
WHS_sensor ret = WHS_no_event;
//ret = RdCartridgeCoverSensor();
if (WHS_info.WHS_sensors.waste_cartridge1_precense_sensor != RdWasteCartridge1Sensor())
{
+ REPORT_MSG(parameter," ------------ find : WHS_waste1_presence_sensor event ----------------- ");
WHS_info.event = WHS_waste1_presence_sensor;
WHS_info.WHS_sensors.waste_cartridge1_precense_sensor = !WHS_info.WHS_sensors.waste_cartridge1_precense_sensor;
ret = WHS_waste1_presence_sensor;
@@ -672,10 +709,13 @@ WHS_sensor CartridgeWaste1CallBackFunction()
WHS_sensor CartridgeWaste2CallBackFunction()
{
+ uint32_t parameter = 6 ;
+
WHS_sensor ret = WHS_no_event;
//ret = RdCartridgeCoverSensor();
if (WHS_info.WHS_sensors.waste_cartridge2_precense_sensor != RdWasteCartridge2Sensor())
{
+ REPORT_MSG(parameter," ------------ find : WHS_waste2_presence_sensor event ----------------- ");
WHS_info.event = WHS_waste2_presence_sensor;
WHS_info.WHS_sensors.waste_cartridge2_precense_sensor = !WHS_info.WHS_sensors.waste_cartridge2_precense_sensor;
ret = WHS_waste2_presence_sensor;
@@ -686,15 +726,45 @@ WHS_sensor CartridgeWaste2CallBackFunction()
/*------------------------------- Cartridge Waste -----------------------------------------*/
bool InitWasteCartStatus()
{
+ uint32_t parameter = 6 ;
+
WHS_info.WHS_sensors.cartridge_cover = RdCartridgeCoverSensor();
- WHS_info.WHS_sensors.waste_cartridge1_precense_sensor = RdWasteCartridge1Sensor();
- WHS_info.WHS_sensors.waste_cartridge2_precense_sensor = RdWasteCartridge2Sensor();
+
+ if (RdWasteCartridge1Sensor())
+ {
+ REPORT_MSG(parameter," ------------ WHS_waste1_presence_sensor event ----------------- ");
+ WHS_info.WHS_sensors.waste_cartridge1_precense_sensor = WHS_CarteidgePrecense;
+ Pannel_Leds( CART_2, MODE_ON);
+ }
+ else
+ {
+ REPORT_MSG(parameter," ------------ WHS_waste1_NOT !!! presence_sensor ----------------- ");
+ WHS_info.WHS_sensors.waste_cartridge1_precense_sensor = WHS_CarteidgeNotPrecense;
+ Pannel_Leds( CART_2, MODE_OFF);
+ }
+
+ if (RdWasteCartridge2Sensor())
+ {
+ REPORT_MSG(parameter," ------------ WHS_waste2_presence_sensor event ----------------- ");
+ WHS_info.WHS_sensors.waste_cartridge2_precense_sensor = WHS_CarteidgePrecense;
+ Pannel_Leds( CART_3, MODE_ON);
+ }
+ else
+ {
+ REPORT_MSG(parameter," ------------ WHS_waste1_NOT !!! presence_sensor ----------------- ");
+ WHS_info.WHS_sensors.waste_cartridge2_precense_sensor = WHS_CarteidgeNotPrecense;
+ Pannel_Leds( CART_3, MODE_OFF);
+ }
+
+
+
if (WHS_info.WHS_sensors.waste_cartridge1_precense_sensor == WHS_CarteidgePrecense) CartridgeAuthentication(waste_cartridge1);
if (WHS_info.WHS_sensors.waste_cartridge2_precense_sensor == WHS_CarteidgePrecense) CartridgeAuthentication(waste_cartridge2);
SetActiveWastCartridge();
if (WHS_info.WHS_sensors.cartridge_cover == WHS_CartridgeCoverOPEN)
{
+ REPORT_MSG(parameter," ------------ WHS_CartridgeCoverOPEN : add callback for cart1 and cart 1 ----------------- ");
WHS_info.Cartridge_Waste1_device_Id = AddControlCallback( WasteTankCBFunction, eOneSecond, CartridgeWaste1CallBackFunction, 0,0,0 );
WHS_info.Cartridge_Waste2_device_Id = AddControlCallback( WasteTankCBFunction, eOneSecond, CartridgeWaste2CallBackFunction, 0,0,0 );
}
@@ -725,12 +795,26 @@ bool RdWasteCartridge2Sensor()
bool SetActiveWastCartridge()
{
+ uint8_t parameter = 5;
+
bool ret = notOK;
if (( WHS_info.WHS_sensors.waste_cartridge1_precense_sensor == PRECENSE ) &&
- (WHS_info.cartridge_1.autheticate == PASSED)) WHS_info.active_cartridge = waste_cartridge1;
+ (WHS_info.cartridge_1.autheticate == PASSED))
+ {
+ REPORT_MSG(parameter," ------------ WHS : active_cartridge = waste_cartridge 1 ----------------- ");
+ WHS_info.active_cartridge = waste_cartridge1;
+ }
else if (( WHS_info.WHS_sensors.waste_cartridge2_precense_sensor == PRECENSE) &&
- (WHS_info.cartridge_2.autheticate == PASSED)) WHS_info.active_cartridge = waste_cartridge2;
- else WHS_info.active_cartridge = no_waste_cartridge;
+ (WHS_info.cartridge_2.autheticate == PASSED))
+ {
+ REPORT_MSG(parameter," ------------ WHS : active_cartridge = waste_cartridge 2 ----------------- ");
+ WHS_info.active_cartridge = waste_cartridge2;
+ }
+ else
+ {
+ REPORT_MSG(parameter," ------------ WHS : NO active_cartridge ----------------- ");
+ WHS_info.active_cartridge = no_waste_cartridge;
+ }
return ret;
}
@@ -911,6 +995,7 @@ U8 RdWaste2()
U8 SetValve(bool value)
{
bool ret = notOK;
+ WHS_info.WHS_valve = value;
ret = SetValveDirection( );
return ret;
}