Reworked BLE according to v0.11 of the KTag Beacon Specification (#2)

This was done to support the new KTag Konfigurator app, which Jack created for his Senior Design project.

Co-authored-by: Joe Kearney <joe@clubk.club>
Reviewed-on: #2
This commit is contained in:
Joe Kearney 2025-06-08 21:52:29 +00:00
parent 4fe072f2d3
commit bfcdf4c354
26 changed files with 917 additions and 128 deletions

View file

@ -22,6 +22,8 @@
/* Include Files */
#include "SystemK.h"
static const char *KLOG_TAG = "STARTING_GAME__COUNTING_DOWN";
static void Starting_Game__Counting_Down_Entry(StateMachineContext_T * context);
static void Starting_Game__Counting_Down_Do(StateMachineContext_T * context);
static void Starting_Game__Counting_Down_Exit(StateMachineContext_T * context);
@ -48,8 +50,17 @@ static void Starting_Game__Counting_Down_Entry(StateMachineContext_T * context)
Reset_Shots_Fired();
Reset_Tags_Received();
Reset_Times_Tagged_Out();
// TODO: Get this from settings.
Set_Available_Bombs(1);
uint8_t n_bombs;
if (SETTINGS_get_uint8_t(SYSTEMK_SETTING_N_SPECIAL_WEAPONS_ON_REENTRY, &n_bombs) == SYSTEMK_RESULT_SUCCESS)
{
Set_Available_Bombs(n_bombs);
}
else
{
Set_Available_Bombs(0);
KLOG_ERROR(KLOG_TAG, "Error getting available bombs!");
}
N_Lights_Lit = 0;
AudioAction_T audio_action = {.ID = AUDIO_SILENCE, .Data = (void *)0x00};

View file

@ -49,6 +49,10 @@ static void Starting_Game__Instigating_Entry(StateMachineContext_T * context)
Starting_Game_Entry(context);
LOG("Entering the Instigating substate of the Starting Game state.");
uint32_t game_length_in_ms;
(void) SETTINGS_get_uint32_t(SYSTEMK_SETTING_T_GAME_LENGTH_in_ms, &game_length_in_ms);
Set_Time_Remaining_Until_Countdown(game_length_in_ms);
Set_Time_Remaining_in_Game(UINT32_MAX);
uint32_t start_game_time_in_ms;

View file

@ -56,6 +56,7 @@ static void Starting_Game__Responding_Entry(StateMachineContext_T * context)
{
uint32_t game_length_in_ms = ((BLE_Packet_T *)context->Cause_Of_Transition->Data)->Instigation.game_length_in_ms;
Set_Time_Remaining_in_Game(game_length_in_ms);
(void) SETTINGS_set_uint32_t(SYSTEMK_SETTING_T_GAME_LENGTH_in_ms, game_length_in_ms);
uint32_t time_remaining_until_countdown_in_ms = ((BLE_Packet_T *)context->Cause_Of_Transition->Data)->Instigation.time_remaining_until_countdown_in_ms;
Set_Time_Remaining_Until_Countdown(time_remaining_until_countdown_in_ms);