aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/StateMachines
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2020-11-04 13:07:16 +0200
committerShlomo Hecht <shlomo@twine-s.com>2020-11-04 13:07:16 +0200
commita567f6686212a66cbe9f825f8f72e218c7362bcf (patch)
treecae3abd83e32167035d121ad1077fcc044a61008 /Software/Embedded_SW/Embedded/StateMachines
parent975f7174c6cd52882239ff2420300f151f3603e7 (diff)
downloadTango-a567f6686212a66cbe9f825f8f72e218c7362bcf.tar.gz
Tango-a567f6686212a66cbe9f825f8f72e218c7362bcf.zip
some small fixes (tunnel air flow, power up messages, persistent OFF alarms)
Diffstat (limited to 'Software/Embedded_SW/Embedded/StateMachines')
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c
index 5d2bf2922..40315e623 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c
@@ -91,8 +91,11 @@ MACHINE_STATE_STAGES_ENUM GetMachineState(void)
}
void SetMachineState(MACHINE_STATE_STAGES_ENUM NewState)
{
- MachineStateDetail = NewState;
- PowerUpUpdate(NewState);
+ if (MachineStateDetail != NewState)
+ {
+ MachineStateDetail = NewState;
+ PowerUpUpdate(NewState);
+ }
}
void StopInitSequence(void)
{
@@ -146,7 +149,7 @@ uint32_t InitScheduler(uint32_t IfIndex, uint32_t BusyFlag)
StoredInitStages = InitStages;
InitSequenceStateMachine(InitStages);
}
- PowerUpUpdate(MachineStateDetail);
+ //PowerUpUpdate(MachineStateDetail);
return OK;
}
/*******************************************************************************************************/
@@ -748,6 +751,14 @@ uint32_t InitSequenceStateMachine( INIT_SEQUENCE_STAGES_ENUM ReadValue)
return OK;
}
char PowerUpToken[36+1] = {0};
+//char init_string[100];
+uint32_t PowerUpLoadControlId = 0xFF;
+uint32_t PowerUpUpdateCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
+{
+
+ PowerUpUpdate(MachineStateDetail);
+ return OK;
+}
uint32_t PowerUpUpdate(MACHINE_STATE_STAGES_ENUM stage)
{
uint32_t status = NOT_SUPPORTED;
@@ -762,7 +773,7 @@ uint32_t PowerUpUpdate(MACHINE_STATE_STAGES_ENUM stage)
if (PowerUpToken[0] == 0)
return OK;
- Report("PowerUpUpdate",__FILE__,last,InitStages,RpWarning,(int)stage,0);
+ //Report("PowerUpUpdate",__FILE__,last,InitStages,RpWarning,(int)stage,0);
response.has_state = true;
response.has_progresspercentage = true;
@@ -874,7 +885,8 @@ uint32_t PowerUpUpdate(MACHINE_STATE_STAGES_ENUM stage)
Error = ERROR_CODE__POWER_UP_NO_CFG_FILE;
break;
}
- //Report("PowerUpUpdate",__FILE__,last,(int)response.progresspercentage,RpWarning,(int)stage,0);
+ //usnprintf(init_string, 80, "PowerUpUpdate token %s",PowerUpToken);
+ Report("PowerUpUpdate",__FILE__,InitStages,(int)response.progresspercentage,RpWarning,(int)stage,0);
responseContainer = createContainer(MESSAGE_TYPE__StartPowerUpResponse, PowerUpToken, last, &response, &start_power_up_response__pack, &start_power_up_response__get_packed_size);
responseContainer.has_continuous = true;
responseContainer.continuous = true;
@@ -891,8 +903,18 @@ uint32_t PowerUpUpdate(MACHINE_STATE_STAGES_ENUM stage)
SendChars((char*)container_buffer, container_size);
//MessageContainer responseContainer;
+ if (last == true)
+ {
+ if (PowerUpLoadControlId!= 0xFF)
+ {
+ RemoveControlCallback(PowerUpLoadControlId, PowerUpUpdateCallBackFunction);
+ PowerUpLoadControlId = 0xFF;
+ }
+ }
return status;
}
+
+
uint32_t PowerUpUpdateFunc(MessageContainer* requestContainer)
{
uint32_t status = NOT_SUPPORTED;
@@ -900,11 +922,13 @@ uint32_t PowerUpUpdateFunc(MessageContainer* requestContainer)
// MachineUpdateInitParams InitParams;
- Report("PowerUpUpdateFunc",__FILE__,__LINE__,(int)0,RpWarning,(int)0,0);
StartPowerUpRequest* request = start_power_up_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data);
ustrncpy (PowerUpToken, requestContainer->token,36);
+ //usnprintf(init_string, 80, "PowerUpUpdateFunc token %s",PowerUpToken);
+ Report("PowerUpUpdateFunc",__FILE__,__LINE__,(int)0,RpWarning,(int)0,0);
+ PowerUpLoadControlId = AddControlCallback("PowerUpLoad", PowerUpUpdateCallBackFunction, 2* eOneSecond, TemplateDataReadCBFunction,0,0, 0 );
- PowerUpUpdate(MachineStateDetail);
+ //PowerUpUpdate(MachineStateDetail);
start_power_up_request__free_unpacked(request,NULL);
return status;
}