The Accessory button now selects team in the Configuring state. (#1)
With the advent of the new State Machine, there is opportunity in the *Configuring* state for a player to select his team by pressing the *Accessory* button. The Mobile App or IR remote can also be used, as before.  I also consolidated some duplicated code into `Set_Team_With_Audio_Feedback()`. Co-authored-by: Joe Kearney <joe@clubk.club> Reviewed-on: #1
This commit is contained in:
parent
6f51f5b006
commit
4fe072f2d3
4 changed files with 189 additions and 141 deletions
|
@ -22,8 +22,10 @@
|
|||
|
||||
#include "SystemK.h"
|
||||
|
||||
#define MIN_TEAM_ID 0
|
||||
#define MAX_TEAM_ID 3
|
||||
#define MIN_TEAM_ID BASIC_TEAMS_MINIMUM
|
||||
#define MAX_TEAM_ID BASIC_TEAMS_MAXIMUM
|
||||
|
||||
static const char * KLOG_TAG = "Team ID Menu";
|
||||
|
||||
static uint8_t Team_ID;
|
||||
|
||||
|
@ -73,13 +75,11 @@ static void OnIncrement()
|
|||
{
|
||||
Team_ID = MAX_TEAM_ID;
|
||||
}
|
||||
(void) SETTINGS_set_uint8_t(SYSTEMK_SETTING_TEAMID, Team_ID);
|
||||
|
||||
AudioAction_T audio_action = {.ID = AUDIO_PLAY_TEAM_ID_PROMPT, .Play_To_Completion = true, .Data = (void *)0x00};
|
||||
Perform_Audio_Action(&audio_action);
|
||||
|
||||
AudioAction_T volume_action = {.ID = AUDIO_PRONOUNCE_NUMBER_0_TO_100, .Play_To_Completion = true, .Data = (void *)&Team_ID};
|
||||
Perform_Audio_Action(&volume_action);
|
||||
|
||||
if (Set_Team_With_Audio_Feedback(Team_ID) != SYSTEMK_RESULT_SUCCESS)
|
||||
{
|
||||
KLOG_WARN(KLOG_TAG, "Failed to increment team!");
|
||||
}
|
||||
}
|
||||
|
||||
static void OnDecrement()
|
||||
|
@ -94,11 +94,9 @@ static void OnDecrement()
|
|||
{
|
||||
Team_ID = MIN_TEAM_ID;
|
||||
}
|
||||
(void) SETTINGS_set_uint8_t(SYSTEMK_SETTING_TEAMID, Team_ID);
|
||||
|
||||
AudioAction_T audio_action = {.ID = AUDIO_PLAY_TEAM_ID_PROMPT, .Play_To_Completion = true, .Data = (void *)0x00};
|
||||
Perform_Audio_Action(&audio_action);
|
||||
|
||||
AudioAction_T volume_action = {.ID = AUDIO_PRONOUNCE_NUMBER_0_TO_100, .Play_To_Completion = true, .Data = (void *)&Team_ID};
|
||||
Perform_Audio_Action(&volume_action);
|
||||
|
||||
if (Set_Team_With_Audio_Feedback(Team_ID) != SYSTEMK_RESULT_SUCCESS)
|
||||
{
|
||||
KLOG_WARN(KLOG_TAG, "Failed to decrement team!");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue