Reworked BLE according to v0.12 of the KTag Beacon Specification (#5)

This change to SystemK implements version 0.12 of the KTag Beacon Specification.

The spec. is here: [KTag Beacon Specification v0.12](https://ktag.clubk.club/Technology/BLE/KTag%20Beacon%20Specification%20v0.12.pdf)
This change also includes the 31AUG2025 changes to the State Machine (now documented [here](https://ktag.clubk.club/Technology/SystemK/SystemKStateMachine.drawio.png)), as well as changes to support automated testing.

**All projects should update to this version.**

Co-authored-by: Joe Kearney <joe@clubk.club>
Reviewed-on: #5
This commit is contained in:
Joe Kearney 2025-09-01 17:44:10 +00:00
parent 7aa827563a
commit 430aec54b8
22 changed files with 368 additions and 47 deletions

View file

@ -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;

View file

@ -406,6 +406,7 @@ static void Playing__Interacting_Do(StateMachineContext_T * context)
}
break;
case KEVENT_PLAY_PRESSED_ON_REMOTE:
case KEVENT_GAME_OVER:
{
AudioAction_T audio_action = {.ID = AUDIO_PLAY_GAME_OVER, .Play_To_Completion = true};
@ -413,6 +414,21 @@ static void Playing__Interacting_Do(StateMachineContext_T * context)
Transition_For_Event(context, STATE_WRAPPING_UP, &Event);
}
break;
case KEVENT_MENU_UP:
{
#ifdef LOG_INTERACTING_SUBSTATE
KLOG_INFO(KLOG_TAG, "Simulating a tag leading to being tagged out.");
#endif // LOG_INTERACTING_SUBSTATE
Reduce_Health(Get_Max_Health());
AudioAction_T audio_action = {.ID = AUDIO_PLAY_TAG_RECEIVED, .Data = (void *)0x00};
Perform_Audio_Action(&audio_action);
NeoPixelsAction_T neopixels_action = {.ID = NEOPIXELS_TAG_RECEIVED, .Prominence = NEOPIXELS_FOREGROUND, .Data = (void *)&ReceivedTagColor};
xQueueSend(xQueueNeoPixels, &neopixels_action, 0);
}
break;
default:
// All other events are ignored in this state.

View file

@ -185,6 +185,7 @@ static void Playing__Tagged_Out_Do(StateMachineContext_T * context)
}
break;
case KEVENT_PLAY_PRESSED_ON_REMOTE:
case KEVENT_GAME_OVER:
{
AudioAction_T audio_action = {.ID = AUDIO_PLAY_GAME_OVER, .Play_To_Completion = true};
@ -193,7 +194,7 @@ static void Playing__Tagged_Out_Do(StateMachineContext_T * context)
}
break;
case KEVENT_PLAY_PRESSED_ON_REMOTE:
case KEVENT_MENU_DOWN:
Set_Health(Get_Max_Health());
Reset_Bombs();
Transition_For_Event(context, STATE_PLAYING__INTERACTING, &Event);