Respond to instigation whenever possible.
This commit is contained in:
parent
c034427c3c
commit
26cb24dfe1
6 changed files with 16 additions and 6 deletions
|
@ -24,7 +24,7 @@
|
|||
|
||||
static TimerHandle_t BLEStatusTimer = NULL;
|
||||
static StaticTimer_t xBLEStatusTimerBuffer;
|
||||
static TickType_t xBLEStatusTimerPeriod = 3000 / portTICK_PERIOD_MS;
|
||||
static TickType_t xBLEStatusTimerPeriod = 500 / portTICK_PERIOD_MS;
|
||||
|
||||
static TimerHandle_t GameDurationTimer = NULL;
|
||||
static StaticTimer_t xGameDurationTimerBuffer;
|
||||
|
|
|
@ -50,6 +50,7 @@ static void Starting_Game__Counting_Down_Entry(StateMachineContext_T * context)
|
|||
Reset_Shots_Fired();
|
||||
Reset_Tags_Received();
|
||||
Reset_Times_Tagged_Out();
|
||||
Set_Health(Get_Max_Health());
|
||||
|
||||
uint8_t n_bombs;
|
||||
if (SETTINGS_get_uint8_t(SYSTEMK_SETTING_N_SPECIAL_WEAPONS_ON_REENTRY, &n_bombs) == SYSTEMK_RESULT_SUCCESS)
|
||||
|
|
|
@ -230,7 +230,12 @@ static void Configuring_Do(StateMachineContext_T *context)
|
|||
break;
|
||||
|
||||
case KEVENT_BLE_PACKET_RECEIVED:
|
||||
if (((BLE_Packet_T *)Event.Data)->Generic.type == BLE_PACKET_TYPE_PARAMETERS)
|
||||
if (((BLE_Packet_T *)Event.Data)->Generic.type == BLE_PACKET_TYPE_INSTIGATE_GAME)
|
||||
{
|
||||
Transition_For_Event(context, STATE_STARTING_GAME__RESPONDING, &Event);
|
||||
// Don't free the packet buffer here; it will be freed in Starting_Game__Responding_Entry().
|
||||
}
|
||||
else if (((BLE_Packet_T *)Event.Data)->Generic.type == BLE_PACKET_TYPE_PARAMETERS)
|
||||
{
|
||||
HandleBLEConfigurationPacket((BLE_ParametersPacket_T *)Event.Data);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ static void Initializing_Do(StateMachineContext_T * context)
|
|||
{
|
||||
switch (Event.ID)
|
||||
{
|
||||
case KEVENT_TRIGGER_SWITCH_PRESSED:
|
||||
case KEVENT_ACCESSORY_SWITCH_PRESSED:
|
||||
Transition_For_Event(context, STATE_REPROGRAMMING, &Event);
|
||||
break;
|
||||
|
||||
|
|
|
@ -54,8 +54,6 @@ static void Ready_Entry(StateMachineContext_T * context)
|
|||
}
|
||||
AudioAction_T audio_action = {.ID = AUDIO_PLAY_GAME_ON, .Data = (void *)0x00};
|
||||
Perform_Audio_Action(&audio_action);
|
||||
|
||||
Set_Health(Get_Max_Health());
|
||||
}
|
||||
|
||||
//! Executes the Ready state.
|
||||
|
@ -91,6 +89,7 @@ static void Ready_Do(StateMachineContext_T * context)
|
|||
if (((BLE_Packet_T *)Event.Data)->Generic.type == BLE_PACKET_TYPE_INSTIGATE_GAME)
|
||||
{
|
||||
Transition_For_Event(context, STATE_STARTING_GAME__RESPONDING, &Event);
|
||||
// Don't free the packet buffer here; it will be freed in Starting_Game__Responding_Entry().
|
||||
}
|
||||
else if (((BLE_Packet_T *)Event.Data)->Generic.type == BLE_PACKET_TYPE_EVENT)
|
||||
{
|
||||
|
|
|
@ -109,7 +109,12 @@ static void Wrapping_Up_Do(StateMachineContext_T * context)
|
|||
break;
|
||||
|
||||
case KEVENT_BLE_PACKET_RECEIVED:
|
||||
if (((BLE_Packet_T *)Event.Data)->Generic.type == BLE_PACKET_TYPE_EVENT)
|
||||
if (((BLE_Packet_T *)Event.Data)->Generic.type == BLE_PACKET_TYPE_INSTIGATE_GAME)
|
||||
{
|
||||
Transition_For_Event(context, STATE_STARTING_GAME__RESPONDING, &Event);
|
||||
// Don't free the packet buffer here; it will be freed in Starting_Game__Responding_Entry().
|
||||
}
|
||||
else if (((BLE_Packet_T *)Event.Data)->Generic.type == BLE_PACKET_TYPE_EVENT)
|
||||
{
|
||||
HandleBLEEventPacket((BLE_EventPacket_T *)Event.Data, context);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue