aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-04-04 10:21:56 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-04-04 10:21:56 +0300
commit5fbbb670dba573001f3e8054c78f3cd853585d44 (patch)
tree9c34d673dea866d1a8ca8964d6561052f29ef44a /Software/Embedded_SW
parentdd2d747b18c3390654f5fc24490bc2e27637aff1 (diff)
downloadTango-5fbbb670dba573001f3e8054c78f3cd853585d44.tar.gz
Tango-5fbbb670dba573001f3e8054c78f3cd853585d44.zip
idle improved. PowerIdleActivateIdleState added
Diffstat (limited to 'Software/Embedded_SW')
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c31
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.h5
2 files changed, 34 insertions, 2 deletions
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c
index c6136fc62..48da24487 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c
@@ -29,8 +29,10 @@ int powerIdleSecondsLimit = DEFAULT_IDLE_TIME_LIMIT;
bool powerIdleState = false;
bool machineActive = false;
uint32_t IdleControlId = 0xFF;
+ProcessParameters ActiveProcessParameters;
void PowerIdleSetIdle(void)
{
+ memcpy (&ActiveProcessParameters,&ProcessParametersKeep,sizeof(ProcessParameters));
ProcessParameters ProcessParametersClear;
ProcessParametersClear.dryerzone1temp = 80;
ProcessParametersClear.dryerzone2temp = 80;
@@ -46,7 +48,7 @@ void PowerIdleSetIdle(void)
if (HandleProcessParameters(&ProcessParametersClear)!= OK)
{
LOG_ERROR (1, "Turn Heaters idle failed");
- return ERROR;
+ return;
}
if (BlowerCfg.enabled == true)
{
@@ -62,6 +64,9 @@ uint32_t PowerIdleCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
{
if (machineActive == true)
return OK;
+ if (powerIdleSecondsCounter%10 == 0)
+ Report("PowerIdle Idle counter ",__FILE__,__LINE__,(int)powerIdleSecondsLimit,RpWarning,(int)powerIdleSecondsCounter,0);
+
if (++powerIdleSecondsCounter>=powerIdleSecondsLimit)
{
if (powerIdleState == false)
@@ -69,6 +74,7 @@ uint32_t PowerIdleCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
Report("PowerIdle Idle activated ",__FILE__,__LINE__,(int)powerIdleSecondsLimit,RpWarning,(int)powerIdleSecondsCounter,0);
powerIdleState = true;
//move to idle state
+ PowerIdleSetIdle();
}
}
return OK;
@@ -86,6 +92,7 @@ void setIdleLimit (int Limit) {powerIdleSecondsLimit = Limit;}
void setmachineActive(bool Active){machineActive = Active;}
void resetIdleCounter (void) {powerIdleSecondsCounter = 0;}
bool getIdleState (void) {return powerIdleState;}
+
void PowerIdleOutOfIdleState(void)
{
Report("PowerIdle Out of Idle ",__FILE__,__LINE__,(int)powerIdleSecondsLimit,RpWarning,(int)powerIdleSecondsCounter,0);
@@ -93,7 +100,27 @@ void PowerIdleOutOfIdleState(void)
if (powerIdleState == true)
{
powerIdleState = false;
- //move to idle state
+ if (HandleProcessParameters(&ActiveProcessParameters)!= OK)
+ {
+ LOG_ERROR (1, "Turn Heaters active failed");
+ return ;
+ }
+ }
+
+}
+void PowerIdleActivateIdleState(void)
+{
+ Report("PowerIdle Activate Idle ",__FILE__,__LINE__,(int)machineActive,RpWarning,(int)powerIdleSecondsCounter,0);
+ if (machineActive == true)
+ {
+ LOG_ERROR(machineActive, "machine is active, cannot switch on idle state");
+ return;
+ }
+ powerIdleSecondsCounter = 0;
+ if (powerIdleState == false)
+ {
+ powerIdleState = true;
+ PowerIdleSetIdle();
}
}
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.h b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.h
index 71edf8885..efe0e7cb4 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.h
+++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.h
@@ -9,10 +9,15 @@
#define STATEMACHINES_INITIALIZATION_POWERIDLE_H_
int getIdleCounter (void);
+
void setIdleLimit (int Limit);
+
void resetIdleCounter (void);
bool getIdleState (void);
+
void PowerIdleOutOfIdleState(void);
+void PowerIdleActivateIdleState(void);
+
void setmachineActive(bool Active);
void PowerIdleInit(void);