SystemK v2.01: The K-Points game #16

Open
Joe wants to merge 45 commits from coin_game_feature_dev into main
Owner

SystemK v2.01: The K-Points Game

This version of SystemK is based on Version 0.13 of the KTag Beacon Specification, which adds Packet Type 0x08: the TRANSFER packet. This packet is used for transferring items (starting with a in-game currency called K-Points) from device to device reliably.

# SystemK v2.01: The K-Points Game This version of SystemK is based on [Version 0.13](https://ktag.clubk.club/Technology/BLE/KTag%20Beacon%20Specification%20v0.13.pdf) of the KTag Beacon Specification, which adds *Packet Type 0x08: the TRANSFER packet*. This packet is used for transferring items (starting with a in-game currency called K-Points) from device to device reliably. ## Related PRs: - https://git.ktag.clubk.club/Software/SystemK/pulls/16 - https://git.ktag.clubk.club/Software/2024A-SW/pulls/19 - https://git.ktag.clubk.club/Software/2020TPC-SW/pulls/9 - https://git.ktag.clubk.club/Software/KTag-HIL-Tester/pulls/1
Joe added 23 commits 2026-06-04 01:59:02 +00:00
Replaced the fragmented per-state BLE advertisement timers (BLEStatusTimer in
State_Playing and State_Ready) with a single BLEBackgroundAdvertisingTimer in
State_Machine.c. The central timer's callback dispatches to the correct
BLE_UpdateXXXPacket() function based on current state, with a per-state period
(500ms for Playing, 1000ms for Ready/Configuring, 2000ms for Wrapping Up).

SuspendBLEBackgroundAdvertising() and ResumeBLEBackgroundAdvertising() are
exposed from State_Machine for states that need to opt out.
State_Starting_Game__Instigating uses these to suppress the central timer while
it manages its own BLE updates inline.

Two bugs fixed in HandleBLEConfigurationPacket() in State_Configuring:

1. Non-targeted devices were not going quiet during a configuration exchange,
   consuming BLE bandwidth needed by the devices actually communicating.
   They now call BLE_Quiet() explicitly.

2. The BLEConfigurationResponseTimer (which resumes background advertising
   after 3 seconds) was only started when the packet was addressed to this
   device. It now starts unconditionally, so both targeted and non-targeted
   devices resume background advertising after the 3-second window.

BLEConfigurationResponseTimer callback now calls ResumeBLEBackgroundAdvertising()
instead of BLE_UpdateHelloPacket() directly; the background timer handles that
on its next tick.
Added state machine tests.
All checks were successful
Tests / build-and-test (push) Successful in 1m42s
9f62b27cb9
Stop the long press timer when leaving the Interacting state.
All checks were successful
Tests / build-and-test (push) Successful in 14s
b4e1b23c9e
Added BLE tests.
All checks were successful
Tests / build-and-test (push) Successful in 13s
652b020e4f
BLE fixes after HIL testing.
All checks were successful
Tests / build-and-test (push) Successful in 14s
ab5f2062db
One more BLE fix.
All checks were successful
Tests / build-and-test (push) Successful in 13s
3c61ddf87d
Added inventory.
All checks were successful
Tests / build-and-test (push) Successful in 20s
e942ef33b2
First working K-Point transfer.
All checks were successful
Tests / build-and-test (push) Successful in 25s
80f424af55
Fixes from HIL testing.
All checks were successful
Tests / build-and-test (push) Successful in 20s
f0a13359c1
Changes to the Configuring state after testing with many devices.
All checks were successful
Tests / build-and-test (push) Successful in 18s
9aaffb67b6
Handled FreeRTOS differences by platform.
All checks were successful
Tests / build-and-test (push) Successful in 13s
147797efbc
Don't use BLE until the Initialization state is complete.
All checks were successful
Tests / build-and-test (push) Successful in 21s
617835dd37
More reasonable logging.
All checks were successful
Tests / build-and-test (push) Successful in 14s
973e568c50
Stop the Packet Tracker from spamming the console.
All checks were successful
Tests / build-and-test (push) Successful in 27s
Tests / build-and-test (pull_request) Successful in 36s
861f79020b
You lose your KPoints when you're tagged out.
Some checks failed
Tests / build-and-test (push) Failing after 25s
Tests / build-and-test (pull_request) Failing after 16s
6a2b4624fd
Added deduplication to BLE_TRANSFER_REQUEST_INVOLUNTARY_FRIENDLY
All checks were successful
Tests / build-and-test (push) Successful in 29s
Tests / build-and-test (pull_request) Successful in 13s
8b1c79971c
Added Min_RSSI_To_Initiate_Transfer
All checks were successful
Tests / build-and-test (push) Successful in 13s
Tests / build-and-test (pull_request) Successful in 13s
f980a66311
Min_RSSI_To_Initiate_Transfer now configurable over BLE
All checks were successful
Tests / build-and-test (push) Successful in 30s
Tests / build-and-test (pull_request) Successful in 13s
c8bd3ff8ac
DBQ Protocol was sometimes double-counting Purple tags.
All checks were successful
Tests / build-and-test (push) Successful in 26s
Tests / build-and-test (pull_request) Successful in 39s
d996fa255c
Added BLE_UpdateConsolePacket()
All checks were successful
Tests / build-and-test (push) Successful in 15s
Tests / build-and-test (pull_request) Successful in 14s
4ffa68bb31
Added IR protocol tests.
All checks were successful
Tests / build-and-test (push) Successful in 32s
Tests / build-and-test (pull_request) Successful in 48s
8fcc3ca164
Fixed a few things.
All checks were successful
Tests / build-and-test (push) Successful in 25s
Tests / build-and-test (pull_request) Successful in 23s
98d5e06661
Reworked the BLE Quiet logic a bit in the Configuring State.
All checks were successful
Tests / build-and-test (push) Successful in 15s
Tests / build-and-test (pull_request) Successful in 13s
45d7ba8498
GameDurationTimer kept the first game's duration (missing xTimerChangePeriod).
All checks were successful
Tests / build-and-test (push) Successful in 17s
Tests / build-and-test (pull_request) Successful in 12s
5965c61747
Code review: Don't leak the stack in HELLO.
All checks were successful
Tests / build-and-test (push) Successful in 17s
Tests / build-and-test (pull_request) Successful in 13s
105458af15
Added "Test Infrastructure" BLE device type.
All checks were successful
Tests / build-and-test (push) Successful in 15s
Tests / build-and-test (pull_request) Successful in 14s
720fe92e43
More BLE fixes.
All checks were successful
Tests / build-and-test (push) Successful in 14s
Tests / build-and-test (pull_request) Successful in 13s
ffe39e3881
Increased the size of the event queue.
All checks were successful
Tests / build-and-test (push) Successful in 14s
Tests / build-and-test (pull_request) Successful in 14s
cfbe0fa557
BLE throughput improvements.
All checks were successful
Tests / build-and-test (push) Successful in 15s
Tests / build-and-test (pull_request) Successful in 13s
ce668433f7
Settings improvements.
All checks were successful
Tests / build-and-test (push) Successful in 16s
Tests / build-and-test (pull_request) Successful in 14s
d213f060b6
Added asynchronous settings save.
All checks were successful
Tests / build-and-test (push) Successful in 14s
Tests / build-and-test (pull_request) Successful in 14s
485b5ffd26
Added BLE Quiet arbiter.
All checks were successful
Tests / build-and-test (push) Successful in 23s
Tests / build-and-test (pull_request) Successful in 13s
25b477a5f7
Build fix.
All checks were successful
Tests / build-and-test (push) Successful in 13s
Tests / build-and-test (pull_request) Successful in 15s
23dbf8f55f
Move BLE_HandleCommonEvents() to the State Machine task.
All checks were successful
Tests / build-and-test (push) Successful in 14s
Tests / build-and-test (pull_request) Successful in 13s
d8218e7d60
More BLE Quiet fixes.
All checks were successful
Tests / build-and-test (push) Successful in 15s
Tests / build-and-test (pull_request) Successful in 17s
7e1fa3cb59
Better logging.
All checks were successful
Tests / build-and-test (push) Successful in 14s
Tests / build-and-test (pull_request) Successful in 14s
02035e74e1
All checks were successful
Tests / build-and-test (push) Successful in 14s
Tests / build-and-test (pull_request) Successful in 14s
Required
Details
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin coin_game_feature_dev:coin_game_feature_dev
git switch coin_game_feature_dev
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Software/SystemK!16
No description provided.